{
  "openapi": "3.0.1",
  "info": {
    "title": "GestionCervecera API (beta)",
    "description": "BETA: this API works and is documented, but no integration has used it in production yet. Within /api/v1 only additive changes are made — new endpoints and new fields; anything that would break a working integration goes in a new version, with notice. REST API for server-to-server integrations. JWT Bearer authentication. Getting started guide and examples at /api/docs",
    "contact": {
      "name": "Soporte GestionCervecera",
      "email": "desarrollo@gestioncervecera.com"
    },
    "version": "v1"
  },
  "paths": {
    "/api/v1/account": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Gets your account.",
        "responses": {
          "200": {
            "description": "Your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Settings module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Account"
        ],
        "summary": "Updates your account. This is a PARTIAL update: fields not present in the body keep\r\ntheir current value.",
        "description": "`country`, `planId` and `logoUrl` are read-only — see the resource\r\n            remarks. If your `taxConditionId` stops being Argentina's \"Responsable Inscripto\"\r\n            while your account had VAT withholdings enabled, this also turns that setting off, same\r\n            as the web application does — it is not reported back in this response.",
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/AccountDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AccountDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Account updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Settings module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/audit": {
      "get": {
        "tags": [
          "Audit"
        ],
        "summary": "Lists the changes logged in your account.",
        "parameters": [
          {
            "name": "dateFrom",
            "in": "query",
            "description": "Required. Start of the date range, ISO 8601.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "description": "Required. End of the date range, ISO 8601. At most 365 days after `dateFrom`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityType",
            "in": "query",
            "description": "Only changes to this entity type, e.g. `Cliente`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "query",
            "description": "Only changes made by this user.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of audit entries.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditEntryDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "`dateFrom`/`dateTo` missing, invalid, out of order, or spanning more than 365 days.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Reports or Administration module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/auth/login": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Exchanges your account's API key for an access token.",
        "description": "The API key is the only credential — there is no user name and no password. It identifies\r\nyour account, and the permissions of the resulting token are fixed: exactly what this API's\r\nendpoints need, nothing else. A person's login never works here.",
        "requestBody": {
          "description": "Your API key.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/LoginRequest"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/LoginRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authentication succeeded."
          },
          "400": {
            "description": "Missing apiKey.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unknown or inactive API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Too many login attempts from this key and IP. Wait and retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/bank-accounts": {
      "get": {
        "tags": [
          "BankAccounts"
        ],
        "summary": "Lists the bank accounts of your account.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over cbu, alias or number. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated accounts. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of bank accounts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankAccountDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Bank Accounts module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "BankAccounts"
        ],
        "summary": "Creates a bank account.",
        "description": "bankId, accountTypeId and currencyId are required. cbu and number must each be unique\r\namong your account's bank accounts (active or not) — same rule the web application\r\nenforces.",
        "requestBody": {
          "description": "The bank account to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/BankAccountDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BankAccountDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/BankAccountDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/BankAccountDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Bank account created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankAccountDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Bank Accounts module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/bank-accounts/{bankAccountId}": {
      "get": {
        "tags": [
          "BankAccounts"
        ],
        "summary": "Gets a single bank account by id, active or not.",
        "parameters": [
          {
            "name": "bankAccountId",
            "in": "path",
            "description": "Bank account id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The bank account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankAccountDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Bank Accounts module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No bank account with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "BankAccounts"
        ],
        "summary": "Updates a bank account. This is a PARTIAL update: fields not present in the body keep\r\ntheir current value.",
        "description": "currencyId cannot be changed once the account has movements — same rule the web\r\napplication enforces on edit.",
        "parameters": [
          {
            "name": "bankAccountId",
            "in": "path",
            "description": "Bank account id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/BankAccountDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BankAccountDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/BankAccountDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/BankAccountDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bank account updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankAccountDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Bank Accounts module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No bank account with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/bank-accounts/{bankAccountId}/deactivate": {
      "post": {
        "tags": [
          "BankAccounts"
        ],
        "summary": "Deactivates a bank account. The record is never physically deleted: it stays reachable\r\nthrough GET /bank-accounts/{bankAccountId}. Idempotent.",
        "description": "There is no check here for existing movements or a non-zero balance — the web\r\napplication itself has none either. Replicated as-is, not a gap introduced by the API.",
        "parameters": [
          {
            "name": "bankAccountId",
            "in": "path",
            "description": "Bank account id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bank account deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Bank Accounts module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No bank account with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/bank-accounts/{bankAccountId}/activate": {
      "post": {
        "tags": [
          "BankAccounts"
        ],
        "summary": "Reactivates a previously deactivated bank account. Idempotent.",
        "parameters": [
          {
            "name": "bankAccountId",
            "in": "path",
            "description": "Bank account id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bank account reactivated, or already active."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Bank Accounts module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No bank account with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/bank-accounts/{bankAccountId}/movements": {
      "get": {
        "tags": [
          "BankAccounts"
        ],
        "summary": "Lists the movements (transactions) of a bank account.",
        "description": "Read-only: there is no way to record or cancel a movement through this API yet. See the\r\nremarks on `BankMovementDto`.",
        "parameters": [
          {
            "name": "bankAccountId",
            "in": "path",
            "description": "Bank account id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Keep only movements on or after this date, `YYYY-MM-DD`. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Keep only movements on or before this date, `YYYY-MM-DD`. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of movements.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankMovementDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "A date is not ISO 8601, or `from` is later than `to`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Bank Movements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No bank account with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "BankAccounts"
        ],
        "summary": "Records a movement on a bank account.",
        "description": "Records a PLAIN movement: money in or out, optionally against a customer's or a supplier's\r\ncurrent account. Settling orders or purchases, withholdings, cheques and agenda events are\r\nNOT part of this endpoint — the server forces the conservative branch for all of them, so\r\na movement created here cannot reach the code that writes orders or purchases.\r\n            \r\nThe movement's currency is the account's. When the customer's or supplier's currency is a\r\ndifferent one, exchangeRate becomes required.\r\n            \r\nA movement cannot be cancelled through the API.",
        "parameters": [
          {
            "name": "bankAccountId",
            "in": "path",
            "description": "Bank account id. The movement is always recorded against this\r\n             account: it is never read from the body.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The movement to record.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/BankMovementCreateDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BankMovementCreateDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/BankMovementCreateDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/BankMovementCreateDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Movement recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankMovementDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Bank Movements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No bank account with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/batches": {
      "get": {
        "tags": [
          "Batches"
        ],
        "summary": "Lists the batches of your account, newest first.",
        "description": "The listing omits the tasks: including them would mean one extra query per row. Read\r\nGET /api/v1/batches/{batchId}/tasks for the tasks of a specific batch.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over the batch number and its description. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "stageId",
            "in": "query",
            "description": "Keep only batches in this stage. Optional; listed by GET /api/v1/production-stages.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "unfinishedOnly",
            "in": "query",
            "description": "True keeps only the batches that have not reached the finished stage. Cannot be combined\r\nwith stageId — if both are sent, stageId wins.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated batches. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of batches.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Batches module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or concurrency limit exceeded — see Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Batches"
        ],
        "summary": "Creates a batch.",
        "description": "The same business rules the web application enforces apply here: the number is required and\r\nmust not match another active batch, the product is required, a tank is required from the\r\nfermentation stage onwards, and the litres cannot exceed the tank's capacity.\r\n            \r\nA batch created directly in the brewing stage registers its litres as product stock, exactly\r\nas the application does. Creating it as planned instead registers nothing until you move it\r\nwith POST /api/v1/batches/{batchId}/stage.",
        "requestBody": {
          "description": "The batch to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/BatchDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/BatchDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Batch created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Batches module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/batches/{batchId}": {
      "get": {
        "tags": [
          "Batches"
        ],
        "summary": "Gets a single batch by id, active or not.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Batches module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Batches"
        ],
        "summary": "Partially updates a batch: only the fields you send change.",
        "description": "The stage is NOT changed here — send it to POST /api/v1/batches/{batchId}/stage. A finished\r\nbatch cannot be updated at all, and the product cannot be changed once the batch has been\r\nbrewed unless your account enables it.\r\n            \r\nThe litres cannot be lowered: to take litres out of a batch you register waste, which keeps\r\nthe loss accounted for. That operation is not part of this version.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/BatchDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/BatchDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Batches module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/batches/{batchId}/stage": {
      "post": {
        "tags": [
          "Batches"
        ],
        "summary": "Moves a batch to another production stage.",
        "description": "This is the operation that advances production, and it does more than set a field: it\r\nrecords the transition in the batch's history, moves the product's stock, and reserves or\r\nfrees the tank. That is why it is a separate call and not part of the PUT.\r\n            \r\nIt does not harvest or assign reusable yeast, and it does not take supplies out of stock:\r\nthose need their own resources and are not part of this version. A batch whose account works\r\nwith reusable yeast should be advanced from the application, not from here.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The stage to move to, and the tank the batch moves into.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/BatchStageChangeDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchStageChangeDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchStageChangeDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/BatchStageChangeDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The batch in its new stage.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchDto"
                }
              }
            }
          },
          "400": {
            "description": "The transition is not allowed, or the tank is taken. Read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Change Batch Stage module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/batches/{batchId}/deactivate": {
      "post": {
        "tags": [
          "Batches"
        ],
        "summary": "Deactivates a batch. The record is never physically deleted: it keeps its history and stays\r\nreachable through GET /batches/{batchId}. Idempotent.",
        "description": "Deactivating a batch reverses what it put into stock and frees its tank. The supplies it\r\nconsumed are NOT returned to stock: doing that is a choice the application asks the user to\r\nmake, and this version does not offer it, so it takes the conservative branch and leaves the\r\nsupplies consumed.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Batch deactivated, or already inactive."
          },
          "400": {
            "description": "A business rule prevents deactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Batches module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/batches/{batchId}/activate": {
      "post": {
        "tags": [
          "Batches"
        ],
        "summary": "Reactivates a previously deactivated batch. Idempotent.",
        "description": "Reactivation is rejected when the tank the batch had is now deactivated or holds another\r\nbatch, and when another active batch has taken its number. The message names which one.\r\n            \r\nThe supplies are NOT taken out of stock again, for the same reason deactivation does not\r\nreturn them: it is a choice this version does not offer.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Batch reactivated, or already active."
          },
          "400": {
            "description": "A business rule prevents reactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Batches module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/batches/{batchId}/tasks": {
      "get": {
        "tags": [
          "Batches"
        ],
        "summary": "Lists the tasks of a batch.",
        "description": "The tasks of a batch are generated with it from its recipe: they are not created one by one,\r\nwhich is why this resource has no POST. Standalone tasks, which you do create, are a\r\ndifferent resource: /api/v1/tasks.\r\n            \r\nThe list is not paginated: a batch has as many tasks as its recipe defines — tens, not\r\nthousands.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The tasks of the batch.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BatchTaskDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Batches module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/batches/{batchId}/tasks/{batchTaskId}/complete": {
      "post": {
        "tags": [
          "Batches"
        ],
        "summary": "Completes a task of a batch.",
        "description": "A task already completed is rejected — use /reopen first. A task assigned to another user is\r\nrejected unless the integration user may see everyone's tasks.\r\n            \r\nCompleting a task does NOT take its supplies out of stock, even when the definition says it\r\nshould: the quantities come from a sub-resource this version does not publish. The task is\r\nmarked complete and the measurement is recorded.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "batchTaskId",
            "in": "path",
            "description": "Batch task id, from GET /batches/{batchId}/tasks.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "What to record. Every field is optional; an empty body is valid.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/TaskCompletionDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskCompletionDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskCompletionDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/TaskCompletionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The completed task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchTaskDto"
                }
              }
            }
          },
          "400": {
            "description": "The task is already complete, belongs to someone else, or the measured value is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Complete Production Task module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id, or no such task in that batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/batches/{batchId}/tasks/{batchTaskId}/reopen": {
      "post": {
        "tags": [
          "Batches"
        ],
        "summary": "Reopens a completed task of a batch.",
        "description": "A task that is not complete is rejected, and so is any task of a finished batch: reopening\r\nit would reopen production that has already been closed.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "batchTaskId",
            "in": "path",
            "description": "Batch task id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The reopened task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchTaskDto"
                }
              }
            }
          },
          "400": {
            "description": "The task is not complete, or its batch is finished. Read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Complete Production Task module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id, or no such task in that batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/batches/{batchId}/extended-notes": {
      "get": {
        "tags": [
          "Batches"
        ],
        "summary": "Gets the extended notes of a batch.",
        "description": "Long free-form HTML content from the application's rich text editor. It is its own\r\nsub-resource and not a field of the batch: it is never listed in GET /batches or\r\nGET /batches/{batchId}.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The extended notes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchExtendedNotesDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Batches module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Batches"
        ],
        "summary": "Replaces the extended notes of a batch.",
        "description": "content absent leaves the notes unchanged; content sent as null clears them.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The notes to save. Only content is written; lastModifiedOn and lastModifiedByUserId are\r\nread-only and ignored if sent.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/BatchExtendedNotesDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchExtendedNotesDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchExtendedNotesDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/BatchExtendedNotesDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved extended notes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchExtendedNotesDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Batches module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/batches/{batchId}/supplies": {
      "get": {
        "tags": [
          "Batches"
        ],
        "summary": "Lists the supplies a batch consumed.",
        "description": "What the batch actually took out of the raw material warehouse, one line per movement,\r\nwith the supplier's own lot numbers when the account records them.\r\n            \r\n`quantity` is SIGNED: positive when the supply left the warehouse for this batch,\r\nnegative when it came back. Sum the column to get net consumption. Supply is discounted\r\nonce, when the batch enters the brewing stage — see POST /batches/{batchId}/stage and its\r\n`discountsStock` flag. A batch that never discounted returns an empty list.\r\n            \r\nNot paged on purpose: the number of supplies of a batch is bounded by its recipe.\r\n            \r\nThis is the same data the costing uses, read through the same query, so the two can never\r\ndisagree. What a supply is WORTH is a different resource: stock-valuation-cost.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The supply movements of the batch.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BatchSupplyDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplies module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/batches/{batchId}/measurements": {
      "get": {
        "tags": [
          "Batches"
        ],
        "summary": "Lists the measurements recorded on a batch, most recent first.",
        "description": "Includes measurements recorded directly through this resource AND those recorded when\r\ncompleting a task that asked for one (POST .../tasks/{batchTaskId}/complete) — batchTaskId\r\ntells the two apart.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated measurements. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of measurements.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeasurementDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Measurements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Batches"
        ],
        "summary": "Records a measurement on a batch directly, without completing a task.",
        "description": "The stage is stamped with the batch's current one at the moment of recording, and the user\r\ncomes from your token — neither is part of the request. There is no PUT: to correct a\r\nmeasurement, deactivate it and record a new one.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The measurement to record. measurementTypeId and value are required.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/MeasurementCreateRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MeasurementCreateRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/MeasurementCreateRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/MeasurementCreateRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created measurement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeasurementDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing body, missing required field, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Measurements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/batches/{batchId}/measurements/{measurementId}": {
      "get": {
        "tags": [
          "Batches"
        ],
        "summary": "Gets a single measurement of a batch by id, active or not.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "measurementId",
            "in": "path",
            "description": "Measurement id, from GET /batches/{batchId}/measurements.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The measurement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeasurementDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Measurements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id, or no such measurement in that batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/batches/{batchId}/measurements/{measurementId}/deactivate": {
      "post": {
        "tags": [
          "Batches"
        ],
        "summary": "Deactivates a measurement of a batch. The record is never physically deleted: it keeps its\r\nhistory and stays reachable through GET .../measurements/{measurementId}. Idempotent.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "measurementId",
            "in": "path",
            "description": "Measurement id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Measurement deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Measurements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id, or no such measurement in that batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/batches/{batchId}/waste": {
      "get": {
        "tags": [
          "Batches"
        ],
        "summary": "Lists the waste recorded on a batch, most recent first.",
        "description": "Includes losses recorded directly through this resource AND losses recorded\r\nautomatically while packaging the batch or splitting it — tankId/barrels/\r\nexternalBatchNumber tell them apart from a manual entry, which never sets them.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated records. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of waste records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WasteDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Production module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Batches"
        ],
        "summary": "Records a loss (waste) on a batch.",
        "description": "tankId is stamped from the batch's own tank, never part of the request. There is no PUT\r\nor deactivate in the API. A manual waste record can be written off from the web\r\napplication (batch page); it then has active = false and is listed only with\r\nincludeInactive=true.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The loss to record. stageId, wasteTypeId, liters and recordedOn are required.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/WasteCreateRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WasteCreateRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/WasteCreateRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/WasteCreateRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created waste record.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WasteDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing body, missing required field, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Production module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/batches/{batchId}/waste/{wasteId}": {
      "get": {
        "tags": [
          "Batches"
        ],
        "summary": "Gets a single waste record of a batch by id.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "description": "Batch id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "wasteId",
            "in": "path",
            "description": "Waste record id, from GET /batches/{batchId}/waste.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The waste record.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WasteDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Production module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No batch with that id, or no such waste record in that batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/brands": {
      "get": {
        "tags": [
          "Brands"
        ],
        "summary": "Lists the brands of your account.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over name. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of brands.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrandDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Brands module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Brands"
        ],
        "summary": "Creates a brand.",
        "description": "name is required.",
        "requestBody": {
          "description": "The brand to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/BrandDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrandDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/BrandDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/BrandDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Brand created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrandDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Brands module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/brands/{brandId}": {
      "get": {
        "tags": [
          "Brands"
        ],
        "summary": "Gets a single brand by id, active or not.",
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "description": "Brand id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The brand.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrandDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Brands module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No brand with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Brands"
        ],
        "summary": "Updates a brand. This is a PARTIAL update: fields not present in the body keep their\r\ncurrent value.",
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "description": "Brand id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/BrandDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrandDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/BrandDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/BrandDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Brand updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrandDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Brands module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No brand with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/brands/{brandId}/deactivate": {
      "post": {
        "tags": [
          "Brands"
        ],
        "summary": "Deactivates a brand. The record is never physically deleted: it stays reachable through\r\nGET /brands/{brandId}. Idempotent.",
        "description": "There is no /activate: the web application itself has no reactivation for a brand once\r\ndeactivated (same situation already documented for mix-packs).",
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "description": "Brand id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Brand deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Brands module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No brand with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/brewery-assets": {
      "get": {
        "tags": [
          "BreweryAssets"
        ],
        "summary": "Lists your brewery assets, by id.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Matches the code or name. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "description": "Keep only assets currently at this customer. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "True also returns deactivated assets. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of brewery assets.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BreweryAssetDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Brewery Assets module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "BreweryAssets"
        ],
        "summary": "Creates a brewery asset.",
        "description": "`code` is required.",
        "requestBody": {
          "description": "The brewery asset to create.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/BreweryAssetDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BreweryAssetDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/BreweryAssetDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/BreweryAssetDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Brewery asset created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BreweryAssetDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Brewery Assets module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/brewery-assets/{assetId}": {
      "get": {
        "tags": [
          "BreweryAssets"
        ],
        "summary": "Gets a single brewery asset by id.",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "description": "Brewery asset id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The brewery asset.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BreweryAssetDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Brewery Assets module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No brewery asset with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "BreweryAssets"
        ],
        "summary": "Partially updates a brewery asset: only the fields you send change.",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "description": "Brewery asset id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/BreweryAssetDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BreweryAssetDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/BreweryAssetDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/BreweryAssetDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated brewery asset.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BreweryAssetDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Brewery Assets module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No brewery asset with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/brewery-assets/{assetId}/deactivate": {
      "post": {
        "tags": [
          "BreweryAssets"
        ],
        "summary": "Deactivates a brewery asset.",
        "description": "Idempotent: deactivating an already inactive asset answers 200 without changing anything.",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "description": "Brewery asset id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Brewery Assets module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No brewery asset with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/brewery-assets/{assetId}/activate": {
      "post": {
        "tags": [
          "BreweryAssets"
        ],
        "summary": "Reactivates a brewery asset.",
        "description": "Idempotent: reactivating an already active asset answers 200 without changing anything.",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "description": "Brewery asset id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Reactivated, or already active."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Brewery Assets module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No brewery asset with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/brewery-assets/deliveries": {
      "post": {
        "tags": [
          "BreweryAssets"
        ],
        "summary": "Delivers one or more brewery assets to a customer, for the first time.",
        "description": "Rama conservadora: solo acepta brewery assets, nunca tap systems ni los productos\r\ncomplementarios que la pantalla web deja mezclar en la misma entrega — ver el\r\n`remarks` de GCerv.Api.Dto.BreweryAssetDeliveryRequestDto.",
        "requestBody": {
          "description": "Destination customer and the assets to deliver.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/BreweryAssetDeliveryRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BreweryAssetDeliveryRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/BreweryAssetDeliveryRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/BreweryAssetDeliveryRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The delivery note created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BreweryAssetDeliveryDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Brewery Asset Deliveries/Returns module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "The customer, or a brewery asset in the body, doesn't exist in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "BreweryAssets"
        ],
        "summary": "Lists your brewery asset delivery notes.",
        "description": "Lines aren't included in the listing — get one delivery note by id for its lines.",
        "parameters": [
          {
            "name": "customerId",
            "in": "query",
            "description": "Keep only deliveries to this customer. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "True also returns voided delivery notes. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of delivery notes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BreweryAssetDeliveryDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Brewery Asset Deliveries/Returns module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/brewery-assets/returns": {
      "post": {
        "tags": [
          "BreweryAssets"
        ],
        "summary": "A customer returning one or more brewery assets.",
        "requestBody": {
          "description": "The brewery assets being returned.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/BreweryAssetReturnRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BreweryAssetReturnRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/BreweryAssetReturnRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/BreweryAssetReturnRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The returned brewery assets.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BreweryAssetDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or an asset isn't currently at a customer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Brewery Asset Deliveries/Returns module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "An asset in the body doesn't exist in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/brewery-assets/deliveries/{deliveryId}": {
      "get": {
        "tags": [
          "BreweryAssets"
        ],
        "summary": "Gets a single delivery note by id, with its lines.",
        "parameters": [
          {
            "name": "deliveryId",
            "in": "path",
            "description": "Delivery note id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The delivery note.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BreweryAssetDeliveryDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Brewery Asset Deliveries/Returns module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No delivery note with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/brewery-assets/deliveries/{deliveryId}/void": {
      "post": {
        "tags": [
          "BreweryAssets"
        ],
        "summary": "Voids a delivery note, reverting every brewery asset on it as if it were never delivered.",
        "description": "Idempotent: voiding an already voided delivery note answers 200 without changing anything.",
        "parameters": [
          {
            "name": "deliveryId",
            "in": "path",
            "description": "Delivery note id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Voided, or already voided.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BreweryAssetDeliveryDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Brewery Asset Deliveries/Returns module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No delivery note with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calendar-events": {
      "get": {
        "tags": [
          "CalendarEvents"
        ],
        "summary": "Lists the manually-created calendar events of your account.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "description": "Only events on or after this date (`yyyy-MM-dd`). Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Only events on or before this date (`yyyy-MM-dd`). Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "categoryId",
            "in": "query",
            "description": "Only events of this category. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Free text over description. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated events. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of calendar events.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarEventDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the EventoAgenda module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "CalendarEvents"
        ],
        "summary": "Creates a calendar event.",
        "description": "categoryId and eventDate are required. There is no way to create an event linked to a\r\npurchase, check, cash register, bank account or maintenance through this endpoint —\r\nevery event created here is a \"suelto\" one.",
        "requestBody": {
          "description": "The event to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarEventDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarEventDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarEventDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarEventDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Calendar event created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarEventDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the CrearEditarEventoAgenda module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calendar-events/{calendarEventId}": {
      "get": {
        "tags": [
          "CalendarEvents"
        ],
        "summary": "Gets a single calendar event by id, active or not.",
        "parameters": [
          {
            "name": "calendarEventId",
            "in": "path",
            "description": "Calendar event id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The calendar event.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarEventDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the EventoAgenda module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No calendar event with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "CalendarEvents"
        ],
        "summary": "Updates a calendar event. This is a PARTIAL update: fields not present in the body keep\r\ntheir current value.",
        "parameters": [
          {
            "name": "calendarEventId",
            "in": "path",
            "description": "Calendar event id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarEventDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarEventDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarEventDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarEventDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calendar event updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarEventDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the CrearEditarEventoAgenda module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No calendar event with that id in your account, or it is deactivated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calendar-events/{calendarEventId}/deactivate": {
      "post": {
        "tags": [
          "CalendarEvents"
        ],
        "summary": "Deactivates a calendar event. The record is never physically deleted: it stays\r\nreachable through GET /calendar-events/{calendarEventId}. Idempotent.",
        "description": "Blocked (400) once another domain has applied this event (paid/collected against it) —\r\nsame rule the web application's own Delete already enforces. This never actually\r\nhappens for an event created through this resource, since no other domain links to one\r\ncreated here; it can still happen for one created by the web application before this\r\nendpoint existed.",
        "parameters": [
          {
            "name": "calendarEventId",
            "in": "path",
            "description": "Calendar event id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Calendar event deactivated, or already inactive."
          },
          "400": {
            "description": "The event is already applied. Read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the EliminarEventoAgenda module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No calendar event with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calendar-events/{calendarEventId}/activate": {
      "post": {
        "tags": [
          "CalendarEvents"
        ],
        "summary": "Reactivates a previously deactivated calendar event. Idempotent.",
        "parameters": [
          {
            "name": "calendarEventId",
            "in": "path",
            "description": "Calendar event id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Calendar event reactivated, or already active."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the CrearEditarEventoAgenda module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No calendar event with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calendar-events/recurring": {
      "get": {
        "tags": [
          "CalendarEvents"
        ],
        "summary": "Lists the recurring calendar event templates of your account.",
        "description": "Excludes templates that belong to a maintenance — those already publish their own\r\nrecurrence through <a href=\"#maintenances\">`maintenances`</a>'\r\n`recurring`/`recurrenceEvery`/`recurrencePeriod` fields.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over title/description. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated templates. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of recurring templates.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarEventRecurringDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the EventoAgenda module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "CalendarEvents"
        ],
        "summary": "Creates a recurring calendar event template.",
        "description": "eventDate, every and period are required. period must be one of: days, months, years.",
        "requestBody": {
          "description": "The template to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarEventRecurringDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarEventRecurringDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarEventRecurringDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarEventRecurringDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Recurring template created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarEventRecurringDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the CrearEditarEventoAgenda module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calendar-events/recurring/{recurringEventId}": {
      "get": {
        "tags": [
          "CalendarEvents"
        ],
        "summary": "Gets a single recurring calendar event template by id, active or not.",
        "parameters": [
          {
            "name": "recurringEventId",
            "in": "path",
            "description": "Recurring template id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The recurring template.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarEventRecurringDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the EventoAgenda module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No recurring template with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "CalendarEvents"
        ],
        "summary": "Updates a recurring calendar event template. This is a PARTIAL update: fields not\r\npresent in the body keep their current value.",
        "parameters": [
          {
            "name": "recurringEventId",
            "in": "path",
            "description": "Recurring template id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarEventRecurringDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarEventRecurringDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarEventRecurringDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarEventRecurringDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recurring template updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarEventRecurringDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the CrearEditarEventoAgenda module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No recurring template with that id in your account, or it is deactivated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calendar-events/recurring/{recurringEventId}/deactivate": {
      "post": {
        "tags": [
          "CalendarEvents"
        ],
        "summary": "Deactivates a recurring calendar event template. The record is never physically\r\ndeleted: it stays reachable through GET /calendar-events/recurring/{recurringEventId}.\r\nIdempotent.",
        "description": "No business rule blocks it — same as the web application.",
        "parameters": [
          {
            "name": "recurringEventId",
            "in": "path",
            "description": "Recurring template id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recurring template deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the EliminarEventoAgenda module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No recurring template with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calendar-events/recurring/{recurringEventId}/activate": {
      "post": {
        "tags": [
          "CalendarEvents"
        ],
        "summary": "Reactivates a previously deactivated recurring calendar event template. Idempotent.",
        "parameters": [
          {
            "name": "recurringEventId",
            "in": "path",
            "description": "Recurring template id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recurring template reactivated, or already active."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the CrearEditarEventoAgenda module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No recurring template with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calendar-events/recurring/{recurringEventId}/exclude-date": {
      "post": {
        "tags": [
          "CalendarEvents"
        ],
        "summary": "Excludes one occurrence date from a recurring template's future occurrences.",
        "description": "Idempotent: excluding an already-excluded date changes nothing. There is no endpoint to\r\nremove a date once excluded — same as the web application.",
        "parameters": [
          {
            "name": "recurringEventId",
            "in": "path",
            "description": "Recurring template id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Date to exclude (`yyyy-MM-dd`), in the body: `{ \"date\": \"2026-11-01\" }`.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ExcludeDateRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExcludeDateRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ExcludeDateRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ExcludeDateRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Date excluded, or already excluded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarEventRecurringDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the EliminarEventoAgenda module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No recurring template with that id in your account, or it is deactivated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cash-registers": {
      "get": {
        "tags": [
          "CashRegisters"
        ],
        "summary": "Lists the cash registers of your account, including the two system-defined ones.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over name. Optional — matches nothing on system-defined entries.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated registers. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of cash registers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CashRegisterDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Cash Registers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "CashRegisters"
        ],
        "summary": "Creates a cash register.",
        "description": "name is required. currencyId is always your account's default currency, regardless of\r\nwhat is sent — same as the web application's own save. There is no way to assign a user\r\nto this register through this endpoint; that stays a web-only operation for now.",
        "requestBody": {
          "description": "The register to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CashRegisterDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CashRegisterDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CashRegisterDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CashRegisterDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Cash register created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CashRegisterDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Cash Registers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cash-registers/{cashRegisterId}": {
      "get": {
        "tags": [
          "CashRegisters"
        ],
        "summary": "Gets a single cash register by id, active or not.",
        "parameters": [
          {
            "name": "cashRegisterId",
            "in": "path",
            "description": "Cash register id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The cash register.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CashRegisterDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Cash Registers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No cash register with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "CashRegisters"
        ],
        "summary": "Updates a cash register. This is a PARTIAL update: fields not present in the body keep\r\ntheir current value.",
        "description": "System-defined registers (the ones you did not create) cannot be edited through this\r\nendpoint — the web application itself has no such action either, this just answers 404\r\nfor their id, same as the web's own Edit screen would.",
        "parameters": [
          {
            "name": "cashRegisterId",
            "in": "path",
            "description": "Cash register id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CashRegisterDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CashRegisterDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CashRegisterDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CashRegisterDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cash register updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CashRegisterDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Cash Registers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No cash register with that id in your account, or it is system-defined.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cash-registers/{cashRegisterId}/deactivate": {
      "post": {
        "tags": [
          "CashRegisters"
        ],
        "summary": "Deactivates a cash register. The record is never physically deleted: it stays reachable\r\nthrough GET /cash-registers/{cashRegisterId}. Idempotent.",
        "description": "There is no check here for existing movements or a non-zero balance — the web\r\napplication itself has none either. Replicated as-is, not a gap introduced by the API.",
        "parameters": [
          {
            "name": "cashRegisterId",
            "in": "path",
            "description": "Cash register id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cash register deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Cash Registers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No cash register with that id in your account, or it is system-defined.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cash-registers/{cashRegisterId}/activate": {
      "post": {
        "tags": [
          "CashRegisters"
        ],
        "summary": "Reactivates a previously deactivated cash register. Idempotent.",
        "parameters": [
          {
            "name": "cashRegisterId",
            "in": "path",
            "description": "Cash register id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cash register reactivated, or already active."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Cash Registers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No cash register with that id in your account, or it is system-defined.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cash-registers/{cashRegisterId}/movements": {
      "get": {
        "tags": [
          "CashRegisters"
        ],
        "summary": "Lists the movements (transactions) of a cash register.",
        "description": "Read-only: there is no way to record, cancel or transfer a movement through this API yet.\r\nSee the remarks on `CashMovementDto`.",
        "parameters": [
          {
            "name": "cashRegisterId",
            "in": "path",
            "description": "Cash register id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Keep only movements on or after this date, `YYYY-MM-DD`. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Keep only movements on or before this date, `YYYY-MM-DD`. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 100 for this resource (lower than the usual 200).",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of movements.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CashMovementDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "A date is not ISO 8601, or `from` is later than `to`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Cash Registers (screen) module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No cash register with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cash-registers/{cashRegisterId}/open": {
      "post": {
        "tags": [
          "CashRegisters"
        ],
        "summary": "Opens the shift of a cash register.",
        "description": "Writes two movements in one transaction, exactly like the web application: the opening on\r\nthis register, and its mirror expense on the main cash register the money comes out of.\r\n            \r\nFails with `400` if the register's shift is already open.",
        "parameters": [
          {
            "name": "cashRegisterId",
            "in": "path",
            "description": "Cash register id. Cannot be the main cash register.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The cash amount the shift opens with.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CashRegisterShiftDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CashRegisterShiftDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CashRegisterShiftDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CashRegisterShiftDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Shift opened.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CashRegisterDto"
                }
              }
            }
          },
          "400": {
            "description": "Already open, negative amount, or the main cash register.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Cash Registers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No cash register with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cash-registers/{cashRegisterId}/close": {
      "post": {
        "tags": [
          "CashRegisters"
        ],
        "summary": "Closes the shift of a cash register.",
        "description": "Writes two movements in one transaction, exactly like the web application: the closing on\r\nthis register, and its mirror income on the main cash register the money goes back to.\r\n            \r\nFails with `400` if the register's shift is not open.",
        "parameters": [
          {
            "name": "cashRegisterId",
            "in": "path",
            "description": "Cash register id. Cannot be the main cash register.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The cash amount the shift closes with.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CashRegisterShiftDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CashRegisterShiftDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CashRegisterShiftDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CashRegisterShiftDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Shift closed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CashRegisterDto"
                }
              }
            }
          },
          "400": {
            "description": "Not open, negative amount, or the main cash register.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Cash Registers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No cash register with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tax-conditions": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the tax conditions valid for the country of your account.",
        "description": "The set depends on the country, so it is not enumerated in this specification. Read it once\r\nand cache it: it changes only when a country's tax rules change.",
        "responses": {
          "200": {
            "description": "The tax conditions of your account's country.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/provinces": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the provinces, states or regions of your account's country.",
        "description": "What this division is called changes with the country — province, state, region — but the\r\nfield is the same. Read it once and cache it.",
        "responses": {
          "200": {
            "description": "The provinces of your account's country.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/payment-terms": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the payment terms you can assign to a customer.",
        "description": "Current account (1) and cash (2) exist everywhere. A third option, payment in advance, is\r\nonly available in some countries — which is why this is a discovery endpoint and not a\r\nfixed enumeration in this specification.",
        "responses": {
          "200": {
            "description": "The payment terms available to your account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/currencies": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the currencies your account can operate with.",
        "description": "Your account's own currency, plus the international ones enabled for your country. A\r\ncustomer with currencyId null uses your account's default currency.",
        "responses": {
          "200": {
            "description": "The currencies.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales-reps": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the users who can be assigned to a customer as its sales representative.",
        "description": "Only active users holding a sales role are returned.",
        "responses": {
          "200": {
            "description": "The sales representatives.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/logistics-providers": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the logistics providers of your account.",
        "description": "Returns an empty array if your account does not use logistics providers. An empty array is\r\nnot an error: it means there is nothing to choose from, so leave the field null.",
        "responses": {
          "200": {
            "description": "The logistics providers, possibly none.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tax-systems": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the tax regimes defined by the Mexican tax authority.",
        "description": "Codes are text, not numbers: send them exactly as returned. Empty unless your account is\r\nin Mexico — the field does not apply elsewhere.",
        "responses": {
          "200": {
            "description": "The tax regimes, or an empty array outside Mexico.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CodedCatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/invoice-uses": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the CFDI uses defined by the Mexican tax authority.",
        "description": "Empty unless your account is in Mexico.",
        "responses": {
          "200": {
            "description": "The CFDI uses, or an empty array outside Mexico.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CodedCatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/payment-forms": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the payment forms defined by the Mexican tax authority.",
        "description": "This is the tax authority's payment form, not the commercial terms you agreed with the\r\ncustomer — those are paymentTermsId. Empty unless your account is in Mexico.",
        "responses": {
          "200": {
            "description": "The payment forms, or an empty array outside Mexico.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CodedCatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/payment-methods": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the payment methods defined by the Mexican tax authority.",
        "description": "Empty unless your account is in Mexico.",
        "responses": {
          "200": {
            "description": "The payment methods, or an empty array outside Mexico.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CodedCatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/dispatch-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the dispatch types used by electronic dispatch notes in Chile.",
        "description": "Empty unless your account is in Chile.",
        "responses": {
          "200": {
            "description": "The dispatch types, or an empty array outside Chile.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplier-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the supplier types.",
        "description": "Only suppliers of the logistics type can be assigned to a customer as its logistics\r\nprovider. Read it once and cache it: the set is fixed.",
        "responses": {
          "200": {
            "description": "The supplier types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/expense-accounts": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the accounts a purchase or a supplier's spending can be charged to.",
        "description": "Only expense and mixed accounts are returned: an income-only account cannot receive a\r\npurchase. The set mixes system-wide accounts with accounts defined by your own chart.",
        "responses": {
          "200": {
            "description": "The expense accounts.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplier module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/account-categories": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the categories a chart-of-accounts entry can belong to.",
        "description": "Read-only: account categories have their own full CRUD in the web application, but this\r\nversion only publishes enough to validate categoryId, not the category as its own resource.",
        "responses": {
          "200": {
            "description": "The account categories.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Chart of Accounts module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/purchase-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the kinds of purchase voucher: a purchase, or a credit note.",
        "description": "The two move stock in opposite directions, which is why the type cannot be changed after the\r\npurchase is recorded.",
        "responses": {
          "200": {
            "description": "The purchase types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/voucher-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the fiscal voucher types.",
        "description": "Which types exist depends on the tax rules of your country, and the ones retired by the tax\r\nauthority are not returned — which is why this is a discovery endpoint and not a fixed\r\nenumeration in this specification.",
        "responses": {
          "200": {
            "description": "The voucher types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/payment-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the payment methods.",
        "description": "This is how you pay a supplier. Not to be confused with a customer's paymentTermsId, which\r\nis how the customer pays you.",
        "responses": {
          "200": {
            "description": "The payment methods.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/units": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the units of measure.",
        "description": "When a line stocks a supply, the unit must be convertible to that supply's own base unit or\r\nthe purchase is rejected — kilograms into a supply measured in litres does not convert.",
        "responses": {
          "200": {
            "description": "The units of measure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/complementary-products": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the complementary products of your account.",
        "description": "These are the only products a purchase can stock: the beer you brew enters stock through\r\npackaging, not through a purchase.",
        "responses": {
          "200": {
            "description": "The complementary products.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/purchasable-services": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the services your account buys.",
        "description": "A line that pays for a service moves no stock.",
        "responses": {
          "200": {
            "description": "The services.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/product-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the product types.",
        "responses": {
          "200": {
            "description": "The product types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/containers": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the individual containers a product can be sold in.",
        "description": "Bottles, cans and kegs. The set mixes system-wide containers with the returnable containers\r\nyour account has registered, so it is data of your account and not a fixed list.",
        "responses": {
          "200": {
            "description": "The containers.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cases": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the cases and packs a product can be sold in.",
        "description": "A case groups a number of containers — a six-pack of 355 ml cans, a crate of twelve bottles.\r\nThe set mixes system-wide cases with the ones your account defined.",
        "responses": {
          "200": {
            "description": "The cases.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/production-stages": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the production stages a batch goes through.",
        "description": "Planned, brewing, fermenting, maturing, filtering and finished, in that order. A batch only\r\nmoves forward through them, with one exception: from filtering it may go back.",
        "responses": {
          "200": {
            "description": "The production stages.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Batches module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/brewable-products": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the products a batch can produce.",
        "description": "A narrower set than GET /api/v1/products: only the products your brewery makes itself. It\r\nleaves out complementary products, discounts and mix packs, none of which come out of a\r\nbatch. That is why this field has its own catalog instead of pointing at /products, which\r\nwould offer you ids the batch rejects.",
        "responses": {
          "200": {
            "description": "The products a batch can produce.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Batches module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/measurement-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the measurements a task can ask for when it is completed.",
        "description": "Gravity, pH, temperature and the like. Only a temperature may be reported as a negative\r\nvalue: a negative gravity or pH is rejected as a data-entry mistake.",
        "responses": {
          "200": {
            "description": "The measurement types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tasks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/users": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the users of your account, so a task can be assigned to one.",
        "description": "Only the id and the name are published. E-mail addresses, usernames and roles are not: they\r\nare personal data and credentials, and assigning a task does not need them.",
        "responses": {
          "200": {
            "description": "The users.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tasks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/raw-material-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the kinds of raw material a recipe ingredient can be.",
        "description": "Malt, hops, yeast, adjuncts. Omitting the field on an ingredient takes the kind the supply\r\nitself declares, which is what the application does.",
        "responses": {
          "200": {
            "description": "The raw material types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Recipes module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/raw-material-uses": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists what a recipe ingredient can be used for.",
        "description": "Mash, boil, whirlpool, dry hopping and the like.",
        "responses": {
          "200": {
            "description": "The raw material uses.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Recipes module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sales-taxes": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/purchase-taxes": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the taxes a purchase can carry in your account's country.",
        "description": "A different set from `/sales-taxes`: what a purchase supports is not what a sale\r\nsettles. The rate is not published, for the same reason as in `/sales-taxes`.",
        "responses": {
          "200": {
            "description": "The purchase taxes of your country.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/perceptions": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the perception types of your account's country.",
        "description": "Perceptions <strong>are part of the document total</strong>, not an extra on top of it.\r\nTreating them as a separate add-on is the single most common way to end up reconciling a\r\nfigure that does not match ours.\r\n            \r\nEmpty outside the countries that use them, which is correct: where the figure does not\r\nexist, the field is not filled in.",
        "responses": {
          "200": {
            "description": "The perception types of your country.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ila-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the excise codes for alcoholic drinks in Chile (\"código ILA\").",
        "description": "Identified by <strong>code</strong>, not by a number: these are tax-authority codes sent as\r\ntext. The name includes the rate, which is how the application shows it and what lets you\r\npick the right one.\r\n            \r\nEmpty outside Chile. Inside Chile the set depends on what your account sells: an account\r\nset up as a distributor also gets spirits and wines.\r\n            \r\n`ilaCode` is currently accepted as free text and is <strong>not</strong> validated\r\nagainst this catalog. Read it as guidance, not as an enforced set.",
        "responses": {
          "200": {
            "description": "The excise codes, or an empty list outside Chile.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CodedCatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/keg-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the kinds of keg.",
        "description": "A system table; the display name follows the language of your token.",
        "responses": {
          "200": {
            "description": "The keg types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/keg-volumes": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CodedCatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tap-system-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the kinds of tap system.",
        "description": "A system table; the display name follows the language of your token.",
        "responses": {
          "200": {
            "description": "The tap system types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/reasons/keg-return": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/reasons/order-deletion": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/reasons/order-discount": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the reasons a line of an order can be given away.",
        "description": "The catalog is the same in every country; what changes is whether the field can be left\r\nout. In Mexico, Chile and Costa Rica it is required.",
        "responses": {
          "200": {
            "description": "The discount reasons.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/order-statuses": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the statuses an order can be in.",
        "description": "Pending, in process, ready to deliver, delivered. A system list; the display name follows\r\nthe language of your token. Being a quote, waiting for approval or being cancelled are not\r\nstatuses: an order carries them as isQuote, pendingApproval and active.",
        "responses": {
          "200": {
            "description": "The order statuses.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/stock-movement-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists what a stock movement does.",
        "description": "Goods in, goods out, a stock count, a write-off. A system table; the display name follows\r\nthe language of your token.",
        "responses": {
          "200": {
            "description": "The stock movement types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/warehouse-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the kinds of warehouse.",
        "description": "Cold room or plain warehouse. The distinction is not cosmetic: the kind decides where a\r\nwarehouse shows up in the application.",
        "responses": {
          "200": {
            "description": "The warehouse types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/waste-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the kinds of loss.",
        "description": "This is the field that says at which stage the volume was lost, and therefore which losses\r\ngo into the cost base of a costing.",
        "responses": {
          "200": {
            "description": "The waste types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tank-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the kinds of tank.",
        "description": "A system table; the display name follows the language of your token. The tanks themselves\r\nare listed by `GET /api/v1/tanks`.",
        "responses": {
          "200": {
            "description": "The tank types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wood-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the kinds of wood a barrel tank can be made of.",
        "description": "A system table; the display name follows the language of your token.",
        "responses": {
          "200": {
            "description": "The wood types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/banks": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the banks of your account's country.",
        "description": "Real bank names, so they are not translated. Filtered by country: a bank from another\r\ncountry would be an id your account cannot use.",
        "responses": {
          "200": {
            "description": "The banks of your country.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/bank-account-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the kinds of bank account.",
        "description": "Current account and savings account. The display name follows your token's language.",
        "responses": {
          "200": {
            "description": "The bank account types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/bank-payment-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the payment types a bank movement can be recorded with.",
        "description": "A <strong>subset</strong> of `/payment-types`, not the same set: not everything a\r\ncollection can be paid with can be recorded against a bank account. That is why they are\r\ntwo catalogs and not one.",
        "responses": {
          "200": {
            "description": "The bank payment types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/bank-movement-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists whether a bank movement is an income or an expense.",
        "responses": {
          "200": {
            "description": "The bank movement types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/check-statuses": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the statuses a cheque can be in.",
        "description": "In portfolio, handed over, cashed, deleted. \"Deleted\" is published even though it is a\r\nterminal state: a deleted cheque is still readable, and leaving it out would hand you an id\r\nyou could not resolve to a name.",
        "responses": {
          "200": {
            "description": "The cheque statuses.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/check-kinds": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists where a cheque comes from.",
        "description": "Your own or a third party's. A different field from the status, which is why it is a\r\nseparate catalog.",
        "responses": {
          "200": {
            "description": "The cheque kinds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/withholding-types": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Lists the withholding types of your account's country.",
        "description": "Named as the tax authority of that country names them, so they are not translated. Empty\r\noutside the countries that use withholdings, which is correct: where the figure does not\r\nexist, the field is not filled in.",
        "responses": {
          "200": {
            "description": "The withholding types of your country.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/roles": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/chart-of-accounts": {
      "get": {
        "tags": [
          "ChartOfAccounts"
        ],
        "summary": "Lists the entries of your chart of accounts.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over name. Optional — matches nothing on system-defined entries.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated entries. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of chart-of-accounts entries.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChartOfAccountDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Chart of Accounts module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "ChartOfAccounts"
        ],
        "summary": "Creates a chart-of-accounts entry.",
        "description": "name is required and must be unique among your account's entries, active or not — same\r\nrule the web application enforces. There is no way to assign supplies to this account\r\nthrough this endpoint; that stays a web-only operation.",
        "requestBody": {
          "description": "The entry to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ChartOfAccountDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChartOfAccountDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ChartOfAccountDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ChartOfAccountDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Chart-of-accounts entry created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChartOfAccountDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Chart of Accounts module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/chart-of-accounts/{accountId}": {
      "get": {
        "tags": [
          "ChartOfAccounts"
        ],
        "summary": "Gets a single chart-of-accounts entry by id, active or not.",
        "parameters": [
          {
            "name": "accountId",
            "in": "path",
            "description": "Chart-of-accounts entry id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The entry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChartOfAccountDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Chart of Accounts module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No entry with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "ChartOfAccounts"
        ],
        "summary": "Updates a chart-of-accounts entry. This is a PARTIAL update: fields not present in the\r\nbody keep their current value.",
        "description": "System-defined entries (the ones you did not create) cannot be edited through this\r\nendpoint — the web application itself has no such action either, this just answers 404\r\nfor their id, same as the web's own Edit screen would.",
        "parameters": [
          {
            "name": "accountId",
            "in": "path",
            "description": "Chart-of-accounts entry id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ChartOfAccountDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChartOfAccountDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ChartOfAccountDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ChartOfAccountDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Chart-of-accounts entry updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChartOfAccountDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Chart of Accounts module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No entry with that id in your account, or it is system-defined.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/chart-of-accounts/{accountId}/deactivate": {
      "post": {
        "tags": [
          "ChartOfAccounts"
        ],
        "summary": "Deactivates a chart-of-accounts entry. The record is never physically deleted: it stays\r\nreachable through GET /chart-of-accounts/{accountId}. Idempotent.",
        "description": "There is no check here for existing movements — the web application itself has none\r\neither. Replicated as-is, not a gap introduced by the API. Also deactivates any supply\r\nthat was posting its cost to this account, same cascade the web application performs.",
        "parameters": [
          {
            "name": "accountId",
            "in": "path",
            "description": "Chart-of-accounts entry id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Entry deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Chart of Accounts module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No entry with that id in your account, or it is system-defined.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/chart-of-accounts/{accountId}/activate": {
      "post": {
        "tags": [
          "ChartOfAccounts"
        ],
        "summary": "Reactivates a previously deactivated chart-of-accounts entry. Idempotent.",
        "parameters": [
          {
            "name": "accountId",
            "in": "path",
            "description": "Chart-of-accounts entry id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Entry reactivated, or already active."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Chart of Accounts module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No entry with that id in your account, or it is system-defined.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/checks": {
      "get": {
        "tags": [
          "Checks"
        ],
        "summary": "Lists the checks of your account.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "description": "Keep only checks with issue, due or collection date on or after this date, `YYYY-MM-DD`. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Keep only checks with issue, due or collection date on or before this date, `YYYY-MM-DD`. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "statusId",
            "in": "query",
            "description": "Filter by status. Allowed values: GET /api/v1/check-statuses. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of checks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "A date is not ISO 8601, or `from` is later than `to`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Checks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Checks"
        ],
        "summary": "Registers a cheque.",
        "description": "`number`, `amount`, `issuer`, `issueDate`, `dueDate`,\r\n             `bankId` and `kindId` are required.\r\n            \r\n             IMPORTANT: a cheque registered here is a RECORD, not money anywhere yet. In the web\r\n             application a cheque is always born as a side effect of a cash or bank movement, so it\r\n             arrives already tied to one; this endpoint is the one way to register a cheque that is not\r\n             tied to any. It will therefore not appear in any cash-register or bank-account report and\r\n             will not affect any balance. What turns it into money is\r\n             `POST /checks/{checkId}/collect`.\r\n            \r\n             It is created `statusId` = in portfolio, and `collectionDate` is always empty:\r\n             both are read-only and only `/collect` and `/deactivate` change them.",
        "requestBody": {
          "description": "The cheque to register. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CheckDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CheckDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Cheque registered.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Cheques module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/checks/{checkId}": {
      "get": {
        "tags": [
          "Checks"
        ],
        "summary": "Gets a single check by id, active or not.",
        "parameters": [
          {
            "name": "checkId",
            "in": "path",
            "description": "Check id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The check.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Checks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No check with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Checks"
        ],
        "summary": "Updates a check. This is a PARTIAL update: fields not present in the body keep their\r\ncurrent value.",
        "description": "statusId and collectionDate are read-only: they change only through /collect and\r\n/deactivate, never through this endpoint.",
        "parameters": [
          {
            "name": "checkId",
            "in": "path",
            "description": "Check id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CheckDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CheckDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Check updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Check Deposit/Withdrawal module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No check with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/checks/{checkId}/collect": {
      "post": {
        "tags": [
          "Checks"
        ],
        "summary": "Collects a cheque into a cash register or a bank account.",
        "description": "Writes ONE movement on the destination and marks the cheque as collected, in the same\r\ntransaction. It does not touch orders, purchases or their current accounts.\r\n            \r\nSend exactly one of `cashRegisterId` / `bankAccountId`. An own cheque\r\n(`kindId` = own) can only be collected into a bank account, and is recorded as an\r\nEXPENSE there — collecting your own cheque is money leaving, not arriving.\r\n            \r\nIf your account works with cash shifts, the destination cash register must have its shift\r\nopen (`POST /cash-registers/{id}/open`).",
        "parameters": [
          {
            "name": "checkId",
            "in": "path",
            "description": "Check id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Where and when the cheque is collected.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CheckCollectDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckCollectDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckCollectDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CheckCollectDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cheque collected.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckDto"
                }
              }
            }
          },
          "400": {
            "description": "Already collected, no or both destinations, own cheque to a cash register, closed shift, or a date earlier than the deposit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Cheques module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No check, cash register or bank account with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/checks/{checkId}/deactivate": {
      "post": {
        "tags": [
          "Checks"
        ],
        "summary": "Deactivates a check that was never collected or delivered through a cash/bank movement\r\n(a \"free\" check). The record is never physically deleted: it stays reachable through\r\nGET /checks/{checkId}, now with statusId pointing at \"Eliminado\".",
        "description": "Rejects a check linked to a cash or bank-account movement (issued via, or already\r\ncollected/delivered through, one) — same guard as the web application's own delete\r\naction. Deactivating one of those requires reversing that movement first, from\r\ncash-registers/bank-accounts (not published yet), not from this endpoint.",
        "parameters": [
          {
            "name": "checkId",
            "in": "path",
            "description": "Check id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Check deactivated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckDto"
                }
              }
            }
          },
          "400": {
            "description": "The check is linked to a movement, already inactive, or belongs to another user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Check Deletion module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No check with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/collections": {
      "get": {
        "tags": [
          "Collections"
        ],
        "summary": "Lists collections, most recent first.",
        "description": "Collections pending approval ARE listed. The web application's own listing cannot show\r\nthem (it joins the receipt, which a pending collection does not have yet) and uses a\r\nseparate screen; hiding them here would mean an integrator records a collection, gets a\r\n200, and then cannot find it.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "description": "Start of the date range, ISO 8601. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "End of the date range, ISO 8601. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "description": "Only collections from this customer. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "approved",
            "in": "query",
            "description": "Filter by approval state. Omit to get both.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of collections.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "A date is not ISO 8601, or `from` is later than `to`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Collections module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Collections"
        ],
        "summary": "Records money received from a customer, into one or more destinations at once.",
        "description": "One call issues one receipt, pays into every destination listed in `payments`, creates\r\nany cheques that come with a number, and credits the customer's current account once.\r\n            \r\nWHAT THIS ENDPOINT NEVER DOES, whatever you send: it does not settle orders (that is out of\r\nthis version — the customer's current account is credited, which orders that pays is not\r\ndecided here), it does not emit an electronic receipt, and it takes no withholdings and no\r\ncredit notes.\r\n            \r\nIt is all-or-nothing: if any payment is rejected — a closed cash register, a cheque without\r\nits bank, not enough of anything — nothing at all is written, not even the receipt.",
        "requestBody": {
          "description": "The collection to record.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionCreateDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionCreateDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionCreateDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionCreateDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Collection recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Collections module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/collections/{collectionId}": {
      "get": {
        "tags": [
          "Collections"
        ],
        "summary": "Gets a single collection with the movements it produced.",
        "parameters": [
          {
            "name": "collectionId",
            "in": "path",
            "description": "Collection id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The collection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Collections module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No collection with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/costings": {
      "get": {
        "tags": [
          "Costings"
        ],
        "summary": "Lists the costings of your account, most recent first.",
        "description": "The listing omits detailLines — one extra query per row. Read GET /costings/{costingId}\r\nfor the detail lines of a specific costing.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Matches the name. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated costings. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of costings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostingDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Costings module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Costings"
        ],
        "summary": "Creates a costing.",
        "description": "Exactly one of batchId/recipeId is required. detailLines is required and must have at\r\nleast one entry — a fixed or a variable cost. productId is resolved server-side from the\r\nbatch or the recipe, never from the body.",
        "requestBody": {
          "description": "The costing to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CostingDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CostingDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CostingDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CostingDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Costing created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostingDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Costings module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/costings/{costingId}": {
      "get": {
        "tags": [
          "Costings"
        ],
        "summary": "Gets a single costing by id, active or not, with its detail lines.",
        "parameters": [
          {
            "name": "costingId",
            "in": "path",
            "description": "Costing id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The costing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostingDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Costings module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No costing with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Costings"
        ],
        "summary": "Partially updates a costing: only the fields you send change.",
        "description": "detailLines absent leaves the existing lines untouched; present (even an empty array)\r\nreplaces every line — but an empty replacement is rejected, same rule as create: a\r\ncosting always needs at least one line. productId, active are read-only and ignored.",
        "parameters": [
          {
            "name": "costingId",
            "in": "path",
            "description": "Costing id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CostingDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CostingDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CostingDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CostingDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated costing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostingDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Costings module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No costing with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/costings/{costingId}/deactivate": {
      "post": {
        "tags": [
          "Costings"
        ],
        "summary": "Deactivates a costing. The record is never physically deleted: it keeps its history and\r\nstays reachable through GET /costings/{costingId}. Idempotent.",
        "parameters": [
          {
            "name": "costingId",
            "in": "path",
            "description": "Costing id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Costing deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Costings module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No costing with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/costings/{costingId}/activate": {
      "post": {
        "tags": [
          "Costings"
        ],
        "summary": "Reactivates a previously deactivated costing. Idempotent.",
        "parameters": [
          {
            "name": "costingId",
            "in": "path",
            "description": "Costing id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Costing reactivated, or already active."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Costings module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No costing with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/costings/{costingId}/history": {
      "get": {
        "tags": [
          "Costings"
        ],
        "summary": "Gets a costing's edit history, most recent first.",
        "parameters": [
          {
            "name": "costingId",
            "in": "path",
            "description": "Costing id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The history entries.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CostingHistoryEntryDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Costings module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No costing with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/costings/{costingId}/restore": {
      "post": {
        "tags": [
          "Costings"
        ],
        "summary": "Restores a costing to a previous version from its history.",
        "description": "Restoring reactivates the costing if it was inactive, same as the web screen. The\r\nrestoration itself is recorded as one more history entry, so it can be undone too.",
        "parameters": [
          {
            "name": "costingId",
            "in": "path",
            "description": "Costing id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The history entry to restore from.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CostingRestoreRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CostingRestoreRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CostingRestoreRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CostingRestoreRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The restored costing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostingDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing body, or the history entry has no data to restore from.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Costings module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No costing with that id in your account, or no history entry with that id for it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/costings/{costingId}/recalculate": {
      "post": {
        "tags": [
          "Costings"
        ],
        "summary": "Recalculates a costing from the batch's current state: canonical liter base, per-litre\r\ncost, per-container breakdown, and the same propagation to the product a plain save does.",
        "description": "Only costings on a finished batch can be recalculated — not on a recipe, not on a batch still in progress.",
        "parameters": [
          {
            "name": "costingId",
            "in": "path",
            "description": "Costing id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The recalculated costing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostingRecalculationResultDto"
                }
              }
            }
          },
          "400": {
            "description": "The costing is inactive, on a recipe, or its batch isn't finished yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Costings module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No costing with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/costings/recalculate-count": {
      "get": {
        "tags": [
          "Costings"
        ],
        "summary": "Impact of recalculating every eligible costing from a date on, before confirming.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "description": "ISO 8601 date. Required.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The impact count.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostingRecalculationImpactDto"
                }
              }
            }
          },
          "400": {
            "description": "`from` is missing or not ISO 8601.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Costings module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/costings/recalculate": {
      "post": {
        "tags": [
          "Costings"
        ],
        "summary": "Recalculates every eligible costing from a date on. Always processed oldest first — a\r\nbatch ending on an older costing would leave the product's own cost stale.",
        "description": "Rejects the whole batch above the limit reported by GET /costings/recalculate-count — call that first.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "description": "ISO 8601 date. Required.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The recalculation summary.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostingBulkRecalculationResultDto"
                }
              }
            }
          },
          "400": {
            "description": "`from` missing/invalid, or too many costings to recalculate in one batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Costings module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customer-categories": {
      "get": {
        "tags": [
          "CustomerCategories"
        ],
        "summary": "Lists the customer categories of your account, including the system-defined ones.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over name. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated customer categories. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of customer categories.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerCategoryDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "CustomerCategories"
        ],
        "summary": "Creates a customer category.",
        "description": "name is required and must be unique among your account's customer categories, active or\r\nnot — same rule the web application's create form intends to enforce (now reinforced\r\nserver-side). There is no way to create a system-defined category through this endpoint;\r\nevery category created here belongs to your account.",
        "requestBody": {
          "description": "The customer category to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerCategoryDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerCategoryDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerCategoryDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerCategoryDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Customer category created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerCategoryDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customer-categories/{customerCategoryId}": {
      "get": {
        "tags": [
          "CustomerCategories"
        ],
        "summary": "Gets a single customer category by id, active or not, system-defined or not.",
        "parameters": [
          {
            "name": "customerCategoryId",
            "in": "path",
            "description": "Customer category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The customer category.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerCategoryDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer category with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "CustomerCategories"
        ],
        "summary": "Updates a customer category. This is a PARTIAL update: fields not present in the body\r\nkeep their current value.",
        "description": "System-defined categories cannot be edited through this endpoint — the web application\r\nitself has no such guard either today, this endpoint is the first to enforce it, same\r\ncriterion already applied to customer-types. The same 404 applies to a deactivated\r\ncategory: reactivate it first.",
        "parameters": [
          {
            "name": "customerCategoryId",
            "in": "path",
            "description": "Customer category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerCategoryDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerCategoryDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerCategoryDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerCategoryDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Customer category updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerCategoryDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer category with that id in your account, it is system-defined, or it is deactivated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customer-categories/{customerCategoryId}/deactivate": {
      "post": {
        "tags": [
          "CustomerCategories"
        ],
        "summary": "Deactivates a customer category. The record is never physically deleted: it stays\r\nreachable through GET /customer-categories/{customerCategoryId}. Idempotent.",
        "description": "Blocked (400) only for a system-defined category. No check is made for customers\r\ncurrently holding this category — same as the web application, which allows it too\r\n(same criterion already applied to product-categories/supplier-categories).",
        "parameters": [
          {
            "name": "customerCategoryId",
            "in": "path",
            "description": "Customer category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer category deactivated, or already inactive."
          },
          "400": {
            "description": "System-defined category. Read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer category with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customer-categories/{customerCategoryId}/activate": {
      "post": {
        "tags": [
          "CustomerCategories"
        ],
        "summary": "Reactivates a previously deactivated customer category. Idempotent.",
        "parameters": [
          {
            "name": "customerCategoryId",
            "in": "path",
            "description": "Customer category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer category reactivated, or already active."
          },
          "400": {
            "description": "A business rule prevents reactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer category with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customers": {
      "get": {
        "tags": [
          "Customers"
        ],
        "summary": "Lists the active customers of your account.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over trade name, legal name or tax id. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated customers. Defaults to false. Deactivated customers keep their history\r\nand their ids, so pass true when you are reconciling a full catalogue and need to tell\r\n\"deleted on our side\" apart from \"never existed\".",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of customers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or concurrency limit exceeded — see Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Customers"
        ],
        "summary": "Creates a customer.",
        "description": "The same business rules the web application enforces apply here: tradeName is required and\r\nmust not match another active customer, and in Chile the taxId must not contain spaces.\r\nA customer created without parentCustomerId gets its own current account.",
        "requestBody": {
          "description": "The customer to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Customer created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customers/{customerId}": {
      "get": {
        "tags": [
          "Customers"
        ],
        "summary": "Gets a single customer by id, active or not.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The customer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Customers"
        ],
        "summary": "Updates a customer. This is a PARTIAL update: fields not present in the body keep their\r\ncurrent value, so you never need to send the whole object to change a single field.",
        "description": "Sending a field with an explicit null clears it; leaving it out keeps it. The operation is\r\nidempotent: repeating the same request leaves the customer in the same state.\r\n            \r\nThe merged record is validated with the same business rules the application enforces. A\r\nrecord that already violated a rule before this call is rejected too, even if the field you\r\nare changing is unrelated — it has to be corrected in the application first.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Customer updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customers/{customerId}/deactivate": {
      "post": {
        "tags": [
          "Customers"
        ],
        "summary": "Deactivates a customer. The record is never physically deleted: it keeps its history and\r\nstays reachable through GET /customers/{customerId}. Idempotent.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer deactivated, or already inactive."
          },
          "400": {
            "description": "A business rule prevents deactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customers/{customerId}/points-of-sale": {
      "get": {
        "tags": [
          "Customers"
        ],
        "summary": "Lists the active points of sale of a customer.",
        "description": "Deactivated points of sale are not listed.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The points of sale. An empty array if the customer has none.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PointOfSaleDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Customers"
        ],
        "summary": "Adds a point of sale to a customer.",
        "description": "Each call creates ONE point of sale and leaves the existing ones untouched. There is no\r\nendpoint that replaces the whole collection, on purpose: it would make \"add one\" and\r\n\"delete every other one\" the same request.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The point of sale to create. name is required.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/PointOfSaleDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PointOfSaleDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PointOfSaleDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PointOfSaleDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Point of sale created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PointOfSaleDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, missing name, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customers/{customerId}/points-of-sale/{pointOfSaleId}": {
      "put": {
        "tags": [
          "Customers"
        ],
        "summary": "Updates a point of sale. Partial: fields not present keep their current value.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pointOfSaleId",
            "in": "path",
            "description": "Point of sale id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/PointOfSaleDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PointOfSaleDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PointOfSaleDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PointOfSaleDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Point of sale updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PointOfSaleDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer, or no point of sale of that customer, with that id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customers/{customerId}/points-of-sale/{pointOfSaleId}/deactivate": {
      "post": {
        "tags": [
          "Customers"
        ],
        "summary": "Deactivates a point of sale. Idempotent.",
        "description": "The record is never physically deleted: orders and deliveries point at it, and removing it\r\nwould leave them dangling. It stops being listed and can no longer be selected.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pointOfSaleId",
            "in": "path",
            "description": "Point of sale id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer, or no point of sale of that customer, with that id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customers/{customerId}/contacts": {
      "get": {
        "tags": [
          "Customers"
        ],
        "summary": "Lists the active contact people of a customer.",
        "description": "Deactivated contacts are not listed.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The contacts. An empty array if the customer has none.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ContactDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Customers"
        ],
        "summary": "Adds a contact person to a customer.",
        "description": "Each call creates ONE contact and leaves the existing ones untouched.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The contact to create. name is required.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ContactDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ContactDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Contact created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or missing name.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customers/{customerId}/contacts/{contactId}": {
      "put": {
        "tags": [
          "Customers"
        ],
        "summary": "Updates a contact person. Partial: fields not present keep their current value.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "contactId",
            "in": "path",
            "description": "Contact id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ContactDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ContactDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer, or no contact of that customer, with that id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customers/{customerId}/contacts/{contactId}/deactivate": {
      "post": {
        "tags": [
          "Customers"
        ],
        "summary": "Deactivates a contact person. Idempotent.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "contactId",
            "in": "path",
            "description": "Contact id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer, or no contact of that customer, with that id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customers/{customerId}/balance": {
      "get": {
        "tags": [
          "Customers"
        ],
        "summary": "Gets the current-account balance of a customer.",
        "description": "A dedicated endpoint rather than a field of the customer, because the balance is computed\r\nover the current-account ledger rather than stored.\r\n            \r\nIf the customer belongs to a group and does not keep its own current account, the balance\r\nreturned is the group parent's — accountCustomerId tells you whose it is.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The balance.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerBalanceDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Current Account module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customers/{customerId}/ledger": {
      "get": {
        "tags": [
          "Customers"
        ],
        "summary": "Lists the movements of a customer's current account, newest first.",
        "description": "Read-only. Movements are generated by the system: an order adds to what the customer owes,\r\na payment reduces it. Reconciling a movement is a treasury operation that touches several\r\nentities at once, and has its own resource, which this version does not publish.\r\n            \r\nIf the customer belongs to a group and does not keep its own current account, this lists\r\nthe group parent's movements — same account /balance resolves to.\r\n            \r\nThe balance is cumulative and depends on the order of the movements, so each entry reports\r\nthe balance it left behind. For the current balance alone, read\r\nGET /api/v1/customers/{customerId}/balance, which is one call instead of paging to the end.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Keep only movements on or after this date, `YYYY-MM-DD`. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Keep only movements on or before this date, `YYYY-MM-DD`. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "unreconciledOnly",
            "in": "query",
            "description": "True keeps only movements not yet reconciled. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of movements.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerLedgerEntryDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "A date is not ISO 8601, or `from` is later than `to`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Current Account module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customers/{customerId}/activate": {
      "post": {
        "tags": [
          "Customers"
        ],
        "summary": "Reactivates a previously deactivated customer. Idempotent.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer reactivated, or already active."
          },
          "400": {
            "description": "A business rule prevents reactivation, e.g. another active customer has the same name.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customers/{customerId}/categories": {
      "get": {
        "tags": [
          "Customers"
        ],
        "summary": "Lists the categories assigned to a customer.",
        "description": "A customer can hold several categories at once, which is why this is a sub-resource and\r\nnot a field. The full set to choose from is GET /api/v1/customer-categories. Assigning\r\nand removing one is POST .../categories and POST .../categories/{categoryId}/deactivate,\r\nbelow — one endpoint per item, same criterion as points of sale and contacts.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The categories. An empty array if the customer has none.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Customers"
        ],
        "summary": "Assigns a category to a customer. Idempotent if already assigned.",
        "description": "Adds one category without touching any other the customer already has — unlike\r\nCategoriaClienteService.SyncCategoriasCliente (used by the web application's customer\r\nform), which replaces the customer's entire category set and would race with a\r\nconcurrent write. Same \"one endpoint per item\" criterion already used for points of sale\r\nand contacts (API-REST-JWT.md, desviación #20). A system-defined category can be\r\nassigned like any other — the restriction on system-defined categories is only about\r\nediting/deactivating the category itself (see /api/v1/customer-categories), not about\r\nusing it.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The category to assign.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/AssignCustomerCategoryRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssignCustomerCategoryRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AssignCustomerCategoryRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AssignCustomerCategoryRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Category assigned, or already assigned."
          },
          "400": {
            "description": "Invalid body, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customers/{customerId}/categories/{categoryId}/deactivate": {
      "post": {
        "tags": [
          "Customers"
        ],
        "summary": "Removes a category from a customer. Idempotent.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "description": "Customer id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "categoryId",
            "in": "path",
            "description": "Category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Category removed, or already not assigned."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Customer module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customer-types": {
      "get": {
        "tags": [
          "CustomerTypes"
        ],
        "summary": "Lists the customer types of your account, including the system-defined ones.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over name. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated customer types. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of customer types.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerTypeDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "CustomerTypes"
        ],
        "summary": "Creates a customer type.",
        "description": "name is required and must be unique among your account's customer types, active or not\r\n— same rule the web application enforces. There is no way to create a system-defined\r\ntype through this endpoint; every type created here belongs to your account.",
        "requestBody": {
          "description": "The customer type to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerTypeDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerTypeDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerTypeDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerTypeDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Customer type created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerTypeDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customer-types/{customerTypeId}": {
      "get": {
        "tags": [
          "CustomerTypes"
        ],
        "summary": "Gets a single customer type by id, active or not, system-defined or not.",
        "parameters": [
          {
            "name": "customerTypeId",
            "in": "path",
            "description": "Customer type id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The customer type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerTypeDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer type with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "CustomerTypes"
        ],
        "summary": "Updates a customer type. This is a PARTIAL update: fields not present in the body keep\r\ntheir current value.",
        "description": "System-defined types cannot be edited through this endpoint — the web application itself\r\nhas no such action either, this just answers 404 for their id, same as the web's own\r\nedit screen would. The same applies to a deactivated type: reactivate it first.",
        "parameters": [
          {
            "name": "customerTypeId",
            "in": "path",
            "description": "Customer type id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerTypeDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerTypeDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerTypeDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerTypeDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Customer type updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerTypeDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer type with that id in your account, it is system-defined, or it is deactivated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customer-types/{customerTypeId}/deactivate": {
      "post": {
        "tags": [
          "CustomerTypes"
        ],
        "summary": "Deactivates a customer type. The record is never physically deleted: it stays reachable\r\nthrough GET /customer-types/{customerTypeId}. Idempotent.",
        "description": "Blocked (400) for a system-defined type, and for one currently used by an active\r\ncustomer — both are real rules the web application already enforces, migrated as-is.",
        "parameters": [
          {
            "name": "customerTypeId",
            "in": "path",
            "description": "Customer type id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer type deactivated, or already inactive."
          },
          "400": {
            "description": "System-defined type, or used by an active customer. Read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer type with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/customer-types/{customerTypeId}/activate": {
      "post": {
        "tags": [
          "CustomerTypes"
        ],
        "summary": "Reactivates a previously deactivated customer type. Idempotent.",
        "parameters": [
          {
            "name": "customerTypeId",
            "in": "path",
            "description": "Customer type id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer type reactivated, or already active."
          },
          "400": {
            "description": "A business rule prevents reactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No customer type with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/debtors": {
      "get": {
        "tags": [
          "Debtors"
        ],
        "summary": "Lists the customers of your account that owe money, largest debt first.",
        "description": "<b>Every page costs the whole computation.</b> Paging bounds the response, not the work:\r\n            the underlying query walks every active customer of the account. That is why the rate-limit\r\n            cost is 40. Fetch it and cache it rather than polling page by page.",
        "parameters": [
          {
            "name": "asOf",
            "in": "query",
            "description": "Balances as of this date (ISO 8601, `yyyy-MM-dd`). Defaults to now.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customerTypeId",
            "in": "query",
            "description": "Only customers of this type. See GET /api/v1/customer-types.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeZeroBalance",
            "in": "query",
            "description": "Include customers whose balance is zero or negative. Default `false`.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Rows per page, up to 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of debtors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DebtorDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "`asOf` is not a valid ISO 8601 date.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Customer Reports module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/delivery-notes": {
      "get": {
        "tags": [
          "DeliveryNotes"
        ],
        "summary": "Lists delivery notes, most recent first.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "description": "Start of the date range, ISO 8601. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "End of the date range, ISO 8601. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "description": "Only notes delivered to this customer. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "supplierId",
            "in": "query",
            "description": "Only notes delivered to this supplier. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of delivery notes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryNoteDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "A date is not ISO 8601, or `from` is later than `to`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the View Delivery Notes module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/delivery-notes/{deliveryNoteId}": {
      "get": {
        "tags": [
          "DeliveryNotes"
        ],
        "summary": "Gets a single delivery note with its items.",
        "parameters": [
          {
            "name": "deliveryNoteId",
            "in": "path",
            "description": "Delivery note id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The delivery note.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryNoteDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the View Delivery Notes module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No delivery note with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/distributor-purchases": {
      "get": {
        "tags": [
          "DistributorPurchases"
        ],
        "summary": "Lists your distributor purchases, most recent first.",
        "parameters": [
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include cancelled purchases. Defaults to false.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of purchases.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DistributorPurchaseDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Distributor purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "DistributorPurchases"
        ],
        "summary": "Records a purchase of kegs, containers, cases or mix packs from a supplier.",
        "description": "This moves stock. In one transaction it records the purchase and its lines, brings the\r\ngoods into `warehouseId`, posts the total to the supplier's current account and, if\r\nyou sent a `kegPurchaseOrderId`, advances that order for every line that carries a\r\n`kegPurchaseOrderLineId`. If the purchase has a `dueDate`, a payment reminder\r\nis added to your calendar.\r\n            \r\nEach line's `kind` says what it is. A `keg` line is <b>one physical keg</b>:\r\nit needs its own `code` and `supplierCode`, both unique within the request, and\r\nyou send one line per keg instead of one line with a quantity. A `container` line\r\nneeds a `containerId`, a `case` line a `caseId`, and a `mixPack` line\r\nneither.\r\n            \r\nA keg is rejected when it is already registered to a different supplier, when it is\r\ncurrently at a customer — return it first — or when it is already in stock with a\r\nproduct. The web application checks these while you type; here they run inside this\r\ncall, so a purchase is either recorded whole or not at all.\r\n            \r\nRead-only on the way in: `supplierName`, `productName`, `containerName`,\r\n`caseName`, `kegPurchaseOrderNumber`, `kegId`, `paid` and\r\n`active` are ignored. Applying already-scheduled calendar events to the purchase,\r\nwhich the web screen offers, is not published.",
        "requestBody": {
          "description": "The purchase and its lines.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/DistributorPurchaseDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DistributorPurchaseDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/DistributorPurchaseDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/DistributorPurchaseDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The purchase was recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DistributorPurchaseDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing body, a business rule was violated, or a reference does not exist in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Distributor purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/distributor-purchases/{purchaseId}": {
      "get": {
        "tags": [
          "DistributorPurchases"
        ],
        "summary": "Gets a single distributor purchase by id, with its lines.",
        "description": "A cancelled purchase is still readable; its `active` is false.",
        "parameters": [
          {
            "name": "purchaseId",
            "in": "path",
            "description": "Purchase id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The purchase.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DistributorPurchaseDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Distributor purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No purchase with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/distributor-purchases/{purchaseId}/cancel": {
      "post": {
        "tags": [
          "DistributorPurchases"
        ],
        "summary": "Voids a purchase, reversing the stock and current-account movements it created. The\r\nrecord is never physically deleted: it keeps its history and stays reachable through\r\nGET /distributor-purchases/{purchaseId}. Idempotent.",
        "description": "A purchase cannot be voided while one of its kegs is at a customer — return it first —\r\nnor when the container, case or mix pack stock it created has already been used. The\r\nresponse names the keg or the stock so you know what to do.\r\n            \r\nIf the purchase fulfilled a keg purchase order, voiding it gives the delivered\r\nquantities back to that order and reopens it.",
        "parameters": [
          {
            "name": "purchaseId",
            "in": "path",
            "description": "Purchase id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Purchase voided, or already voided."
          },
          "400": {
            "description": "A business rule prevents voiding. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Distributor purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No purchase with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/distributor-services": {
      "get": {
        "tags": [
          "DistributorServices"
        ],
        "summary": "Lists the distributor services of your account, by name.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of services.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DistributorServiceDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Distributor module or the Duenio role.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "DistributorServices"
        ],
        "summary": "Creates a distributor service with its tiers.",
        "requestBody": {
          "description": "The service. `name` is required and unique within your account.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/DistributorServiceDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DistributorServiceDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/DistributorServiceDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/DistributorServiceDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The service was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DistributorServiceDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing body, missing name, or a service with that name already exists.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Distributor module or the Duenio role.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/distributor-services/{serviceId}": {
      "get": {
        "tags": [
          "DistributorServices"
        ],
        "summary": "Gets a single distributor service by id, with its tiers.",
        "parameters": [
          {
            "name": "serviceId",
            "in": "path",
            "description": "Service id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The service.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DistributorServiceDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Distributor module or the Duenio role.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No service with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "DistributorServices"
        ],
        "summary": "Updates a distributor service. This is a PARTIAL update.",
        "description": "`levels` absent leaves the tiers untouched; present replaces the whole collection —\r\n            an entry with an `id` is updated, one without is created, and one you leave out is\r\n            deactivated. That is the same rule the web screen applies when you save.",
        "parameters": [
          {
            "name": "serviceId",
            "in": "path",
            "description": "Service id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only what you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/DistributorServiceDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DistributorServiceDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/DistributorServiceDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/DistributorServiceDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated service.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DistributorServiceDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing body, empty name, or another service already has that name.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Distributor module or the Duenio role.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No service with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/distributor-services/assignments/{supplierId}": {
      "get": {
        "tags": [
          "DistributorServices"
        ],
        "summary": "Lists which services this supplier's customers receive.",
        "parameters": [
          {
            "name": "supplierId",
            "in": "path",
            "description": "Supplier id. See `/suppliers`.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The supplier's assignments. An empty array means it has none.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DistributorServiceAssignmentDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Distributor module or the Duenio role.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supplier with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "DistributorServices"
        ],
        "summary": "Replaces the whole set of assignments of one supplier.",
        "description": "The collection is replaced whole: anything you leave out is deactivated, and an empty\r\narray clears them all. Send the entries you want to keep, with their `id`.\r\n            \r\nAn entry <b>with</b> an `id` is kept exactly as it is — its customer and service are\r\nnot updated. To change an assignment, leave the old one out and send a new entry without\r\nan `id`. That is how the web screen works, and this API does not paper over it: an\r\nupdate that silently did nothing would be worse than a rule you can read.",
        "parameters": [
          {
            "name": "supplierId",
            "in": "path",
            "description": "Supplier id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Every assignment the supplier should end up with.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/DistributorServiceAssignmentsDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DistributorServiceAssignmentsDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/DistributorServiceAssignmentsDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/DistributorServiceAssignmentsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The supplier's assignments after the change.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DistributorServiceAssignmentDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing body, or a reference that does not exist in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Distributor module or the Duenio role.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supplier with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/distributor-services/settlements": {
      "get": {
        "tags": [
          "DistributorServices"
        ],
        "summary": "Lists the settlement runs of your account, most recent first.",
        "description": "A run settles every supplier at once, so each entry here is the total of all of them, and\r\nits `date` is what identifies it. Ask for that date to see the breakdown.\r\n            \r\nRead-only: running a settlement, and undoing one, are not published.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of settlement runs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DistributorServiceSettlementDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Distributor module or the Duenio role.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/distributor-services/settlements/{date}": {
      "get": {
        "tags": [
          "DistributorServices"
        ],
        "summary": "Breaks one settlement run down supplier by supplier.",
        "description": "`description` is human-readable text written when the run happened, in the language\r\n            of whoever ran it. Do not parse it.",
        "parameters": [
          {
            "name": "date",
            "in": "path",
            "description": "The run's date, `yyyy-MM-dd`, as listed by `GET /distributor-services/settlements`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "What each supplier was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DistributorServiceSettlementSupplierDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "`date` is not a valid date.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Distributor module or the Duenio role.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No settlement run on that date in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/event-categories": {
      "get": {
        "tags": [
          "EventCategories"
        ],
        "summary": "Lists the calendar event categories of your account, including the global ones.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over name. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated categories. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of event categories.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventCategoryDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the EventoAgenda module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "EventCategories"
        ],
        "summary": "Creates an event category.",
        "description": "name is required and must be unique among your account's categories (including the\r\nglobal ones), active or not. There is no way to create a global category through this\r\nendpoint — every category created here belongs to your account.",
        "requestBody": {
          "description": "The category to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/EventCategoryDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventCategoryDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/EventCategoryDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/EventCategoryDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Event category created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventCategoryDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the CrearEditarCategoriaEvento module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/event-categories/{eventCategoryId}": {
      "get": {
        "tags": [
          "EventCategories"
        ],
        "summary": "Gets a single event category by id, active or not, global or not.",
        "parameters": [
          {
            "name": "eventCategoryId",
            "in": "path",
            "description": "Event category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The event category.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventCategoryDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the EventoAgenda module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No event category with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "EventCategories"
        ],
        "summary": "Updates an event category. This is a PARTIAL update: fields not present in the body\r\nkeep their current value.",
        "description": "A global category cannot be edited through this endpoint. The same 404 applies to a\r\ndeactivated category: reactivate it first.",
        "parameters": [
          {
            "name": "eventCategoryId",
            "in": "path",
            "description": "Event category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/EventCategoryDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventCategoryDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/EventCategoryDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/EventCategoryDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event category updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventCategoryDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the CrearEditarCategoriaEvento module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No event category with that id in your account, it is global, or it is deactivated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/event-categories/{eventCategoryId}/deactivate": {
      "post": {
        "tags": [
          "EventCategories"
        ],
        "summary": "Deactivates an event category. The record is never physically deleted: it stays\r\nreachable through GET /event-categories/{eventCategoryId}. Idempotent.",
        "description": "Blocked (400) for a global category, or one with at least one calendar event currently\r\nusing it (`hasAssociatedEvents`) — the web application already computes this same\r\nflag to disable its own Delete button; this endpoint is the first to enforce it\r\nserver-side.",
        "parameters": [
          {
            "name": "eventCategoryId",
            "in": "path",
            "description": "Event category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Event category deactivated, or already inactive."
          },
          "400": {
            "description": "Global category, or a category with associated events. Read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the EliminarCategoriaEvento module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No event category with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/event-categories/{eventCategoryId}/activate": {
      "post": {
        "tags": [
          "EventCategories"
        ],
        "summary": "Reactivates a previously deactivated event category. Idempotent.",
        "parameters": [
          {
            "name": "eventCategoryId",
            "in": "path",
            "description": "Event category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Event category reactivated, or already active."
          },
          "400": {
            "description": "A business rule prevents reactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the CrearEditarCategoriaEvento module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No event category with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/external-user-products": {
      "get": {
        "tags": [
          "ExternalUserProducts"
        ],
        "summary": "Lists your products and how each one is published to the customer portal.",
        "parameters": [
          {
            "name": "onlyEnabled",
            "in": "query",
            "description": "Only products published to the portal. Defaults to false (all of them).",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of products with their presentations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalUserProductDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products or Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Portal product assignment is not enabled for your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/external-user-products/{productId}": {
      "get": {
        "tags": [
          "ExternalUserProducts"
        ],
        "summary": "Gets one product's portal configuration by product id.",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "description": "Product id. Listed by `GET /api/v1/products`.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The product's portal configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalUserProductDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products or Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No such product in your account, it cannot be published to the portal, or portal product assignment is not enabled for your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "ExternalUserProducts"
        ],
        "summary": "Publishes or unpublishes a whole product in the customer portal. This is a PARTIAL\r\nupdate: a flag not present in the body keeps its current value.",
        "description": "<b>This cascades to every presentation of the product</b>, exactly like the header\r\n             checkbox of the web screen: publishing creates or updates the rows for every keg volume,\r\n             container and case the product is sold in, and unpublishing clears all of them. To\r\n             change one presentation on its own, use the presentations endpoint instead.\r\n            \r\n             `enabled` and `enabledForCategoryList` are independent: the first publishes\r\n             the product under price lists 1 and 2, the second under price list 3, which only applies\r\n             to customers in the category configured for your account. Everything else in the body\r\n             (`name`, `style`, `isMixPack`, `isComplementary`,\r\n             `presentations`) is read-only here and ignored.",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "description": "Product id. Listed by `GET /api/v1/products`.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the flags you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalUserProductDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalUserProductDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalUserProductDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalUserProductDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated portal configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalUserProductDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing body, or your account has no price list configured for the portal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products or Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No such product in your account, it cannot be published to the portal, or portal product assignment is not enabled for your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/external-user-products/{productId}/presentations": {
      "put": {
        "tags": [
          "ExternalUserProducts"
        ],
        "summary": "Publishes, unpublishes or sets the minimum purchase quantity of individual presentations\r\nof a product, without touching the rest of them.",
        "description": "Send only the presentations you want to change: the ones you leave out keep their\r\nvalues. This is the one collection in this API that is <b>not</b> replaced whole, and\r\nthe reason is that you cannot create or delete a presentation here — the set is fixed by\r\nthe product itself (its keg volumes, its containers, its cases), so \"leave it out\" and\r\n\"delete it\" could never be the same request.\r\n            \r\nIdentify each entry by exactly one of `litres`, `containerId` or\r\n`caseId`. The valid values are the product's own: its containers and cases as\r\n`GET /api/v1/products/{productId}` lists them, and the keg volumes of\r\n`GET /api/v1/keg-volumes`.\r\n            \r\nAn entry with none of the three is the product-level presentation. There you may only\r\nset `minimumPurchaseQuantity`: publishing it is what\r\n`PUT /external-user-products/{productId}` does, because in the web application that\r\nswitch always cascades to every presentation.\r\n            \r\n`minimumPurchaseQuantity` is an absolute value; send `0` or `null` to\r\nclear it.",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "description": "Product id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only a `presentations` array with the entries you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalUserProductDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalUserProductDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalUserProductDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalUserProductDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated portal configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalUserProductDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing body, an entry that does not identify a presentation of this product, a negative minimum, or your account has no price list configured for the portal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products or Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No such product in your account, it cannot be published to the portal, or portal product assignment is not enabled for your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/external-user-products/history": {
      "get": {
        "tags": [
          "ExternalUserProducts"
        ],
        "summary": "Lists the changes made to your products' portal assignment — who published or unpublished what, and when.",
        "description": "`previousValue` and `newValue` are human-readable text, in the language of\r\n             whoever made the change — they are what the web screen shows, stored as text when the\r\n             change happened. Do not parse them: read the current state from the resource itself.\r\n            \r\n             Minimum purchase quantities and stock checks are not logged here; neither are they in\r\n             the web application. This log records publishing and unpublishing.",
        "parameters": [
          {
            "name": "productId",
            "in": "query",
            "description": "Only changes to this product.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "userId",
            "in": "query",
            "description": "Only changes made by this user. Listed by `GET /api/v1/users`.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of history entries.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalUserProductHistoryEntryDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products or Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Portal product assignment is not enabled for your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/external-user-products/{productId}/stock": {
      "post": {
        "tags": [
          "ExternalUserProducts"
        ],
        "summary": "Sets the stock available to portal customers for individual presentations of a product.",
        "description": "`portalStock` is an <b>absolute value</b>, not a delta: it records a stock check,\r\n             exactly like the web screen does, so sending the same value twice leaves the same stock.\r\n             Every entry must carry one, and entries identify their presentation the same way as in\r\n             the presentations endpoint.\r\n            \r\n             Only stock checks are published. The increases and decreases that portal orders produce\r\n             are written by the ordering flow itself, which this API does not expose.\r\n            \r\n             Read the current values from `portalStock` in any `GET` of this resource —\r\n             there is no separate endpoint for it. A `null` there means the stock has never been\r\n             set, which is not the same as having been set to zero.\r\n            \r\n             This needs portal stock enabled for your account, on top of portal product assignment.\r\n             Without it, this action answers 404 while the rest of the resource keeps working.",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "description": "Product id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "A `presentations` array, each entry with its key and a `portalStock`.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalUserProductDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalUserProductDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalUserProductDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalUserProductDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated portal configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalUserProductDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing body, an entry without `portalStock`, or an entry that does not identify a presentation of this product.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products or Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No such product in your account, or portal stock is not enabled for your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/external-user-products/price-lists": {
      "get": {
        "tags": [
          "ExternalUserProducts"
        ],
        "summary": "Which price lists the customer portal publishes against.",
        "description": "READ-ONLY on purpose. The web action that changes these does not only write the four\r\nsettings: it also rewrites, in one pass and with no way back, the price list assigned to\r\nevery product already published on the portal. Enabling and disabling products and\r\npresentations one by one is published instead, and covers the common case.\r\n            \r\nA null id means that slot is not configured.",
        "responses": {
          "200": {
            "description": "The portal's price-list settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortalPriceListsDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products or Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Product assignment for external users is turned off for your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/external-users": {
      "get": {
        "tags": [
          "ExternalUsers"
        ],
        "summary": "Lists the customers linked to their portal accounts in your account.",
        "parameters": [
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated links. Defaults to false.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of external users.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalUserDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Duenio role.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/external-users/{externalUserId}": {
      "get": {
        "tags": [
          "ExternalUsers"
        ],
        "summary": "Gets a single external user link by id.",
        "parameters": [
          {
            "name": "externalUserId",
            "in": "path",
            "description": "External user link id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The external user link.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalUserDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Duenio role.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No external user link with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "ExternalUsers"
        ],
        "summary": "Updates the 7 permission flags of an external user link. This is a PARTIAL update:\r\nflags not present in the body keep their current value.",
        "description": "customerId, email and active are read-only here — active changes only through\r\n/activate and /deactivate.",
        "parameters": [
          {
            "name": "externalUserId",
            "in": "path",
            "description": "External user link id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the flags you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalUserDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalUserDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalUserDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalUserDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "External user link updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalUserDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Duenio role.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No external user link with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/external-users/{externalUserId}/deactivate": {
      "post": {
        "tags": [
          "ExternalUsers"
        ],
        "summary": "Deactivates an external user link. Idempotent.",
        "parameters": [
          {
            "name": "externalUserId",
            "in": "path",
            "description": "External user link id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "External user link deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Duenio role.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No external user link with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/external-users/{externalUserId}/activate": {
      "post": {
        "tags": [
          "ExternalUsers"
        ],
        "summary": "Reactivates a previously deactivated external user link. Idempotent.",
        "description": "A different role than every other action here: same asymmetry the web application\r\nitself has (deactivating and the permission flags need `Duenio`, reactivating only\r\nneeds `Administracion`).",
        "parameters": [
          {
            "name": "externalUserId",
            "in": "path",
            "description": "External user link id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "External user link reactivated, or already active."
          },
          "400": {
            "description": "Another active link already exists for this login in your account. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Administracion role.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No external user link with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/files": {
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Uploads a file.",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "entityType": {
                    "type": "string"
                  },
                  "entityId": {
                    "type": "string"
                  },
                  "fileType": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  }
                }
              },
              "encoding": {
                "file": {
                  "style": "form"
                },
                "entityType": {
                  "style": "form"
                },
                "entityId": {
                  "style": "form"
                },
                "fileType": {
                  "style": "form"
                },
                "description": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "File uploaded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing file, or the file is empty.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/files/{fileId}": {
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "Gets a file's metadata.",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "description": "File id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file's metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No file with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/files/{fileId}/content": {
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "Downloads a file's content.",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "description": "File id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No file with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "200": {
            "description": "The file content."
          }
        }
      }
    },
    "/api/v1/files/{fileId}/deactivate": {
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Deletes a file. Irreversible: the underlying content is removed from storage.",
        "description": "Unlike other `/deactivate` actions in this API, there is no matching\r\n`/activate`: the file's content is gone from storage, not just flagged inactive.\r\nCalling this twice returns 404 the second time, not an idempotent 200 — there is\r\nnothing left to distinguish \"never existed\" from \"already deleted\".",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "description": "File id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "File deleted."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No file with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/health": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Liveness probe. Requires no authentication, so you can tell \"the API is down\"\r\nfrom \"my token is wrong\" without opening a ticket.",
        "responses": {
          "200": {
            "description": "The API is up."
          },
          "503": {
            "description": "The API is disabled in this environment."
          }
        }
      }
    },
    "/api/v1/invitations": {
      "post": {
        "tags": [
          "Invitations"
        ],
        "summary": "Invites a customer to their portal account.",
        "description": "This sends a real email. The API does not enforce the invitation limit: sending more\r\ninvitations than `limit` is not blocked. `GET /invitations/quota` reports the\r\ncount for informational purposes.",
        "requestBody": {
          "description": "Required: `customerId`, `email`. Optional: `franchise`, `canViewStock`.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInvitationRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInvitationRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInvitationRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInvitationRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Invitation created and emailed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitationDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing body, invalid `customerId`, or a business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Administracion role, or the InvitarCliente module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/invitations/quota": {
      "get": {
        "tags": [
          "Invitations"
        ],
        "summary": "Gets how many invitations your account has sent, and its configured limit.",
        "description": "Informational only — the API does not block sending more invitations than `limit`.",
        "responses": {
          "200": {
            "description": "The quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitationQuotaDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Administracion role, or the InvitarCliente module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/keg-purchase-orders": {
      "get": {
        "tags": [
          "KegPurchaseOrders"
        ],
        "summary": "Lists the keg purchase orders of your account, most recent first.",
        "description": "The listing omits detailLines — one extra query per row. Read\r\nGET /keg-purchase-orders/{kegPurchaseOrderId} for the lines of a specific order.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over the order number and the supplier's name. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated orders. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of keg purchase orders.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KegPurchaseOrderDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the distributor purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "KegPurchaseOrders"
        ],
        "summary": "Creates a keg purchase order.",
        "description": "supplierId and detailLines are required — detailLines needs at least one entry, and every\r\nline needs a productId. number is resolved server-side, sequential per account, never\r\nfrom the body.",
        "requestBody": {
          "description": "The order to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/KegPurchaseOrderDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KegPurchaseOrderDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/KegPurchaseOrderDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/KegPurchaseOrderDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Keg purchase order created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KegPurchaseOrderDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the distributor purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/keg-purchase-orders/{kegPurchaseOrderId}": {
      "get": {
        "tags": [
          "KegPurchaseOrders"
        ],
        "summary": "Gets a single keg purchase order by id, active or not, with its detail lines.",
        "parameters": [
          {
            "name": "kegPurchaseOrderId",
            "in": "path",
            "description": "Keg purchase order id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The keg purchase order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KegPurchaseOrderDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the distributor purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No keg purchase order with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "KegPurchaseOrders"
        ],
        "summary": "Partially updates a keg purchase order: only the fields you send change.",
        "description": "detailLines absent leaves the existing lines untouched; present (even an empty array)\r\nreplaces every line, but an empty replacement is rejected — an order always needs at\r\nleast one line. number, applied, completed, active are read-only and ignored.",
        "parameters": [
          {
            "name": "kegPurchaseOrderId",
            "in": "path",
            "description": "Keg purchase order id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/KegPurchaseOrderDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KegPurchaseOrderDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/KegPurchaseOrderDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/KegPurchaseOrderDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KegPurchaseOrderDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the distributor purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No keg purchase order with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/keg-purchase-orders/{kegPurchaseOrderId}/deactivate": {
      "post": {
        "tags": [
          "KegPurchaseOrders"
        ],
        "summary": "Deactivates a keg purchase order. The record is never physically deleted: it keeps its\r\nhistory and stays reachable through GET /keg-purchase-orders/{kegPurchaseOrderId}.\r\nIdempotent.",
        "parameters": [
          {
            "name": "kegPurchaseOrderId",
            "in": "path",
            "description": "Keg purchase order id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Keg purchase order deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the distributor purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No keg purchase order with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/keg-purchase-orders/{kegPurchaseOrderId}/activate": {
      "post": {
        "tags": [
          "KegPurchaseOrders"
        ],
        "summary": "Reactivates a previously deactivated keg purchase order. Idempotent.",
        "parameters": [
          {
            "name": "kegPurchaseOrderId",
            "in": "path",
            "description": "Keg purchase order id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Keg purchase order reactivated, or already active."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the distributor purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No keg purchase order with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/kegs": {
      "get": {
        "tags": [
          "Kegs"
        ],
        "summary": "Lists your kegs, by id.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Matches the keg code, serial number or supplier code. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "description": "Keep only kegs currently at this customer. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "True also returns deactivated kegs. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of kegs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KegDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Kegs module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Kegs"
        ],
        "summary": "Creates a keg.",
        "description": "`code` and `liters` are required. `kegTypeId` defaults to DIN when omitted,\r\n            same as the application.",
        "requestBody": {
          "description": "The keg to create.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/KegDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KegDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/KegDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/KegDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Keg created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KegDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Kegs module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/kegs/{kegId}/movements": {
      "get": {
        "tags": [
          "Kegs"
        ],
        "summary": "Lists a keg's movement history: fills, empties, cleanings, transfers and more.",
        "parameters": [
          {
            "name": "kegId",
            "in": "path",
            "description": "Keg id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "True also includes movements later reverted (an undone return or cleaning). Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The keg's movements.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/KegMovementDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Keg Tracking or Kegs module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No keg with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/kegs/{kegId}": {
      "get": {
        "tags": [
          "Kegs"
        ],
        "summary": "Gets a single keg by id.",
        "parameters": [
          {
            "name": "kegId",
            "in": "path",
            "description": "Keg id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The keg.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KegDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Kegs module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No keg with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Kegs"
        ],
        "summary": "Partially updates a keg: only the fields you send change.",
        "description": "`liters` is rejected with `400` if the keg currently holds product or is at a\r\n            customer — same as the application. `supplierCode` is only actually saved on accounts\r\n            with the distributor feature on; sent-but-ignored otherwise, same as the application.",
        "parameters": [
          {
            "name": "kegId",
            "in": "path",
            "description": "Keg id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/KegDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KegDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/KegDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/KegDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated keg.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KegDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Kegs module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No keg with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/kegs/{kegId}/deactivate": {
      "post": {
        "tags": [
          "Kegs"
        ],
        "summary": "Deactivates a keg.",
        "description": "Idempotent: deactivating an already inactive keg answers 200 without changing anything.",
        "parameters": [
          {
            "name": "kegId",
            "in": "path",
            "description": "Keg id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Kegs module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No keg with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/kegs/{kegId}/activate": {
      "post": {
        "tags": [
          "Kegs"
        ],
        "summary": "Reactivates a keg.",
        "description": "Idempotent: reactivating an already active keg answers 200 without changing anything.\r\nRejected with `400` on a starter-plan account that would go over 100 active kegs.",
        "parameters": [
          {
            "name": "kegId",
            "in": "path",
            "description": "Keg id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Reactivated, or already active."
          },
          "400": {
            "description": "The account's active-keg limit was reached (starter plan).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Kegs module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No keg with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/kegs/transfers": {
      "post": {
        "tags": [
          "Kegs"
        ],
        "summary": "Transfers one or more kegs, currently at a customer, to another customer.",
        "description": "All kegs must currently be at the same customer and point of sale — same rule the\r\napplication's own screen enforces; a mixed batch is rejected whole, not partially applied.\r\nRequires the account's keg-transfer-between-customers feature to be on.",
        "requestBody": {
          "description": "Destination customer and the kegs to move.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/KegTransferRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KegTransferRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/KegTransferRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/KegTransferRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The kegs moved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/KegDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Feature not enabled, invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Keg Transfer Between Customers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/kegs/{kegId}/release-reservation": {
      "post": {
        "tags": [
          "Kegs"
        ],
        "summary": "Releases a keg set aside for an order, without moving it.",
        "parameters": [
          {
            "name": "kegId",
            "in": "path",
            "description": "Keg id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The order it's currently reserved for.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/KegReleaseReservationRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KegReleaseReservationRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/KegReleaseReservationRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/KegReleaseReservationRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated keg.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KegDto"
                }
              }
            }
          },
          "400": {
            "description": "The keg is inactive, or isn't reserved for that order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Stock or Release Keg module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No keg with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/kegs/{kegId}/empty": {
      "post": {
        "tags": [
          "Kegs"
        ],
        "summary": "Empties a keg: records that its product left it, and clears its contents.",
        "description": "Rama conservadora: siempre vacía el barril entero y nunca devuelve litros a ningún lote —\r\neso sería envasado a la inversa, y esta API nunca hace envasado. Ver el `remarks` de\r\nGCerv.Api.Dto.KegEmptyRequestDto.",
        "parameters": [
          {
            "name": "kegId",
            "in": "path",
            "description": "Keg id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Optional relocation and note.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/KegEmptyRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KegEmptyRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/KegEmptyRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/KegEmptyRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated keg.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KegDto"
                }
              }
            }
          },
          "400": {
            "description": "The keg does not currently hold product, or is reserved for an order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Stock Entry/Exit module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No keg with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/kegs/{kegId}/discard": {
      "post": {
        "tags": [
          "Kegs"
        ],
        "summary": "Discards the product currently in a keg — a write-off, not a normal emptying.",
        "parameters": [
          {
            "name": "kegId",
            "in": "path",
            "description": "Keg id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Whether this is part of sending the keg to maintenance.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/KegDiscardRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KegDiscardRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/KegDiscardRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/KegDiscardRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated keg.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KegDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Kegs module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No keg with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/kegs/{kegId}/return": {
      "post": {
        "tags": [
          "Kegs"
        ],
        "summary": "A customer returning a keg to you.",
        "description": "Rama conservadora: sin cuenta corriente ni mail de confirmación — ver el `remarks` de GCerv.Api.Dto.KegReturnRequestDto.",
        "parameters": [
          {
            "name": "kegId",
            "in": "path",
            "description": "Keg id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "How and when it came back.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/KegReturnRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KegReturnRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/KegReturnRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/KegReturnRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated keg.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KegDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Keg Returns module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No keg with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/kegs/returns-to-supplier": {
      "post": {
        "tags": [
          "Kegs"
        ],
        "summary": "Returns one or more kegs to a supplier.",
        "description": "Rama conservadora: sin el paso de mail de confirmación — ver el `remarks` de GCerv.Api.Dto.KegSupplierReturnRequestDto.",
        "requestBody": {
          "description": "The supplier and the kegs to return.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/KegSupplierReturnRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KegSupplierReturnRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/KegSupplierReturnRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/KegSupplierReturnRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The kegs returned.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/KegDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplier Keg Returns module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/kegs/clean": {
      "post": {
        "tags": [
          "Kegs"
        ],
        "summary": "Marks one or more kegs as clean, ready to be filled again.",
        "description": "Each keg must currently be marked dirty — see the `remarks` of\r\nGCerv.Api.Dto.KegCleanRequestDto.",
        "requestBody": {
          "description": "The kegs to clean, and optionally the supplies consumed.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/KegCleanRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KegCleanRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/KegCleanRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/KegCleanRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated kegs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/KegDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Keg Cleaning module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "A keg with that id doesn't exist in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/kegs/undo-clean": {
      "post": {
        "tags": [
          "Kegs"
        ],
        "summary": "Undoes the most recent cleaning of one or more kegs, marking them dirty again.",
        "description": "No-op for a keg with no cleaning movement to undo — see the `remarks` of GCerv.Api.Dto.KegUndoCleanRequestDto.",
        "requestBody": {
          "description": "The kegs to revert.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/KegUndoCleanRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KegUndoCleanRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/KegUndoCleanRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/KegUndoCleanRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated kegs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/KegDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or empty body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Keg Cleaning module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "A keg with that id doesn't exist in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/leads": {
      "get": {
        "tags": [
          "Leads"
        ],
        "summary": "Lists the leads of your account.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "One of: `active`, `inactive`, `converted`. Omit it to list every status.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "salesRepId",
            "in": "query",
            "description": "Only leads assigned to this user.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of leads.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Leads module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Leads"
        ],
        "summary": "Creates a lead.",
        "description": "At least one of `name`, `phone` or `email` is required. `source`\r\ndefaults to `\"Manual\"` when omitted — same as the web application's own creation\r\nform.",
        "requestBody": {
          "description": "The lead to create. Any id or read-only field sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/LeadDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/LeadDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Lead created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Leads module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/leads/{leadId}": {
      "get": {
        "tags": [
          "Leads"
        ],
        "summary": "Gets a single lead by id.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "description": "Lead id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The lead.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Leads module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No lead with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/leads/{leadId}/assign-sales-rep": {
      "post": {
        "tags": [
          "Leads"
        ],
        "summary": "Assigns (or unassigns) the sales rep handling a lead.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "description": "Lead id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only `salesRepId`. Omit it or send `null` to unassign.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/AssignSalesRepRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssignSalesRepRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AssignSalesRepRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AssignSalesRepRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Lead updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDto"
                }
              }
            }
          },
          "400": {
            "description": "Business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Leads module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No lead with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/leads/{leadId}/set-inactive": {
      "post": {
        "tags": [
          "Leads"
        ],
        "summary": "Marks a lead as manually inactive, or clears that flag.",
        "description": "This is one of the two inputs to the computed `isInactive` — the other is your own\r\ndays-since-last-contact threshold, see `GET /leads/settings`.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "description": "Lead id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Required: `inactive`.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SetLeadInactiveRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetLeadInactiveRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SetLeadInactiveRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SetLeadInactiveRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Lead updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Leads module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No lead with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/leads/{leadId}/next-contact": {
      "post": {
        "tags": [
          "Leads"
        ],
        "summary": "Schedules (or clears) the next follow-up date for a lead.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "description": "Lead id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only `date`. Omit it or send `null` to clear the schedule.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ScheduleNextContactRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScheduleNextContactRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ScheduleNextContactRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ScheduleNextContactRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Lead updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDto"
                }
              }
            }
          },
          "400": {
            "description": "`date` is not a valid date.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Leads module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No lead with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/leads/{leadId}/register-contact": {
      "post": {
        "tags": [
          "Leads"
        ],
        "summary": "Registers that a sales rep contacted this lead.",
        "description": "Updates `lastContactedAt` directly — same effect `POST /leads/{id}/comments` also has.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "description": "Lead id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only `date`. Omit it to use now.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterLeadContactRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterLeadContactRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterLeadContactRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterLeadContactRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Lead updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDto"
                }
              }
            }
          },
          "400": {
            "description": "`date` is not a valid date.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Leads module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No lead with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/leads/{leadId}/comments": {
      "get": {
        "tags": [
          "Leads"
        ],
        "summary": "Lists the comments logged against a lead, newest first.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "description": "Lead id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of comments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadCommentDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Leads module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No lead with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Leads"
        ],
        "summary": "Logs a comment against a lead.",
        "description": "Also updates the lead's `lastContactedAt` to now — same side effect the web application's own comment form has.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "description": "Lead id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Required: `text`, non-empty.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateLeadCommentRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateLeadCommentRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateLeadCommentRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateLeadCommentRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Comment created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadCommentDto"
                }
              }
            }
          },
          "400": {
            "description": "`text` is missing or empty.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Leads module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No lead with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/leads/{leadId}/convert": {
      "post": {
        "tags": [
          "Leads"
        ],
        "summary": "Converts a lead into a customer.",
        "description": "Creates the customer record (mirroring the web application's own conversion form) —\r\ndoes not touch anything else under `/customers` afterwards. A lead can only be\r\nconverted once; converting it again fails with 400.",
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "description": "Lead id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Both fields optional: `customerTypeId`, `categoryId`.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertLeadRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertLeadRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertLeadRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertLeadRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Lead converted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDto"
                }
              }
            }
          },
          "400": {
            "description": "Already converted, or a business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Leads module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No lead with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/leads/settings": {
      "get": {
        "tags": [
          "Leads"
        ],
        "summary": "Gets your (the integration user's own) inactivity threshold for leads.",
        "description": "This setting is per user, not per account — same as the web application, where each\r\nsales rep has their own threshold. It feeds every lead's computed `isInactive`.",
        "responses": {
          "200": {
            "description": "The current setting.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadSettingsDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Leads module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Leads"
        ],
        "summary": "Sets your (the integration user's own) inactivity threshold for leads.",
        "requestBody": {
          "description": "Required: `inactiveAfterDays`, 0-3650.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/LeadSettingsDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadSettingsDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadSettingsDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/LeadSettingsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Setting updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadSettingsDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing body, or `inactiveAfterDays` out of range.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Leads module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/maintenances": {
      "get": {
        "tags": [
          "Maintenances"
        ],
        "summary": "Lists your maintenances/cleanings.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over notes. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated maintenances. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "assetType",
            "in": "query",
            "description": "One of tank, keg, tapSystem, breweryAsset. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "assetId",
            "in": "query",
            "description": "Only maintenances of this specific asset. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "One of pending, started, finished. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Keep only maintenances scheduled on or after this date, ISO 8601. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Keep only maintenances scheduled on or before this date, ISO 8601. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recurring",
            "in": "query",
            "description": "If true, lists ONLY recurring templates instead of single occurrences. Defaults to false.\r\nThere is no way to list both mixed together — same \"all or nothing\" split the web\r\napplication's own grids already use.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of maintenances.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MaintenanceDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Maintenance module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Maintenances"
        ],
        "summary": "Creates a maintenance/cleaning occurrence, or a recurring template.",
        "description": "assetType, assetId, category, type and eventDate are required. A plain occurrence is\r\nalways created \"pending\" (not started) — see POST /{id}/start to start it. Pass\r\n`recurring: true` (with `recurrenceEvery`/`recurrencePeriod`) to create a\r\ntemplate instead — see POST /{id}/recur to generate occurrences from it.",
        "requestBody": {
          "description": "The maintenance to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/MaintenanceDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MaintenanceDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/MaintenanceDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/MaintenanceDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Maintenance created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MaintenanceDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Maintenance + Start Maintenance modules.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/maintenances/{maintenanceId}": {
      "get": {
        "tags": [
          "Maintenances"
        ],
        "summary": "Gets a single maintenance by id, active or not.",
        "parameters": [
          {
            "name": "maintenanceId",
            "in": "path",
            "description": "Maintenance id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The maintenance.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MaintenanceDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Maintenance module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No maintenance with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/maintenances/{maintenanceId}/deactivate": {
      "post": {
        "tags": [
          "Maintenances"
        ],
        "summary": "Deactivates a maintenance. The record is never physically deleted: it stays reachable\r\nthrough GET /maintenances/{maintenanceId}. Idempotent.",
        "description": "Blocked only when the maintenance is already finished (both started and finished) — a\r\nmaintenance that was started but never finished can still be deactivated, same as the web\r\napplication today.",
        "parameters": [
          {
            "name": "maintenanceId",
            "in": "path",
            "description": "Maintenance id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Maintenance deactivated, or already inactive."
          },
          "400": {
            "description": "The maintenance is already finished.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Maintenance module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No maintenance with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/maintenances/{maintenanceId}/start": {
      "post": {
        "tags": [
          "Maintenances"
        ],
        "summary": "Starts a pending maintenance/cleaning.",
        "description": "Not idempotent: starting one already started or finished is a 400.",
        "parameters": [
          {
            "name": "maintenanceId",
            "in": "path",
            "description": "Maintenance id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Maintenance started.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MaintenanceDto"
                }
              }
            }
          },
          "400": {
            "description": "Already started or finished, or deactivated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Maintenance + Start Maintenance modules.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No maintenance with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/maintenances/{maintenanceId}/finish": {
      "post": {
        "tags": [
          "Maintenances"
        ],
        "summary": "Finishes a started maintenance/cleaning.",
        "description": "Not idempotent: finishing one that was never started, or one already finished, is a 400\r\n— finishing twice would discount spare-part stock twice.",
        "parameters": [
          {
            "name": "maintenanceId",
            "in": "path",
            "description": "Maintenance id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Maintenance finished.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MaintenanceDto"
                }
              }
            }
          },
          "400": {
            "description": "Not started yet, already finished, or deactivated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Maintenance + Finish Maintenance modules.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No maintenance with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/maintenances/{maintenanceId}/reschedule": {
      "post": {
        "tags": [
          "Maintenances"
        ],
        "summary": "Reschedules the event date of a maintenance/cleaning.",
        "description": "No restriction on the current status — same as the web application, which allows fixing\r\na wrong scheduled date even after the maintenance started or finished.",
        "parameters": [
          {
            "name": "maintenanceId",
            "in": "path",
            "description": "Maintenance id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The new event date.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/RescheduleMaintenanceRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RescheduleMaintenanceRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/RescheduleMaintenanceRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/RescheduleMaintenanceRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Maintenance rescheduled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MaintenanceDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or missing eventDate, or deactivated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Maintenance module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No maintenance with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/maintenances/{maintenanceId}/activate": {
      "post": {
        "tags": [
          "Maintenances"
        ],
        "summary": "Reactivates a previously deactivated maintenance. Idempotent.",
        "parameters": [
          {
            "name": "maintenanceId",
            "in": "path",
            "description": "Maintenance id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Maintenance reactivated, or already active."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Maintenance module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No maintenance with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/maintenances/{maintenanceId}/recur": {
      "post": {
        "tags": [
          "Maintenances"
        ],
        "summary": "Generates the next occurrence of a recurring template.",
        "description": "The occurrence is created already started (\"started\", not \"pending\") — same as the web\r\napplication, which starts every generated occurrence immediately.",
        "parameters": [
          {
            "name": "maintenanceId",
            "in": "path",
            "description": "Id of the recurring template (a maintenance with `recurring: true`).",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Occurrence created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MaintenanceDto"
                }
              }
            }
          },
          "400": {
            "description": "The given id is not a recurring template, or it is deactivated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Maintenance + Start Maintenance modules.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No maintenance with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/maintenances/{maintenanceId}/spare-parts": {
      "get": {
        "tags": [
          "Maintenances"
        ],
        "summary": "Gets the spare parts loaded for a maintenance.",
        "description": "Shown as-is regardless of the maintenance's own status — for a finished maintenance,\r\nthese are the spare parts that were actually discounted from stock.",
        "parameters": [
          {
            "name": "maintenanceId",
            "in": "path",
            "description": "Maintenance id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The spare part lines (an empty array if none were loaded).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MaintenanceSparePartLineDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Maintenance module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No maintenance with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Maintenances"
        ],
        "summary": "Replaces the spare parts loaded for a maintenance.",
        "description": "This REPLACES the whole set — there is no per-line id, and no partial merge. Blocked on\r\na finished maintenance: those lines are the actual record of what was discounted from\r\nstock at `/finish`, and silently replacing them would destroy that record without\r\ntouching the stock movements it already created.",
        "parameters": [
          {
            "name": "maintenanceId",
            "in": "path",
            "description": "Maintenance id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The full set of lines. Send an empty array to clear them all.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MaintenanceSparePartLineDto"
                }
              }
            },
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MaintenanceSparePartLineDto"
                }
              }
            },
            "text/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MaintenanceSparePartLineDto"
                }
              }
            },
            "application/*+json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MaintenanceSparePartLineDto"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Lines saved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MaintenanceSparePartLineDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, an id outside its catalog, or the maintenance is finished/deactivated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Maintenance module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No maintenance with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/measurements": {
      "get": {
        "tags": [
          "Measurements"
        ],
        "summary": "Lists the standalone measurements of your account, most recent first.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated measurements. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of measurements.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StandaloneMeasurementDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Measurements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Measurements"
        ],
        "summary": "Records a standalone measurement.",
        "description": "There is no PUT: to correct a measurement, deactivate it and record a new one.",
        "requestBody": {
          "description": "The measurement to record. measurementTypeId and value are required.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/StandaloneMeasurementCreateRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StandaloneMeasurementCreateRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/StandaloneMeasurementCreateRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/StandaloneMeasurementCreateRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created measurement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StandaloneMeasurementDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing body, missing required field, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Measurements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/measurements/{measurementId}": {
      "get": {
        "tags": [
          "Measurements"
        ],
        "summary": "Gets a single standalone measurement by id, active or not.",
        "parameters": [
          {
            "name": "measurementId",
            "in": "path",
            "description": "Measurement id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The measurement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StandaloneMeasurementDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Measurements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No measurement with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/measurements/{measurementId}/deactivate": {
      "post": {
        "tags": [
          "Measurements"
        ],
        "summary": "Deactivates a standalone measurement. The record is never physically deleted: it keeps\r\nits history and stays reachable through GET /measurements/{measurementId}. Idempotent.",
        "parameters": [
          {
            "name": "measurementId",
            "in": "path",
            "description": "Measurement id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Measurement deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Measurements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No measurement with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mix-packs": {
      "get": {
        "tags": [
          "MixPacks"
        ],
        "summary": "Lists the mix packs of your account.",
        "description": "The listing omits the contents: including them would mean two extra queries per row. Read\r\nGET /api/v1/mix-packs/{mixPackId} for what one pack contains.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over the name and the code. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated mix packs. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of mix packs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MixPackDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Packaging module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or concurrency limit exceeded — see Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "MixPacks"
        ],
        "summary": "Creates a mix pack and its contents.",
        "description": "The name is required and must not match another product of your account. A pack must carry\r\nsomething: send `items`, `complementaryItems`, or both.\r\n            \r\nThe pack's description, its litres and its alcohol content are derived from what it carries —\r\nthe application computes them, they are not fields you set.",
        "requestBody": {
          "description": "The mix pack to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/MixPackDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MixPackDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/MixPackDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/MixPackDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Mix pack created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MixPackDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Packaging module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mix-packs/{mixPackId}": {
      "get": {
        "tags": [
          "MixPacks"
        ],
        "summary": "Gets a single mix pack with its contents, active or not.",
        "parameters": [
          {
            "name": "mixPackId",
            "in": "path",
            "description": "Mix pack id — which is a product id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The mix pack.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MixPackDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Packaging module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No mix pack with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "MixPacks"
        ],
        "summary": "Partially updates a mix pack: only the fields you send change.",
        "description": "Sending `items` replaces the whole composition; omitting it keeps the current one. The\r\nsame applies to `complementaryItems`.\r\n            \r\nA pack that already has stock can still be edited, but the application keeps its composition\r\nuntouched when nothing else changed: units already assembled were built from the old\r\ncontents, and rewriting them would make that stock untraceable.",
        "parameters": [
          {
            "name": "mixPackId",
            "in": "path",
            "description": "Mix pack id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/MixPackDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MixPackDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/MixPackDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/MixPackDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated mix pack.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MixPackDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Packaging module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No mix pack with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mix-packs/{mixPackId}/deactivate": {
      "post": {
        "tags": [
          "MixPacks"
        ],
        "summary": "Deactivates a mix pack. The record is never physically deleted: it keeps its history and\r\nstays reachable through GET /mix-packs/{mixPackId}. Idempotent.",
        "description": "Deactivation is rejected while an unfinished order still carries the pack, and while units of\r\nit are in stock: those units exist and deactivating the pack would leave them without a\r\nproduct. The message names which one.",
        "parameters": [
          {
            "name": "mixPackId",
            "in": "path",
            "description": "Mix pack id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Mix pack deactivated, or already inactive."
          },
          "400": {
            "description": "A business rule prevents deactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Packaging module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No mix pack with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/notifications": {
      "get": {
        "tags": [
          "Notifications"
        ],
        "summary": "Lists the notifications visible to you: global, account-wide, and your own.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated notifications. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of notifications.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Lists orders, most recent first.",
        "description": "To keep a dashboard in sync, query a window (for example the last three weeks) every few\r\nminutes, page to the end and replace the whole window on your side. An order's date can be\r\nadjusted afterwards, so leave margin at the start of the window.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "description": "Start of the date range (order date), ISO 8601. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "End of the date range (order date), ISO 8601, inclusive of that whole day. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "description": "Only orders of this customer. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "salesRepId",
            "in": "query",
            "description": "Only orders recorded with this sales rep (the order's, not the customer's current one). Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "statusId",
            "in": "query",
            "description": "Only orders in this status. Allowed values: GET /api/v1/order-statuses. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeQuotes",
            "in": "query",
            "description": "Also return quotes. Defaults to false.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "includeCounterSales",
            "in": "query",
            "description": "Also return counter sales. Defaults to false.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Also return cancelled orders, with active: false. Defaults to false.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of orders.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "A date is not ISO 8601, `from` is later than `to`, or statusId is not a valid status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Orders module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/{orderId}": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Gets a single order with its items.",
        "description": "A cancelled order is returned too, with active: false and its deletionReasonId. Cancelling\r\nan order switches its items off, so a cancelled order comes back with no items.",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "description": "Order id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Orders module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No order with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/payment-orders": {
      "get": {
        "tags": [
          "PaymentOrders"
        ],
        "summary": "Lists the payment orders of your account, newest first.",
        "description": "Orders with no `supplierId` are payments that were not made against a supplier\r\naccount; they are listed too. Passing a `supplierId` that does not exist returns an\r\nempty page rather than a 400, the same as the other list endpoints of this API.",
        "parameters": [
          {
            "name": "supplierId",
            "in": "query",
            "description": "Only orders paid to this supplier. See GET /api/v1/suppliers.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Only orders on or after this date (ISO 8601, `yyyy-MM-dd`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Only orders on or before this date (ISO 8601, `yyyy-MM-dd`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Rows per page, up to 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of payment orders.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentOrderDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "A date is not ISO 8601, or `from` is later than `to`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Cash Registers or Bank Movements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/payment-orders/{paymentOrderId}": {
      "get": {
        "tags": [
          "PaymentOrders"
        ],
        "summary": "Gets a single payment order by id.",
        "parameters": [
          {
            "name": "paymentOrderId",
            "in": "path",
            "description": "Payment order id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The payment order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentOrderDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Cash Registers or Bank Movements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No payment order with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/price-lists": {
      "get": {
        "tags": [
          "PriceLists"
        ],
        "summary": "Lists the price lists of your account.",
        "description": "The listing omits the prices: a list can hold thousands. Read\r\nGET /api/v1/price-lists/{priceListId} for the prices of one list.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over the name. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pointsListsOnly",
            "in": "query",
            "description": "True lists only loyalty-points lists, false only money lists; omit it for both.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated lists. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of price lists.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceListDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Price Lists module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or concurrency limit exceeded — see Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "PriceLists"
        ],
        "summary": "Creates a price list, optionally with its prices.",
        "description": "The name is required and must not match another list of your account — including a\r\ndeactivated one, since reactivating it would leave two lists with the same name.\r\n            \r\nA list can price by percentage over the product's base price, by explicit prices, or by both.",
        "requestBody": {
          "description": "The list to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/PriceListDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PriceListDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PriceListDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PriceListDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Price list created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceListDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Price Lists module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/price-lists/{priceListId}": {
      "get": {
        "tags": [
          "PriceLists"
        ],
        "summary": "Gets a single price list with its prices, active or not.",
        "parameters": [
          {
            "name": "priceListId",
            "in": "path",
            "description": "Price list id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The price list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceListDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Price Lists module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No price list with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "PriceLists"
        ],
        "summary": "Partially updates a price list: only the fields you send change.",
        "description": "Prices are merged, not replaced: an entry matching an existing product, container and case\r\nupdates it, anything else is added, and prices you do not send are kept. Removing a price\r\nfrom a list is not possible in this version.",
        "parameters": [
          {
            "name": "priceListId",
            "in": "path",
            "description": "Price list id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/PriceListDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PriceListDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PriceListDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PriceListDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated price list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceListDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Price Lists module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No price list with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/price-lists/{priceListId}/deactivate": {
      "post": {
        "tags": [
          "PriceLists"
        ],
        "summary": "Deactivates a price list. The record is never physically deleted: it keeps its history and\r\nstays reachable through GET /price-lists/{priceListId}. Idempotent.",
        "description": "Deactivating a list also deactivates its prices. Customers assigned to it and orders that\r\nused it are NOT changed — their prices were already applied.",
        "parameters": [
          {
            "name": "priceListId",
            "in": "path",
            "description": "Price list id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List deactivated, or already inactive."
          },
          "400": {
            "description": "A business rule prevents deactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Price Lists module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No price list with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/price-lists/{priceListId}/activate": {
      "post": {
        "tags": [
          "PriceLists"
        ],
        "summary": "Reactivates a previously deactivated price list. Idempotent.",
        "parameters": [
          {
            "name": "priceListId",
            "in": "path",
            "description": "Price list id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List reactivated, or already active."
          },
          "400": {
            "description": "A business rule prevents reactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Price Lists module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No price list with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/product-categories": {
      "get": {
        "tags": [
          "ProductCategories"
        ],
        "summary": "Lists the product categories of your account.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over name. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated categories. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of product categories.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductCategoryDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "ProductCategories"
        ],
        "summary": "Creates a product category.",
        "description": "name is required and must be unique among your active AND inactive categories —\r\n            same rule the web application enforces.",
        "requestBody": {
          "description": "The category to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ProductCategoryDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductCategoryDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductCategoryDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ProductCategoryDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Product category created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductCategoryDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/product-categories/{productCategoryId}": {
      "get": {
        "tags": [
          "ProductCategories"
        ],
        "summary": "Gets a single product category by id, active or not.",
        "parameters": [
          {
            "name": "productCategoryId",
            "in": "path",
            "description": "Product category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The product category.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductCategoryDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No product category with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "ProductCategories"
        ],
        "summary": "Updates a product category. This is a PARTIAL update: fields not present in the body\r\nkeep their current value.",
        "parameters": [
          {
            "name": "productCategoryId",
            "in": "path",
            "description": "Product category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ProductCategoryDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductCategoryDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductCategoryDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ProductCategoryDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Product category updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductCategoryDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No product category with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/product-categories/{productCategoryId}/deactivate": {
      "post": {
        "tags": [
          "ProductCategories"
        ],
        "summary": "Deactivates a product category. The record is never physically deleted: it stays\r\nreachable through GET /product-categories/{productCategoryId}. Idempotent.",
        "description": "No check is made for products currently using this category — same as the web\r\napplication, which allows it too.",
        "parameters": [
          {
            "name": "productCategoryId",
            "in": "path",
            "description": "Product category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Product category deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No product category with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/product-categories/{productCategoryId}/activate": {
      "post": {
        "tags": [
          "ProductCategories"
        ],
        "summary": "Reactivates a previously deactivated product category. Idempotent.",
        "parameters": [
          {
            "name": "productCategoryId",
            "in": "path",
            "description": "Product category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Product category reactivated, or already active."
          },
          "400": {
            "description": "A business rule prevents reactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No product category with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products": {
      "get": {
        "tags": [
          "Products"
        ],
        "summary": "Lists the active products of your account.",
        "description": "The listing omits containers and cases: including them would mean two extra queries per\r\nrow. Read GET /api/v1/products/{productId} for the formats of a specific product.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over name, style or code. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "complementaryOnly",
            "in": "query",
            "description": "True lists only complementary products (bought to resell), false only your own; omit it to\r\nlist both.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated products. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of products.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or concurrency limit exceeded — see Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Products"
        ],
        "summary": "Creates a product, optionally with its prices per container and per case.",
        "description": "The same business rules the web application enforces apply here: style is required, name is\r\nrequired for a complementary product and must not match another active product, and a\r\ndiscount product must have a price of zero or less.\r\n            \r\nYou can send containers and cases in the same request: each entry sets the selling price and\r\nthe unit cost of the product in that format. Their ids come from GET /api/v1/containers and\r\nGET /api/v1/cases.",
        "requestBody": {
          "description": "The product to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ProductDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ProductDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Product created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Products module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products/{productId}": {
      "get": {
        "tags": [
          "Products"
        ],
        "summary": "Gets a single product by id, active or not, with its sales formats.",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "description": "Product id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The product.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No product with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Products"
        ],
        "summary": "Updates a product. This is a PARTIAL update: fields not present in the body keep their\r\ncurrent value.",
        "description": "Sending containers or cases REPLACES that whole collection — a format you leave out of a\r\ncollection you sent is removed, and its price is lost. Omitting the collection keeps it\r\nexactly as it is, so you never need to resend formats you are not changing.\r\n            \r\nRemoving a container or a case is rejected while the product appears in an order that has\r\nnot been delivered yet: the order names that format, and it would be left pointing at\r\nnothing. Deliver or cancel those orders first.",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "description": "Product id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ProductDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ProductDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Product updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Products module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No product with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products/{productId}/deactivate": {
      "post": {
        "tags": [
          "Products"
        ],
        "summary": "Deactivates a product. The record is never physically deleted: it keeps its history and\r\nstays reachable through GET /products/{productId}. Idempotent.",
        "description": "Deactivation is rejected while the product is still in play: kegs or containers holding it,\r\nbatches or batch plans producing it, orders not yet delivered, or stock on hand — including\r\nstock of a mix pack that contains it. The message names which one, so you know what to\r\nclear first.",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "description": "Product id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Product deactivated, or already inactive."
          },
          "400": {
            "description": "A business rule prevents deactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Products module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No product with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products/{productId}/activate": {
      "post": {
        "tags": [
          "Products"
        ],
        "summary": "Reactivates a previously deactivated product. Idempotent.",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "description": "Product id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Product reactivated, or already active."
          },
          "400": {
            "description": "A business rule prevents reactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Products module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No product with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products/{productId}/categories": {
      "get": {
        "tags": [
          "Products"
        ],
        "summary": "Lists the categories a product is classified with.",
        "description": "A product can hold several categories at once. They are also writable as the categoryIds\r\nfield of the product itself; this endpoint exists so you can read them without asking for\r\nthe whole product. The full set to choose from is GET /api/v1/product-categories.",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "description": "Product id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The categories. An empty array if the product has none.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Products module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No product with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products/{productId}/stock": {
      "get": {
        "tags": [
          "Products"
        ],
        "summary": "Gets the current stock of a product, broken down by warehouse.",
        "description": "Bulk beer still in a tank is not included: that is `tanks/{id}/content`, a sub-resource\r\nthat does not exist yet. Kegs are not included either: keg stock by warehouse belongs to the\r\nfuture `kegs` resource, still undesigned. A product that also sells kegged or has\r\nbatches in a tank simply does not show those quantities here yet.\r\n            \r\n`productKind` decides which fields of each entry in `byWarehouse` carry a value:\r\n`own` sets `containers` and `cases`; `mixPack` and `complementary`\r\nset `quantity`. A product that does not track stock at all — a discount or surcharge\r\nline, or a complementary product with `tracksStock` false — answers with an empty\r\n`byWarehouse`, not an error.\r\n            \r\n`minimumStock` is not repeated here: read it from `GET /api/v1/products/{id}`\r\n(the `minimumStock` field), which is the same value regardless of product kind.",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "description": "Product id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The stock.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductStockDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Stock module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No product with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products/{productId}/stock/pack": {
      "post": {
        "tags": [
          "Products"
        ],
        "summary": "Assembles loose containers of a product into cases.",
        "description": "Consumes loose containers oldest-expiring-first (FEFO) across all the stock your account\r\nhas for that product and container in the warehouse — it does not target a specific batch,\r\ninvoice or delivery note the way the application's own screen does. Only `own` products\r\nsupport this: a mix pack or a complementary product answers `400`.",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "description": "Product id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The warehouse, the case format, and how many cases to assemble.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/PackProductStockDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PackProductStockDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PackProductStockDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PackProductStockDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated stock.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductStockDto"
                }
              }
            }
          },
          "400": {
            "description": "Not enough loose containers, an id outside its catalog, or the product does not support packing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Stock module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No product with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products/{productId}/stock/unpack": {
      "post": {
        "tags": [
          "Products"
        ],
        "summary": "Disassembles cases of a product back into loose containers.",
        "description": "Same FEFO aggregation as `/pack`, on the cases instead of the loose containers. Does\r\nnot support mix packs: disassembling one splits stock across several different products at\r\nonce, which is not a per-product operation — `productKind: \"mixPack\"` answers\r\n`400`.",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "description": "Product id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The warehouse, the case format, and how many cases to disassemble.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/UnpackProductStockDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UnpackProductStockDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UnpackProductStockDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UnpackProductStockDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated stock.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductStockDto"
                }
              }
            }
          },
          "400": {
            "description": "Not enough cases, an id outside its catalog, or the product does not support unpacking.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Stock module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No product with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/promotions": {
      "get": {
        "tags": [
          "Promotions"
        ],
        "summary": "Lists the active promotions of your account.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of promotions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromotionDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Promotions module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Promotions"
        ],
        "summary": "Creates a promotion.",
        "description": "`description`, `scope` and `calculationType` are required, plus the\r\n            fields each combination needs — see the validation rules in the guide.",
        "requestBody": {
          "description": "The promotion to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/PromotionDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PromotionDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PromotionDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PromotionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Promotion created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromotionDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Promotions module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/promotions/{promotionId}": {
      "get": {
        "tags": [
          "Promotions"
        ],
        "summary": "Gets a single promotion by id, active or not.",
        "parameters": [
          {
            "name": "promotionId",
            "in": "path",
            "description": "Promotion id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The promotion.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromotionDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Promotions module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No promotion with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Promotions"
        ],
        "summary": "Updates a promotion. This is a PARTIAL update: fields not present in the body keep their\r\ncurrent value.",
        "description": "A deactivated promotion cannot be edited through this endpoint — the underlying save\r\nalways reactivates on update, so reaching an inactive one here would reactivate it as a\r\nside effect. This resource has no `/activate` on purpose (the web application never\r\nhad a way to reactivate a promotion either); a deactivated id answers `404` here for\r\nthe same reason.",
        "parameters": [
          {
            "name": "promotionId",
            "in": "path",
            "description": "Promotion id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/PromotionDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PromotionDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PromotionDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PromotionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Promotion updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PromotionDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Promotions module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No promotion with that id in your account, or it is deactivated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/promotions/{promotionId}/deactivate": {
      "post": {
        "tags": [
          "Promotions"
        ],
        "summary": "Deactivates a promotion. The record is never physically deleted: it stays reachable\r\nthrough GET /promotions/{promotionId}. Idempotent.",
        "description": "There is no /activate — the web application itself has no reactivation for a promotion either.",
        "parameters": [
          {
            "name": "promotionId",
            "in": "path",
            "description": "Promotion id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Promotion deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Promotions module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No promotion with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/purchase-orders": {
      "get": {
        "tags": [
          "PurchaseOrders"
        ],
        "summary": "Lists the purchase orders of your account, most recent first.",
        "description": "The listing omits detailLines — one extra query per row. Read\r\nGET /purchase-orders/{purchaseOrderId} for the lines of a specific order.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over the order number and the supplier's name. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated orders. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of purchase orders.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrderDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchase Orders module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "PurchaseOrders"
        ],
        "summary": "Creates a purchase order.",
        "description": "supplierId and detailLines are required — detailLines needs at least one entry. number is\r\nresolved server-side, sequential per account, never from the body.",
        "requestBody": {
          "description": "The order to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseOrderDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseOrderDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseOrderDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseOrderDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Purchase order created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrderDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchase Orders module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/purchase-orders/{purchaseOrderId}": {
      "get": {
        "tags": [
          "PurchaseOrders"
        ],
        "summary": "Gets a single purchase order by id, active or not, with its detail lines.",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "in": "path",
            "description": "Purchase order id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The purchase order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrderDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchase Orders module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No purchase order with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "PurchaseOrders"
        ],
        "summary": "Partially updates a purchase order: only the fields you send change.",
        "description": "detailLines absent leaves the existing lines untouched; present (even an empty array)\r\nreplaces every line, but an empty replacement is rejected — an order always needs at\r\nleast one line. number, applied, completed, completedByUserId, completedOn, active are\r\nread-only and ignored.",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "in": "path",
            "description": "Purchase order id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseOrderDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseOrderDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseOrderDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseOrderDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrderDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchase Orders module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No purchase order with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/purchase-orders/{purchaseOrderId}/deactivate": {
      "post": {
        "tags": [
          "PurchaseOrders"
        ],
        "summary": "Deactivates a purchase order. The record is never physically deleted: it keeps its\r\nhistory and stays reachable through GET /purchase-orders/{purchaseOrderId}. Idempotent.",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "in": "path",
            "description": "Purchase order id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Purchase order deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchase Orders module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No purchase order with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/purchase-orders/{purchaseOrderId}/complete": {
      "post": {
        "tags": [
          "PurchaseOrders"
        ],
        "summary": "Marks a purchase order as completed. Manual closing, independent of whether any purchase\r\nhas been applied against it yet — the web only shows this action once at least one\r\npurchase has been applied, but that is a UI convenience, not a rule enforced server-side\r\ntoday (OrdenCompraService.Completar has no such guard), so the API does not add one\r\neither. Idempotent.",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "in": "path",
            "description": "Purchase order id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Purchase order completed, or already completed."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchase Orders module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No purchase order with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/purchase-orders/{purchaseOrderId}/activate": {
      "post": {
        "tags": [
          "PurchaseOrders"
        ],
        "summary": "Reactivates a previously deactivated purchase order. Idempotent.",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "in": "path",
            "description": "Purchase order id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Purchase order reactivated, or already active."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchase Orders module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No purchase order with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/purchases": {
      "get": {
        "tags": [
          "Purchases"
        ],
        "summary": "Lists purchases of your account, most recent first.",
        "description": "The listing deliberately omits lines: including them would mean one extra query per row.\r\nRead GET /api/v1/purchases/{purchaseId} for the lines of a specific purchase.",
        "parameters": [
          {
            "name": "dateFrom",
            "in": "query",
            "description": "Only purchases dated on or after this date, ISO 8601. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "description": "Only purchases dated on or before this date, ISO 8601. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "supplierId",
            "in": "query",
            "description": "Only purchases of this supplier. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "purchaseTypeId",
            "in": "query",
            "description": "Only purchases of this type. See GET /api/v1/purchase-types. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Free text over invoice, delivery note and credit note numbers. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeCancelled",
            "in": "query",
            "description": "Include voided purchases. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of purchases.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "A date is not ISO 8601.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or concurrency limit exceeded — see Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Purchases"
        ],
        "summary": "Records a purchase, or a purchase credit note, with its lines.",
        "description": "This is not just an insert: every line that points to a supply, a complementary product or\r\na spare part MOVES STOCK, and the purchase is posted to the supplier's current account.\r\nRetrying a request that timed out can therefore double the stock — send the\r\nIdempotency-Key header and the retry returns the original response instead.\r\n            \r\nThe same business rules the web application enforces apply here: supplierId is required,\r\neither invoiceNumber or deliveryNoteNumber is required, invoiceNumber specifically becomes\r\nrequired as soon as there is any amount, every line needs a description and a quantity\r\ngreater than zero, and the invoice number must not already exist for that supplier.\r\n            \r\nIf the header subtotal does not match the sum of the lines the request is rejected with\r\n400 header_detail_mismatch. Re-send it with confirmDiscrepancy true to accept it anyway.",
        "requestBody": {
          "description": "The purchase to record. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Purchase recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or header/detail mismatch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/purchases/{purchaseId}": {
      "get": {
        "tags": [
          "Purchases"
        ],
        "summary": "Gets a single purchase by id, with its lines.",
        "parameters": [
          {
            "name": "purchaseId",
            "in": "path",
            "description": "Purchase id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The purchase.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No purchase with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Purchases"
        ],
        "summary": "Updates a purchase. This is a PARTIAL update: fields not present in the body keep their\r\ncurrent value. Sending lines REPLACES the whole collection; omitting it keeps the current lines.",
        "description": "What you are allowed to change depends on how much of the purchase has been paid, and the\r\nrules are the same ones the application applies:\r\n            \r\n- Nothing paid: amounts, lines, voucher numbers, dates and the expense account can change.\r\n  The supplier can change only while the purchase has no lines. Spare-part lines can be\r\n  added only to a purchase that has no lines yet, and the lines of a purchase that already\r\n  has a spare part cannot change.\r\n- Partially paid: only the dates.\r\n- Fully paid, or already voided: nothing. Void it and record it again.\r\n            \r\nA change the current state does not allow is rejected with 400 business_rule; it is not\r\nsilently ignored. Changing amounts or lines reverses the stock and current-account\r\nmovements of the previous version and applies the new ones, so send an Idempotency-Key.\r\npurchaseTypeId cannot be changed: a purchase and a credit note move stock in opposite\r\ndirections.",
        "parameters": [
          {
            "name": "purchaseId",
            "in": "path",
            "description": "Purchase id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Purchase updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, a change not allowed in the current state, or header/detail mismatch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No purchase with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/purchases/{purchaseId}/cancel": {
      "post": {
        "tags": [
          "Purchases"
        ],
        "summary": "Voids a purchase, reversing the stock and current-account movements it created. The record\r\nis never physically deleted: it keeps its history and stays reachable through\r\nGET /purchases/{purchaseId}. Idempotent.",
        "description": "A purchase with payments applied cannot be voided, and neither can one that has credit\r\nnotes against it — void those first. The response names them so you know what to do.",
        "parameters": [
          {
            "name": "purchaseId",
            "in": "path",
            "description": "Purchase id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Purchase voided, or already voided."
          },
          "400": {
            "description": "A business rule prevents voiding. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Purchase module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No purchase with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/raw-material-valuation": {
      "get": {
        "tags": [
          "RawMaterialValuation"
        ],
        "summary": "Lists the current valuation of your raw material (supply) stock.",
        "parameters": [
          {
            "name": "supplyId",
            "in": "query",
            "description": "Only this supply. Listed by `GET /api/v1/supplies`.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "asOf",
            "in": "query",
            "description": "Valuation cutoff date, `yyyy-MM-dd`. Omit it to use now.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeVat",
            "in": "query",
            "description": "Apply VAT to both cost figures. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The valuation lines.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RawMaterialValuationLineDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "`asOf` is not a valid date.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Product reports module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/receipts": {
      "get": {
        "tags": [
          "Receipts"
        ],
        "summary": "Lists the receipts of your account, newest first.",
        "description": "The list never returns `cashMovementIds`/`bankMovementIds`: a receipt can cover\r\nmore than one movement, so resolving them here would multiply rows and break paging. Ask\r\nfor a single receipt to get them.",
        "parameters": [
          {
            "name": "customerId",
            "in": "query",
            "description": "Only receipts issued to this customer. See GET /api/v1/customers.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "supplierId",
            "in": "query",
            "description": "Only receipts issued against this supplier. See GET /api/v1/suppliers.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Only receipts on or after this date (ISO 8601, `yyyy-MM-dd`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Only receipts on or before this date (ISO 8601, `yyyy-MM-dd`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Also include deactivated receipts. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Rows per page, up to 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of receipts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "A date is not ISO 8601, or `from` is later than `to`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Cash Registers or Bank Movements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/receipts/{receiptId}": {
      "get": {
        "tags": [
          "Receipts"
        ],
        "summary": "Gets a single receipt by id, with the movements it covers.",
        "parameters": [
          {
            "name": "receiptId",
            "in": "path",
            "description": "Receipt id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Cash Registers or Bank Movements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No receipt with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/recipes": {
      "get": {
        "tags": [
          "Recipes"
        ],
        "summary": "Lists the recipes of your account.",
        "description": "The listing omits the ingredients and the tasks: including them would mean two extra queries\r\nper row. Read GET /api/v1/recipes/{recipeId} for the full recipe.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over the name. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "description": "Keep only the recipes that produce this beer. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated recipes. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of recipes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecipeDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Recipes module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or concurrency limit exceeded — see Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Recipes"
        ],
        "summary": "Creates a recipe, optionally with its ingredients and tasks.",
        "description": "The name and the product are required, and the name must not match another recipe of your\r\naccount.\r\n            \r\nYeast ingredients never take stock: the application manages yeast through its own containers,\r\nso `discountsStock` is forced to false for them regardless of what you send.",
        "requestBody": {
          "description": "The recipe to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/RecipeDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecipeDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/RecipeDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/RecipeDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Recipe created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecipeDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Recipes module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/recipes/{recipeId}": {
      "get": {
        "tags": [
          "Recipes"
        ],
        "summary": "Gets a single recipe with its ingredients and tasks, active or not.",
        "parameters": [
          {
            "name": "recipeId",
            "in": "path",
            "description": "Recipe id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The recipe.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecipeDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Recipes module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No recipe with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Recipes"
        ],
        "summary": "Partially updates a recipe: only the fields you send change.",
        "description": "Sending `ingredients` replaces the whole set; omitting it keeps the current ingredients.\r\nThe same applies to `taskDefinitionIds`.",
        "parameters": [
          {
            "name": "recipeId",
            "in": "path",
            "description": "Recipe id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/RecipeDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecipeDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/RecipeDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/RecipeDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated recipe.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecipeDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Edit Recipes module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No recipe with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/recipes/{recipeId}/deactivate": {
      "post": {
        "tags": [
          "Recipes"
        ],
        "summary": "Deactivates a recipe. The record is never physically deleted: it keeps its history and stays\r\nreachable through GET /recipes/{recipeId}. Idempotent.",
        "description": "Batches already brewed from the recipe are not affected: they keep the ingredients that were\r\nactually used.",
        "parameters": [
          {
            "name": "recipeId",
            "in": "path",
            "description": "Recipe id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recipe deactivated, or already inactive."
          },
          "400": {
            "description": "A business rule prevents deactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Recipes module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No recipe with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/recipes/{recipeId}/activate": {
      "post": {
        "tags": [
          "Recipes"
        ],
        "summary": "Reactivates a previously deactivated recipe. Idempotent.",
        "parameters": [
          {
            "name": "recipeId",
            "in": "path",
            "description": "Recipe id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recipe reactivated, or already active."
          },
          "400": {
            "description": "A business rule prevents reactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Recipes module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No recipe with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/returnable-packaging": {
      "get": {
        "tags": [
          "ReturnablePackaging"
        ],
        "summary": "Lists the returnable packaging definitions of your account.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over name, brand and colour. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated definitions. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of definitions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReturnablePackagingDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Production module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "ReturnablePackaging"
        ],
        "summary": "Creates a returnable packaging definition.",
        "description": "`name` and `containerId` are required.\r\n            \r\n             IMPORTANT: this can CREATE A SUPPLY. If your account has no supply named after the\r\n             container yet, one is provisioned, because without it there is no returnable stock to\r\n             count. Its id comes back as `supplyId` and is readable at GET /api/v1/supplies.",
        "requestBody": {
          "description": "The definition to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ReturnablePackagingDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReturnablePackagingDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ReturnablePackagingDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ReturnablePackagingDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Definition created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReturnablePackagingDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Production module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/returnable-packaging/{returnableId}": {
      "get": {
        "tags": [
          "ReturnablePackaging"
        ],
        "summary": "Gets a single returnable packaging definition, active or not.",
        "parameters": [
          {
            "name": "returnableId",
            "in": "path",
            "description": "Definition id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReturnablePackagingDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Production module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No returnable packaging with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "ReturnablePackaging"
        ],
        "summary": "Updates a returnable packaging definition. This is a PARTIAL update: fields not present in\r\nthe body keep their current value.",
        "description": "`supplyId` and `active` are read-only. The backing supply is only provisioned on\r\n            creation: an update never reassigns it.",
        "parameters": [
          {
            "name": "returnableId",
            "in": "path",
            "description": "Definition id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ReturnablePackagingDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReturnablePackagingDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ReturnablePackagingDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ReturnablePackagingDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Definition updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReturnablePackagingDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Production module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No returnable packaging with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/services": {
      "get": {
        "tags": [
          "Services"
        ],
        "summary": "Lists the services of your account.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over name. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated services. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of services.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Service module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Services"
        ],
        "summary": "Creates a service.",
        "description": "name is required, at most 100 characters, and must be unique among your account's\r\nservices, active or not — same rule the web application enforces.",
        "requestBody": {
          "description": "The service to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ServiceDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ServiceDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ServiceDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ServiceDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Service created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Service module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/services/{serviceId}": {
      "get": {
        "tags": [
          "Services"
        ],
        "summary": "Gets a single service by id, active or not.",
        "parameters": [
          {
            "name": "serviceId",
            "in": "path",
            "description": "Service id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The service.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Service module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No service with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Services"
        ],
        "summary": "Updates a service. This is a PARTIAL update: fields not present in the body keep their\r\ncurrent value.",
        "parameters": [
          {
            "name": "serviceId",
            "in": "path",
            "description": "Service id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ServiceDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ServiceDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ServiceDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ServiceDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Service updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Service module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No service with that id in your account, or it is deactivated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/services/{serviceId}/deactivate": {
      "post": {
        "tags": [
          "Services"
        ],
        "summary": "Deactivates a service. The record is never physically deleted: it stays reachable\r\nthrough GET /services/{serviceId}. Idempotent.",
        "description": "No check is made for purchases currently referencing this service — same as the web\r\napplication, which allows it too (same criterion already applied to\r\nproduct-categories/customer-categories).",
        "parameters": [
          {
            "name": "serviceId",
            "in": "path",
            "description": "Service id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Service deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete/Reactivate Service module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No service with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/services/{serviceId}/activate": {
      "post": {
        "tags": [
          "Services"
        ],
        "summary": "Reactivates a previously deactivated service. Idempotent.",
        "parameters": [
          {
            "name": "serviceId",
            "in": "path",
            "description": "Service id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Service reactivated, or already active."
          },
          "400": {
            "description": "A business rule prevents reactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete/Reactivate Service module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No service with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/spare-parts": {
      "get": {
        "tags": [
          "SpareParts"
        ],
        "summary": "Lists your spare parts.",
        "description": "With the defaults (active only, no search) this is exactly the catalog of\r\n`sparePartId` used by a purchase line and a supplier item mapping.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Matches code and name. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated spare parts. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of spare parts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SparePartDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Spare Parts module, the account has not contracted the Maintenance add-on, or it is on the Homebrewer plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "SpareParts"
        ],
        "summary": "Creates a spare part.",
        "description": "Only `name` is required — there are no foreign keys to validate.",
        "requestBody": {
          "description": "The spare part to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SparePartDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SparePartDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SparePartDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SparePartDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Spare part created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SparePartDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create Spare Part module, the account has not contracted the Maintenance add-on, or it is on the Homebrewer plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/spare-parts/{sparePartId}": {
      "get": {
        "tags": [
          "SpareParts"
        ],
        "summary": "Gets a single spare part by id, active or not.",
        "parameters": [
          {
            "name": "sparePartId",
            "in": "path",
            "description": "Spare part id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The spare part.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SparePartDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Spare Parts module, the account has not contracted the Maintenance add-on, or it is on the Homebrewer plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No spare part with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "SpareParts"
        ],
        "summary": "Updates a spare part. This is a PARTIAL update: fields not present in the body keep their current value.",
        "parameters": [
          {
            "name": "sparePartId",
            "in": "path",
            "description": "Spare part id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SparePartDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SparePartDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SparePartDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SparePartDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Spare part updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SparePartDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Edit Spare Part module, the account has not contracted the Maintenance add-on, or it is on the Homebrewer plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No spare part with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/spare-parts/{sparePartId}/deactivate": {
      "post": {
        "tags": [
          "SpareParts"
        ],
        "summary": "Deactivates a spare part. The record is never physically deleted: it stays reachable\r\nthrough GET /spare-parts/{sparePartId}. Idempotent.",
        "description": "There is no check here for existing stock or maintenances referencing this spare part —\r\nthe web application itself has none either. Replicated as-is, not a gap introduced by\r\nthe API.",
        "parameters": [
          {
            "name": "sparePartId",
            "in": "path",
            "description": "Spare part id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Spare part deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Edit Spare Part module, the account has not contracted the Maintenance add-on, or it is on the Homebrewer plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No spare part with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/spare-parts/{sparePartId}/activate": {
      "post": {
        "tags": [
          "SpareParts"
        ],
        "summary": "Reactivates a previously deactivated spare part. Idempotent.",
        "parameters": [
          {
            "name": "sparePartId",
            "in": "path",
            "description": "Spare part id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Spare part reactivated, or already active."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Edit Spare Part module, the account has not contracted the Maintenance add-on, or it is on the Homebrewer plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No spare part with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/spare-parts/{sparePartId}/stock": {
      "get": {
        "tags": [
          "SpareParts"
        ],
        "summary": "Gets the stock of one spare part, overall and per warehouse.",
        "description": "`byWarehouse` lists every active warehouse of your account, including ones with zero stock of this spare part.",
        "parameters": [
          {
            "name": "sparePartId",
            "in": "path",
            "description": "Spare part id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The stock.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SparePartStockDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Spare Parts module, the account has not contracted the Maintenance add-on, or it is on the Homebrewer plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No spare part with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/spare-parts/{sparePartId}/stock/adjustments": {
      "post": {
        "tags": [
          "SpareParts"
        ],
        "summary": "Records a manual stock adjustment for one spare part: an entry or an exit.",
        "description": "The sign of `quantity` decides the direction: positive enters stock, negative takes\r\nit out. Zero is rejected with 400 (`business_rule`). Unlike\r\n`/supplies/{id}/stock/adjustments`, there is no cap on quantity and no 30-day\r\nretroactivity limit. The resulting stock may go negative, unless the account has turned on\r\nthe \"block movements that would leave spare part stock negative\" setting: then an exit\r\nthat would leave the warehouse below zero is rejected with 400 (`business_rule`).",
        "parameters": [
          {
            "name": "sparePartId",
            "in": "path",
            "description": "Spare part id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The quantity to move — its sign decides the direction — and where.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SparePartStockAdjustmentDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SparePartStockAdjustmentDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SparePartStockAdjustmentDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SparePartStockAdjustmentDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The spare part's updated stock.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SparePartStockDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Spare Parts module, the account has not contracted the Maintenance add-on, or it is on the Homebrewer plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No spare part with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/spare-parts/{sparePartId}/stock/transfers": {
      "post": {
        "tags": [
          "SpareParts"
        ],
        "summary": "Moves stock of one spare part from one warehouse to another.",
        "description": "The origin warehouse must have enough stock: a transfer of more than its current stock is\r\nrejected with 400 (`business_rule`), always, like `/supplies` transfers. The\r\naccount setting that blocks negative spare part stock does not apply to transfers.",
        "parameters": [
          {
            "name": "sparePartId",
            "in": "path",
            "description": "Spare part id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The warehouses and the quantity to move.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SparePartStockTransferDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SparePartStockTransferDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SparePartStockTransferDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SparePartStockTransferDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The spare part's updated stock.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SparePartStockDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, an id outside its catalog, a quantity that is not greater than zero, or the same warehouse as origin and destination.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Spare Parts module, the account has not contracted the Maintenance add-on, or it is on the Homebrewer plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No spare part with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/spare-parts/{sparePartId}/movements": {
      "get": {
        "tags": [
          "SpareParts"
        ],
        "summary": "Lists the stock movements of one spare part.",
        "parameters": [
          {
            "name": "sparePartId",
            "in": "path",
            "description": "Spare part id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "warehouseId",
            "in": "query",
            "description": "Only movements in this warehouse. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of movements.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SparePartMovementDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Spare Parts module, the account has not contracted the Maintenance add-on, or it is on the Homebrewer plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No spare part with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/stock-movements": {
      "get": {
        "tags": [
          "StockMovements"
        ],
        "summary": "Lists stock transfers between your warehouses, most recent first.",
        "description": "One line per product/container/case moved. A single transfer that moved more than one of\r\nthem comes back as more than one line, sharing the same `transferId`.",
        "parameters": [
          {
            "name": "dateFrom",
            "in": "query",
            "description": "Only transfers dated on or after this date, ISO 8601. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "description": "Only transfers dated on or before this date, ISO 8601. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "warehouseId",
            "in": "query",
            "description": "Only transfers where this warehouse is either the source or the destination. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of stock movement lines.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockMovementDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "A date is not ISO 8601, or the pagination parameters are invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Warehouse Movements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "StockMovements"
        ],
        "summary": "Transfers product or packaging stock from one of your warehouses to another.",
        "description": "Consumes stock oldest-expiring-first (FEFO) across all the stock your account has for each\r\nproduct and container/case in the source warehouse — it does not target a specific batch,\r\ninvoice or delivery note the way the application's own screen does. The stock it creates in\r\nthe destination warehouse carries no batch attribution.\r\n            \r\nDoes not move kegs or mix packs — see the remarks on the resource. Never generates the\r\nelectronic dispatch guide (Chile): that stays a web-only, follow-up action.",
        "requestBody": {
          "description": "The two warehouses and the lines to move.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/StockMovementRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StockMovementRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/StockMovementRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/StockMovementRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The lines created by the transfer.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/StockMovementDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Not enough stock for a line, an id outside its catalog, or an invalid itemType.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Warehouse Movements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "A warehouse id does not exist in your account, or is not one your integration user can use.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/stock-valuation": {
      "get": {
        "tags": [
          "StockValuation"
        ],
        "summary": "Lists the current valuation of your finished-product stock: kegs, containers, cases, mix packs and complementary products.",
        "parameters": [
          {
            "name": "productId",
            "in": "query",
            "description": "Only this product. Listed by `GET /api/v1/products`. Cannot be combined with `containerId`.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "containerId",
            "in": "query",
            "description": "Only this loose container. Listed by `GET /api/v1/containers`. Cannot be combined with `productId`.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeZeroStock",
            "in": "query",
            "description": "Include lines with zero stock (a format the account sells but has none of right now). Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The valuation lines.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/StockValuationLineDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "`productId` and `containerId` were both sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Stock reports module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/stock-valuation-cost": {
      "get": {
        "tags": [
          "StockValuationCost"
        ],
        "summary": "Lists the current production-cost valuation of your finished-product stock: kegs, containers, cases, mix packs and complementary products.",
        "parameters": [
          {
            "name": "productId",
            "in": "query",
            "description": "Only this product. Listed by `GET /api/v1/products`. Cannot be combined with `containerId`.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "containerId",
            "in": "query",
            "description": "Only this loose container. Listed by `GET /api/v1/containers`. Cannot be combined with `productId`.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeZeroStock",
            "in": "query",
            "description": "Include lines with zero stock (a format the account sells but has none of right now). Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The valuation lines.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/StockCostValuationLineDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "`productId` and `containerId` were both sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Stock reports module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplier-categories": {
      "get": {
        "tags": [
          "SupplierCategories"
        ],
        "summary": "Lists the supplier categories of your account.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated categories. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of supplier categories.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierCategoryDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplier module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "SupplierCategories"
        ],
        "summary": "Creates a supplier category.",
        "description": "name is required and must be unique among your active AND inactive categories —\r\n            same rule the web application enforces.",
        "requestBody": {
          "description": "The category to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierCategoryDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierCategoryDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierCategoryDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierCategoryDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Supplier category created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierCategoryDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Supplier module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplier-categories/{supplierCategoryId}": {
      "get": {
        "tags": [
          "SupplierCategories"
        ],
        "summary": "Gets a single supplier category by id, active or not.",
        "parameters": [
          {
            "name": "supplierCategoryId",
            "in": "path",
            "description": "Supplier category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The supplier category.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierCategoryDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplier module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supplier category with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "SupplierCategories"
        ],
        "summary": "Updates a supplier category. This is a PARTIAL update: fields not present in the body\r\nkeep their current value.",
        "parameters": [
          {
            "name": "supplierCategoryId",
            "in": "path",
            "description": "Supplier category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierCategoryDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierCategoryDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierCategoryDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierCategoryDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Supplier category updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierCategoryDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Supplier module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supplier category with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplier-categories/{supplierCategoryId}/deactivate": {
      "post": {
        "tags": [
          "SupplierCategories"
        ],
        "summary": "Deactivates a supplier category. The record is never physically deleted: it keeps its\r\nhistory and stays reachable through GET /supplier-categories/{supplierCategoryId}.\r\nIdempotent.",
        "description": "No check is made for suppliers currently using this category — same as the web\r\napplication, which allows it too.",
        "parameters": [
          {
            "name": "supplierCategoryId",
            "in": "path",
            "description": "Supplier category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Supplier category deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Supplier module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supplier category with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplier-categories/{supplierCategoryId}/activate": {
      "post": {
        "tags": [
          "SupplierCategories"
        ],
        "summary": "Reactivates a previously deactivated supplier category. Idempotent.",
        "parameters": [
          {
            "name": "supplierCategoryId",
            "in": "path",
            "description": "Supplier category id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Supplier category reactivated, or already active."
          },
          "400": {
            "description": "A business rule prevents reactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Supplier module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supplier category with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplier-item-mappings": {
      "get": {
        "tags": [
          "SupplierItemMappings"
        ],
        "summary": "Lists the supplier item mappings of your account.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated mappings. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of mappings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierItemMappingDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "SupplierItemMappings"
        ],
        "summary": "Creates a supplier item mapping.",
        "description": "invoiceDescription and at least one of supplyId, serviceId, complementaryProductId,\r\nsparePartId are required — same rules the web application enforces. The description is\r\nnormalized (lowercased, accents stripped, whitespace collapsed) before being stored, same\r\nas the web application, so it compares consistently against future invoice lines.",
        "requestBody": {
          "description": "The mapping to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierItemMappingDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierItemMappingDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierItemMappingDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierItemMappingDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Mapping created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierItemMappingDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplier-item-mappings/{supplierItemMappingId}": {
      "get": {
        "tags": [
          "SupplierItemMappings"
        ],
        "summary": "Gets a single supplier item mapping by id, active or not.",
        "parameters": [
          {
            "name": "supplierItemMappingId",
            "in": "path",
            "description": "Mapping id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The mapping.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierItemMappingDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No mapping with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "SupplierItemMappings"
        ],
        "summary": "Updates a supplier item mapping. This is a PARTIAL update: fields not present in the body\r\nkeep their current value.",
        "description": "invoiceDescription is read-only after creation: sending it here has no effect, the same as\r\nthe web application, which only lets you edit the description while creating a mapping.",
        "parameters": [
          {
            "name": "supplierItemMappingId",
            "in": "path",
            "description": "Mapping id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierItemMappingDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierItemMappingDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierItemMappingDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierItemMappingDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Mapping updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierItemMappingDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No mapping with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplier-item-mappings/{supplierItemMappingId}/deactivate": {
      "post": {
        "tags": [
          "SupplierItemMappings"
        ],
        "summary": "Deactivates a supplier item mapping. The record is never physically deleted: it keeps its\r\nhistory and stays reachable through GET /supplier-item-mappings/{supplierItemMappingId}.\r\nIdempotent.",
        "parameters": [
          {
            "name": "supplierItemMappingId",
            "in": "path",
            "description": "Mapping id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Mapping deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No mapping with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplier-item-mappings/{supplierItemMappingId}/activate": {
      "post": {
        "tags": [
          "SupplierItemMappings"
        ],
        "summary": "Reactivates a previously deactivated supplier item mapping. Idempotent.",
        "parameters": [
          {
            "name": "supplierItemMappingId",
            "in": "path",
            "description": "Mapping id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Mapping reactivated, or already active."
          },
          "400": {
            "description": "A business rule prevents reactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Purchases module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No mapping with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/suppliers": {
      "get": {
        "tags": [
          "Suppliers"
        ],
        "summary": "Lists the active suppliers of your account.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over trade name, legal name, tax id or e-mails. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated suppliers. Defaults to false. Deactivated suppliers keep their history\r\nand their ids, so pass true when you are reconciling a full catalogue and need to tell\r\n\"deleted on our side\" apart from \"never existed\".",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of suppliers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplier module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or concurrency limit exceeded — see Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Suppliers"
        ],
        "summary": "Creates a supplier.",
        "description": "The same business rules the web application enforces apply here: tradeName is required, and\r\nneither taxId nor legalName may match another active supplier using the same currency.\r\nOmitting currencyId uses your account's currency.",
        "requestBody": {
          "description": "The supplier to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Supplier created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or business rule violation — read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Supplier module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/suppliers/{supplierId}": {
      "get": {
        "tags": [
          "Suppliers"
        ],
        "summary": "Gets a single supplier by id, active or not.",
        "parameters": [
          {
            "name": "supplierId",
            "in": "path",
            "description": "Supplier id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The supplier.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplier module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supplier with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Suppliers"
        ],
        "summary": "Updates a supplier. This is a PARTIAL update: fields not present in the body keep their\r\ncurrent value, so you never need to send the whole object to change a single field.",
        "description": "Sending a field with an explicit null clears it; leaving it out keeps it. The operation is\r\nidempotent: repeating the same request leaves the supplier in the same state. currencyId\r\ncannot be changed once the supplier has current-account entries.",
        "parameters": [
          {
            "name": "supplierId",
            "in": "path",
            "description": "Supplier id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Only the fields you want to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplierDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Supplier updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Supplier module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supplier with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/suppliers/{supplierId}/deactivate": {
      "post": {
        "tags": [
          "Suppliers"
        ],
        "summary": "Deactivates a supplier. The record is never physically deleted: it keeps its history and\r\nstays reachable through GET /suppliers/{supplierId}. Idempotent.",
        "parameters": [
          {
            "name": "supplierId",
            "in": "path",
            "description": "Supplier id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Supplier deactivated, or already inactive."
          },
          "400": {
            "description": "A business rule prevents deactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Supplier module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supplier with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/suppliers/{supplierId}/activate": {
      "post": {
        "tags": [
          "Suppliers"
        ],
        "summary": "Reactivates a previously deactivated supplier. Idempotent.",
        "description": "Reactivation is rejected when another active supplier already uses the same legal name:\r\nthe application would not be able to tell them apart.",
        "parameters": [
          {
            "name": "supplierId",
            "in": "path",
            "description": "Supplier id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Supplier reactivated, or already active."
          },
          "400": {
            "description": "A business rule prevents reactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Supplier module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supplier with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/suppliers/{supplierId}/products": {
      "get": {
        "tags": [
          "Suppliers"
        ],
        "summary": "Lists the products this supplier provides.",
        "description": "This is the many-to-many relation between products and suppliers, which is a different thing\r\nfrom the single `supplierId` field of a product: a product has one supplier written on\r\nit, and may additionally be provided by several. Both exist and neither replaces the other.",
        "parameters": [
          {
            "name": "supplierId",
            "in": "path",
            "description": "Supplier id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of products.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Suppliers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supplier with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Suppliers"
        ],
        "summary": "Replaces the set of products this supplier provides.",
        "description": "The whole set is replaced: products you do not send stop being linked to this supplier. The\r\nlinks are deactivated, not deleted — the relation records when it was created and is part of\r\nthe history of who supplied what.",
        "parameters": [
          {
            "name": "supplierId",
            "in": "path",
            "description": "Supplier id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The product ids, from GET /api/v1/products. An empty array clears the set.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "text/json": {
              "schema": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "application/*+json": {
              "schema": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The resulting set.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "A product id is not available to your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Suppliers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supplier with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/suppliers/{supplierId}/ledger": {
      "get": {
        "tags": [
          "Suppliers"
        ],
        "summary": "Lists the movements of a supplier's current account, newest first.",
        "description": "Read-only. Movements are generated by the system: a purchase adds to what you owe, a payment\r\nreduces it, a credit note offsets it. Registering a payment is a treasury operation with its\r\nown resource, which this version does not publish.\r\n            \r\nThe balance is cumulative and depends on the order of the movements, so each entry reports\r\nthe balance it left behind. For the current balance alone, read\r\nGET /api/v1/suppliers/{supplierId}/balance, which is one call instead of paging to the end.",
        "parameters": [
          {
            "name": "supplierId",
            "in": "path",
            "description": "Supplier id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Keep only movements on or after this date, `YYYY-MM-DD`. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Keep only movements on or before this date, `YYYY-MM-DD`. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "unreconciledOnly",
            "in": "query",
            "description": "True keeps only movements not yet reconciled. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of movements.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierLedgerEntryDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "A date is not ISO 8601, or `from` is later than `to`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Suppliers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supplier with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/suppliers/{supplierId}/balance": {
      "get": {
        "tags": [
          "Suppliers"
        ],
        "summary": "Gets what you currently owe a supplier.",
        "description": "Positive means you owe the supplier; negative means you paid in advance. The balance is in\r\nthe supplier's own currency — a supplier cannot change currency once it has movements,\r\nprecisely so this number never mixes two.",
        "parameters": [
          {
            "name": "supplierId",
            "in": "path",
            "description": "Supplier id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The balance.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierBalanceDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Suppliers module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supplier with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplies": {
      "get": {
        "tags": [
          "Supplies"
        ],
        "summary": "Lists your supplies, newest name first.",
        "description": "This is also the catalog of the `supplyId` field of a purchase line and of a recipe\r\ningredient: what this endpoint returns with the defaults is exactly what those fields accept.\r\n            \r\nIncludes the supplies that belong to the system and are shared by every account, unless your\r\naccount is set up to use only its own. `shared` tells you which is which.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Matches name and brand. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "supplyTypeId",
            "in": "query",
            "description": "Keep only supplies of this kind. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "True also returns deactivated supplies. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of supplies.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplyDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplies module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Supplies"
        ],
        "summary": "Creates a supply.",
        "description": "`name` and `supplyTypeId` are required. `unitId` decides the unit the stock is\r\n             counted in, and everything else — purchases, recipes — converts to it: a supply of kind\r\n             packaging must use the \"unit\" unit.\r\n            \r\n             If a deactivated supply with a similar name already exists, this still creates a new one.\r\n             The application asks whether to reactivate the old one instead; an API cannot ask, so it\r\n             takes you at your word. To reactivate the old one use\r\n             `POST /api/v1/supplies/{id}/activate`.",
        "requestBody": {
          "description": "The supply to create.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Supply created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplyDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplies module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplies/{supplyId}": {
      "get": {
        "tags": [
          "Supplies"
        ],
        "summary": "Gets a single supply by id.",
        "parameters": [
          {
            "name": "supplyId",
            "in": "path",
            "description": "Supply id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The supply.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplyDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplies module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supply with that id available to your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Supplies"
        ],
        "summary": "Partially updates a supply: only the fields you send change.",
        "description": "Once a supply has stock movements its `name` and `unitId` are frozen: the movements\r\nalready recorded are expressed in that unit and under that name. Its `supplyTypeId` is\r\nfrozen too, and it can never move to or from the kinds that have their own flow — packaging,\r\nkegging and yeast.\r\n            \r\nA supply that belongs to the system cannot be modified at all.",
        "parameters": [
          {
            "name": "supplyId",
            "in": "path",
            "description": "Supply id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated supply.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplyDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplies module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supply with that id available to your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplies/{supplyId}/deactivate": {
      "post": {
        "tags": [
          "Supplies"
        ],
        "summary": "Deactivates a supply.",
        "description": "Idempotent: deactivating an already inactive supply answers 200 without changing anything.\r\n            \r\nIf any recipe still uses the supply, this is rejected and the message names the recipes. That\r\nis the point where the application asks whether to go ahead; since an API cannot ask, the\r\ndecision is a parameter: `force=true` deactivates it anyway. Those recipes keep\r\ndeducting stock for the quantities they declare, so the choice is deliberate.\r\n            \r\nA supply that belongs to the system cannot be deactivated.",
        "parameters": [
          {
            "name": "supplyId",
            "in": "path",
            "description": "Supply id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "force",
            "in": "query",
            "description": "True deactivates it even when recipes still use it. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deactivated, or already inactive."
          },
          "400": {
            "description": "Recipes still use it and force was not set, or another business rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplies module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supply with that id available to your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplies/{supplyId}/activate": {
      "post": {
        "tags": [
          "Supplies"
        ],
        "summary": "Reactivates a supply.",
        "description": "Idempotent: reactivating an already active supply answers 200 without changing anything.",
        "parameters": [
          {
            "name": "supplyId",
            "in": "path",
            "description": "Supply id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Reactivated, or already active."
          },
          "400": {
            "description": "Business rule violation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplies module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supply with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplies/{supplyId}/stock": {
      "get": {
        "tags": [
          "Supplies"
        ],
        "summary": "Gets the stock of one supply, overall and per warehouse.",
        "description": "The quantities are in the supply's own unit, the one in `unitId`.\r\n            \r\n`byWarehouse` is empty when your account does not use multiple supply warehouses; then\r\n`total` is the whole answer.",
        "parameters": [
          {
            "name": "supplyId",
            "in": "path",
            "description": "Supply id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The stock.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplyStockDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplies Stock module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supply with that id available to your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplies/{supplyId}/stock/adjustments": {
      "post": {
        "tags": [
          "Supplies"
        ],
        "summary": "Records a manual stock adjustment for one supply: an entry or an exit.",
        "description": "The sign of `quantity` decides the direction: positive enters stock, negative takes\r\nit out. This is the manual counterpart of a purchase line that stocks a supply — for a\r\nphysical count that fixes stock to an absolute value instead of moving it by a delta, use\r\n`POST /api/v1/supplies/{id}/stock/counts`.\r\n            \r\nRejected if the movement date is more than 30 days in the past, if the resulting quantity\r\nor stock would leave the account's supported range, or — when the account blocks negative\r\nstock — if it would take the supply below zero.",
        "parameters": [
          {
            "name": "supplyId",
            "in": "path",
            "description": "Supply id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The quantity to move — its sign decides the direction — and where.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyStockAdjustmentDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyStockAdjustmentDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyStockAdjustmentDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyStockAdjustmentDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The supply's updated stock.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplyStockDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplies Stock or Stock module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supply with that id available to your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplies/{supplyId}/stock/counts": {
      "post": {
        "tags": [
          "Supplies"
        ],
        "summary": "Records a physical stock count for one supply: sets stock to the counted quantity.",
        "description": "`quantity` is what you counted, not a delta: it replaces the current stock instead of\r\n             moving it. This is the counterpart of the physical stock count screen — for an entry or an\r\n             exit relative to current stock, use `POST /api/v1/supplies/{id}/stock/adjustments`\r\n             instead.\r\n            \r\n             Rejected if the movement date is more than 30 days in the past, if the resulting quantity\r\n             or stock would leave the account's supported range, or — when the account blocks negative\r\n             stock — if it would take the supply below zero.",
        "parameters": [
          {
            "name": "supplyId",
            "in": "path",
            "description": "Supply id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The quantity actually counted — an absolute value — and where.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyStockCountDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyStockCountDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyStockCountDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyStockCountDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The supply's updated stock.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplyStockDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplies Stock or Stock module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supply with that id available to your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplies/{supplyId}/convertible-units": {
      "get": {
        "tags": [
          "Supplies"
        ],
        "summary": "Gets the units a quantity of this supply may be expressed in.",
        "description": "Not the same as `GET /api/v1/units`, which lists every unit in the system. A quantity of\r\nthis supply can only be sent in a unit that converts to its base one: kilos and grams convert\r\nto each other, litres do not convert to kilos, and a purchase line in a unit that does not\r\nconvert is rejected. Read this before sending a quantity in anything other than the base unit.",
        "parameters": [
          {
            "name": "supplyId",
            "in": "path",
            "description": "Supply id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The convertible units.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplyConvertibleUnitsDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplies module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supply with that id available to your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplies/{supplyId}/batches": {
      "get": {
        "tags": [
          "Supplies"
        ],
        "summary": "Lists the external lots of one supply, newest first.",
        "description": "Read-only, and not for lack of trying: external lots have no screen and no create path of\r\ntheir own. They are recorded by saving a purchase, from the `externalLots` field of each\r\nline, and they are consumed by brewing a batch or running a packaging job.\r\n            \r\nSo this is the traceability view: which lot numbers came in, on which purchase, and which\r\nbatches and packaging runs used them. To record one, send it on a line of\r\n`POST /api/v1/purchases`.",
        "parameters": [
          {
            "name": "supplyId",
            "in": "path",
            "description": "Supply id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "True also returns lots switched off by a cancelled purchase. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The external lots.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SupplyExternalLotDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplies Stock module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No supply with that id available to your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supplies/projection": {
      "get": {
        "tags": [
          "Supplies"
        ],
        "summary": "Projects the stock of the supplies of one kind, day by day.",
        "description": "Starts today and covers as many days as your account's configuration says. It takes current\r\nstock, subtracts what the planned batches will use on the day they are due to be brewed, and\r\nadds what is due to arrive. A negative value means the plan would run that supply out.\r\n            \r\n⚠️ Every series comes back in the SAME unit — the one in `unitId`, which is the unit of\r\nthe first supply of the list. That is what the application does, and it means a supply\r\ncounted in litres appears converted when the first one is counted in kilos.\r\n            \r\nThis is the most expensive read published: it walks the planned batches, their recipes and\r\nthe open purchase orders. Do not poll it.",
        "parameters": [
          {
            "name": "supplyTypeId",
            "in": "query",
            "description": "The kind of supply to project. Required.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "warehouseId",
            "in": "query",
            "description": "Project only this warehouse. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeTasks",
            "in": "query",
            "description": "True also counts what the tasks of planned batches will consume. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "onlyRecipeSupplies",
            "in": "query",
            "description": "True projects only the supplies that appear in the recipes of planned batches. Defaults to true.",
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "includePurchaseOrders",
            "in": "query",
            "description": "True adds what is due to arrive on purchase orders. Defaults to true.",
            "schema": {
              "type": "boolean",
              "default": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The projection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplyProjectionDto"
                }
              }
            }
          },
          "400": {
            "description": "supplyTypeId is missing or outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supplies Projection module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supply-warehouses": {
      "get": {
        "tags": [
          "SupplyWarehouses"
        ],
        "summary": "Lists your supply warehouses, by name.",
        "description": "This is also the catalog of the `supplyWarehouseId` field of a purchase line and of a\r\nbatch: what this endpoint returns with the defaults is exactly what those fields accept.\r\n            \r\nEmpty when your account does not use multiple supply warehouses. That is not an error: where\r\nthe feature is off there is nowhere to put a warehouse id, and the field is left out.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Matches name, code and city. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "True also returns deactivated warehouses. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of warehouses, possibly empty.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplyWarehouseDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supply Warehouses module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "SupplyWarehouses"
        ],
        "summary": "Creates a supply warehouse.",
        "description": "`name` is required. Rejected with 400 when your account does not use multiple supply\r\n            warehouses.",
        "requestBody": {
          "description": "The warehouse to create.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyWarehouseDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyWarehouseDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyWarehouseDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyWarehouseDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Warehouse created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplyWarehouseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, feature not enabled, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Supply Warehouses module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supply-warehouses/{warehouseId}": {
      "get": {
        "tags": [
          "SupplyWarehouses"
        ],
        "summary": "Gets a single supply warehouse by id.",
        "parameters": [
          {
            "name": "warehouseId",
            "in": "path",
            "description": "Warehouse id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The warehouse.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplyWarehouseDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supply Warehouses module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No warehouse with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "SupplyWarehouses"
        ],
        "summary": "Partially updates a supply warehouse: only the fields you send change.",
        "description": "`latitude` and `longitude` are the one exception to \"null clears it\": they are\r\n            stored as numbers with `0` meaning \"not set\", so sending null resets them to `0`.",
        "parameters": [
          {
            "name": "warehouseId",
            "in": "path",
            "description": "Warehouse id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyWarehouseDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyWarehouseDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyWarehouseDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyWarehouseDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated warehouse.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplyWarehouseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, feature not enabled, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Supply Warehouses module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No warehouse with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supply-warehouses/{warehouseId}/deactivate": {
      "post": {
        "tags": [
          "SupplyWarehouses"
        ],
        "summary": "Deactivates a supply warehouse.",
        "description": "Idempotent: deactivating an already inactive warehouse answers 200 without changing anything.\r\n            \r\nThe stock recorded against it is not moved anywhere. That mirrors the application, which\r\ndeactivates the warehouse and leaves its movements on record.",
        "parameters": [
          {
            "name": "warehouseId",
            "in": "path",
            "description": "Warehouse id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deactivated, or already inactive."
          },
          "400": {
            "description": "Feature not enabled, or another business rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Supply Warehouses module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No warehouse with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supply-warehouses/{warehouseId}/activate": {
      "post": {
        "tags": [
          "SupplyWarehouses"
        ],
        "summary": "Reactivates a supply warehouse.",
        "description": "Idempotent: reactivating an already active warehouse answers 200 without changing anything.",
        "parameters": [
          {
            "name": "warehouseId",
            "in": "path",
            "description": "Warehouse id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Reactivated, or already active."
          },
          "400": {
            "description": "Feature not enabled, or another business rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Supply Warehouses module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No warehouse with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supply-warehouses/{warehouseId}/supplies": {
      "get": {
        "tags": [
          "SupplyWarehouses"
        ],
        "summary": "Lists the supplies held in one warehouse, with their stock.",
        "description": "Only supplies that have stock there. The `stock` of each one is its quantity in THIS\r\nwarehouse, not its total: for the total read `GET /api/v1/supplies/{id}/stock`.",
        "parameters": [
          {
            "name": "warehouseId",
            "in": "path",
            "description": "Warehouse id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The supplies.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SupplyDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Supply Warehouses module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No warehouse with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/supply-warehouses/{warehouseId}/transfers": {
      "post": {
        "tags": [
          "SupplyWarehouses"
        ],
        "summary": "Transfers one or more supplies from this warehouse to another.",
        "description": "Same underlying delivery note (`Remito`) the application's own screen creates —\r\n`DepositoInsumoService.RealizarMovimientoEntreDepositos`, wired directly: unlike the\r\nproduct/packaging transfer (`POST /stock-movements`), this one needed no new\r\naggregation method, because a supply's stock is not split by purchase lot the way a\r\nproduct's container stock is.",
        "parameters": [
          {
            "name": "warehouseId",
            "in": "path",
            "description": "Source warehouse id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Destination warehouse and the supplies to move.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyTransferRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyTransferRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyTransferRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SupplyTransferRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The transfer created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplyTransferDto"
                }
              }
            }
          },
          "400": {
            "description": "Missing/empty lines, a non-positive quantity, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Warehouse Movements module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "A warehouse id does not exist in your account, or the feature is off.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tanks": {
      "get": {
        "tags": [
          "Tanks"
        ],
        "summary": "Lists your tanks, by name.",
        "description": "This is also the catalog of the `tankId` field of a batch or a task: what this\r\nendpoint returns with the defaults is exactly what that field accepts. Every active tank\r\nis listed, not only the free ones — a batch already fermenting references the tank it\r\noccupies.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Matches the name. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated tanks. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of tanks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TankDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tanks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Tanks"
        ],
        "summary": "Creates a tank.",
        "description": "`name` and `tankTypeId` are required — a tank is either a fermenter, a maturer\r\n            or a barrel, and there is no sensible default for the type. The tank is created empty:\r\n            `status` starts at `empty` and cannot be set otherwise.",
        "requestBody": {
          "description": "The tank to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/TankDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TankDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/TankDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/TankDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Tank created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TankDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tanks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tanks/{tankId}": {
      "get": {
        "tags": [
          "Tanks"
        ],
        "summary": "Gets a single tank by id, active or not.",
        "parameters": [
          {
            "name": "tankId",
            "in": "path",
            "description": "Tank id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The tank.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TankDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tanks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No tank with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Tanks"
        ],
        "summary": "Partially updates a tank: only the fields you send change.",
        "description": "`status` and `active` are read-only and ignored here. Neither `liters` nor\r\n            `tankTypeId` can change while the tank is assigned to a batch that has not finished —\r\n            the same rule the application enforces.",
        "parameters": [
          {
            "name": "tankId",
            "in": "path",
            "description": "Tank id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/TankDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TankDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/TankDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/TankDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated tank.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TankDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tanks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No tank with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tanks/{tankId}/deactivate": {
      "post": {
        "tags": [
          "Tanks"
        ],
        "summary": "Deactivates a tank. The record is never physically deleted: it keeps its history and\r\nstays reachable through GET /tanks/{tankId}. Idempotent.",
        "description": "Rejected while the tank is assigned to a batch that has not finished — same rule as the\r\napplication.",
        "parameters": [
          {
            "name": "tankId",
            "in": "path",
            "description": "Tank id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tank deactivated, or already inactive."
          },
          "400": {
            "description": "A business rule prevents deactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tanks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No tank with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tanks/{tankId}/activate": {
      "post": {
        "tags": [
          "Tanks"
        ],
        "summary": "Reactivates a previously deactivated tank. Idempotent.",
        "parameters": [
          {
            "name": "tankId",
            "in": "path",
            "description": "Tank id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tank reactivated, or already active."
          },
          "400": {
            "description": "A business rule prevents reactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tanks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No tank with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tap-systems": {
      "get": {
        "tags": [
          "TapSystems"
        ],
        "summary": "Lists your tap systems, by id.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Matches the code or name. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "description": "Keep only tap systems currently at this customer. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "True also returns deactivated tap systems. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of tap systems.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TapSystemDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tap Systems module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "TapSystems"
        ],
        "summary": "Creates a tap system.",
        "description": "`code` is required.",
        "requestBody": {
          "description": "The tap system to create.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/TapSystemDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TapSystemDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/TapSystemDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/TapSystemDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Tap system created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TapSystemDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tap Systems module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tap-systems/{tapSystemId}": {
      "get": {
        "tags": [
          "TapSystems"
        ],
        "summary": "Gets a single tap system by id.",
        "parameters": [
          {
            "name": "tapSystemId",
            "in": "path",
            "description": "Tap system id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The tap system.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TapSystemDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tap Systems module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No tap system with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "TapSystems"
        ],
        "summary": "Partially updates a tap system: only the fields you send change.",
        "parameters": [
          {
            "name": "tapSystemId",
            "in": "path",
            "description": "Tap system id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/TapSystemDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TapSystemDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/TapSystemDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/TapSystemDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated tap system.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TapSystemDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tap Systems module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No tap system with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tap-systems/{tapSystemId}/deactivate": {
      "post": {
        "tags": [
          "TapSystems"
        ],
        "summary": "Deactivates a tap system.",
        "description": "Idempotent: deactivating an already inactive tap system answers 200 without changing anything.",
        "parameters": [
          {
            "name": "tapSystemId",
            "in": "path",
            "description": "Tap system id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deactivated, or already inactive."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tap Systems module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No tap system with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tap-systems/{tapSystemId}/activate": {
      "post": {
        "tags": [
          "TapSystems"
        ],
        "summary": "Reactivates a tap system.",
        "description": "Idempotent: reactivating an already active tap system answers 200 without changing anything.",
        "parameters": [
          {
            "name": "tapSystemId",
            "in": "path",
            "description": "Tap system id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Reactivated, or already active."
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tap Systems module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No tap system with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tap-systems/deliveries": {
      "post": {
        "tags": [
          "TapSystems"
        ],
        "summary": "Delivers one or more tap systems to a customer, for the first time.",
        "description": "Rama conservadora: solo acepta tap systems, nunca los productos complementarios que la\r\npantalla web deja mezclar en la misma entrega — ver el `remarks` de\r\nGCerv.Api.Dto.TapSystemDeliveryRequestDto.",
        "requestBody": {
          "description": "Destination customer and the tap systems to deliver.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/TapSystemDeliveryRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TapSystemDeliveryRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/TapSystemDeliveryRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/TapSystemDeliveryRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The delivery note created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TapSystemDeliveryDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tap System Deliveries/Returns module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "The customer, or a tap system in the body, doesn't exist in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "TapSystems"
        ],
        "summary": "Lists your tap system delivery notes.",
        "description": "Lines aren't included in the listing — get one delivery note by id for its lines.",
        "parameters": [
          {
            "name": "customerId",
            "in": "query",
            "description": "Keep only deliveries to this customer. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "True also returns voided delivery notes. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of delivery notes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TapSystemDeliveryDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tap System Deliveries/Returns module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tap-systems/returns": {
      "post": {
        "tags": [
          "TapSystems"
        ],
        "summary": "A customer returning one or more tap systems.",
        "requestBody": {
          "description": "The tap systems being returned.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/TapSystemReturnRequestDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TapSystemReturnRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/TapSystemReturnRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/TapSystemReturnRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The returned tap systems.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TapSystemDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or a tap system isn't currently at a customer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tap System Deliveries/Returns module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "A tap system in the body doesn't exist in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tap-systems/deliveries/{deliveryId}": {
      "get": {
        "tags": [
          "TapSystems"
        ],
        "summary": "Gets a single delivery note by id, with its lines.",
        "parameters": [
          {
            "name": "deliveryId",
            "in": "path",
            "description": "Delivery note id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The delivery note.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TapSystemDeliveryDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tap System Deliveries/Returns module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No delivery note with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tap-systems/deliveries/{deliveryId}/void": {
      "post": {
        "tags": [
          "TapSystems"
        ],
        "summary": "Voids a delivery note, reverting every tap system on it as if it were never delivered.",
        "description": "Idempotent: voiding an already voided delivery note answers 200 without changing anything.",
        "parameters": [
          {
            "name": "deliveryId",
            "in": "path",
            "description": "Delivery note id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Voided, or already voided.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TapSystemDeliveryDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tap System Deliveries/Returns module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No delivery note with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/task-definitions": {
      "get": {
        "tags": [
          "TaskDefinitions"
        ],
        "summary": "Lists the task definitions available to your account, including the shared ones.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Free text over the name. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupsOnly",
            "in": "query",
            "description": "True lists only groups, false only plain definitions; omit it to list both.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated definitions. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of task definitions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDefinitionDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tasks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or concurrency limit exceeded — see Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "TaskDefinitions"
        ],
        "summary": "Creates a task definition.",
        "description": "The name is required and must not match another active definition of your account.\r\n            \r\nSend `isGroup: true` together with `childTaskIds` to create a group: the batch it\r\nis added to gets every definition in the group.",
        "requestBody": {
          "description": "The definition to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDefinitionDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDefinitionDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDefinitionDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDefinitionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Task definition created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDefinitionDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tasks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/task-definitions/{taskDefinitionId}": {
      "get": {
        "tags": [
          "TaskDefinitions"
        ],
        "summary": "Gets a single task definition by id, active or not.",
        "parameters": [
          {
            "name": "taskDefinitionId",
            "in": "path",
            "description": "Task definition id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The task definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDefinitionDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tasks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No task definition with that id available to your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "TaskDefinitions"
        ],
        "summary": "Partially updates a task definition: only the fields you send change.",
        "description": "A shared definition — one with `isShared: true` — cannot be modified: it belongs to\r\nevery account, so changing it here would change it for all of them.\r\n            \r\nSending `childTaskIds` replaces the whole group; omitting it keeps the current members.",
        "parameters": [
          {
            "name": "taskDefinitionId",
            "in": "path",
            "description": "Task definition id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDefinitionDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDefinitionDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDefinitionDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDefinitionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDefinitionDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, a shared definition, or a business rule violation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tasks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No task definition with that id available to your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/task-definitions/{taskDefinitionId}/deactivate": {
      "post": {
        "tags": [
          "TaskDefinitions"
        ],
        "summary": "Deactivates a task definition. The record is never physically deleted: it keeps its history\r\nand stays reachable through GET /task-definitions/{taskDefinitionId}. Idempotent.",
        "description": "Deactivating a group also deactivates its membership links, so the definitions it contained\r\nstop being pulled in with it. A shared definition cannot be deactivated.",
        "parameters": [
          {
            "name": "taskDefinitionId",
            "in": "path",
            "description": "Task definition id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Definition deactivated, or already inactive."
          },
          "400": {
            "description": "A business rule prevents deactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tasks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No task definition with that id available to your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/task-definitions/{taskDefinitionId}/activate": {
      "post": {
        "tags": [
          "TaskDefinitions"
        ],
        "summary": "Reactivates a previously deactivated task definition. Idempotent.",
        "description": "Reactivation is rejected when an active definition already uses the same name — including a\r\nshared one, which would leave two identical names in every selector.",
        "parameters": [
          {
            "name": "taskDefinitionId",
            "in": "path",
            "description": "Task definition id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Definition reactivated, or already active."
          },
          "400": {
            "description": "A business rule prevents reactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tasks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No task definition with that id available to your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tasks": {
      "get": {
        "tags": [
          "Tasks"
        ],
        "summary": "Lists the standalone tasks of your account, most recent due date first.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "description": "Keep only tasks due on or after this date, `YYYY-MM-DD`. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Keep only tasks due on or before this date, `YYYY-MM-DD`. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "completed",
            "in": "query",
            "description": "True keeps only completed tasks, false only pending; omit for both.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "Include deactivated tasks. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "A date is not ISO 8601, or `from` is later than `to`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tasks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or concurrency limit exceeded — see Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Tasks"
        ],
        "summary": "Creates a standalone task.",
        "description": "`taskDefinitionId` and `dueDate` are required. The due date cannot be in the past:\r\n             today is accepted.\r\n            \r\n             Omitting `name` takes the definition's name, so a caller that only knows which task to\r\n             schedule and when does not have to invent one.",
        "requestBody": {
          "description": "The task to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Task created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tasks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tasks/{taskId}": {
      "get": {
        "tags": [
          "Tasks"
        ],
        "summary": "Gets a single standalone task by id, active or not.",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "description": "Task id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tasks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No task with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Tasks"
        ],
        "summary": "Partially updates a standalone task: only the fields you send change.",
        "description": "The due date still cannot be in the past. A completed task can be edited: completing it\r\nrecords who and when, and that is not undone by changing its notes.",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "description": "Task id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tasks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No task with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tasks/{taskId}/complete": {
      "post": {
        "tags": [
          "Tasks"
        ],
        "summary": "Completes a standalone task.",
        "description": "A task already completed is rejected, and so is a task assigned to another user unless the\r\nintegration user may see everyone's tasks. Who completed it and when are taken from the\r\ntoken and the server clock, never from the body.\r\n            \r\nCompleting a task does NOT take its supplies out of stock, even when its definition says it\r\nshould: the quantities come from a sub-resource this version does not publish.",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "description": "Task id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "What to record. Every field is optional; an empty body is valid.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/TaskCompletionDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskCompletionDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskCompletionDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/TaskCompletionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The completed task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDto"
                }
              }
            }
          },
          "400": {
            "description": "The task is already complete or belongs to someone else. Read message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tasks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No task with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tasks/{taskId}/deactivate": {
      "post": {
        "tags": [
          "Tasks"
        ],
        "summary": "Deactivates a standalone task. The record is never physically deleted: it keeps its history\r\nand stays reachable through GET /tasks/{taskId}. Idempotent.",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "description": "Task id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Task deactivated, or already inactive."
          },
          "400": {
            "description": "A business rule prevents deactivation. Read message. Do not retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Tasks module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No task with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/warehouses": {
      "get": {
        "tags": [
          "Warehouses"
        ],
        "summary": "Lists your warehouses, by name.",
        "description": "This is also the catalog of the `warehouseId` field of a purchase line: what this\r\nendpoint returns with the defaults is exactly what that field accepts.\r\n            \r\nThe set is the one your integration user is allowed to use, which may be narrower than every\r\nwarehouse your account has. Cold rooms are included — read `warehouseTypeId` to tell\r\nthem apart, and `GET /api/v1/warehouse-types` for the kinds.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Matches name, code and city. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeInactive",
            "in": "query",
            "description": "True also returns deactivated warehouses. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of warehouses.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WarehouseDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Warehouses module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Warehouses"
        ],
        "summary": "Creates a warehouse.",
        "description": "`name`, `code` and `warehouseTypeId` are all required. A warehouse is either\r\n            a plain warehouse or a cold room and there is no sensible default for the type. `main`\r\n            is ignored — a warehouse created through the API is never the main one, exactly as in the\r\n            application.",
        "requestBody": {
          "description": "The warehouse to create.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/WarehouseDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WarehouseDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/WarehouseDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/WarehouseDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Warehouse created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WarehouseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Warehouses module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/warehouses/{warehouseId}": {
      "get": {
        "tags": [
          "Warehouses"
        ],
        "summary": "Gets a single warehouse by id.",
        "description": "404 also when the warehouse exists but your integration user is not allowed to use it — see\r\nthe note on the resource.",
        "parameters": [
          {
            "name": "warehouseId",
            "in": "path",
            "description": "Warehouse id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The warehouse.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WarehouseDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Warehouses module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No warehouse with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Warehouses"
        ],
        "summary": "Partially updates a warehouse: only the fields you send change.",
        "description": "`latitude` and `longitude` are the one exception to \"null clears it\": they are\r\n             stored as numbers with `0` meaning \"not set\", so sending null resets them to `0`.\r\n            \r\n             `main` and `active` are read-only and ignored here; the users assigned to the\r\n             warehouse are out of v1 and this call leaves them exactly as they were.\r\n            \r\n             `name` and `code` cannot be cleared: omit them to keep the current value. On the\r\n             warehouse your account treats as its main one, `warehouseTypeId` cannot change — a\r\n             cold room becoming a plain warehouse, or the other way around, changes where it shows up\r\n             across the application, and the main warehouse is not the place to do that silently.",
        "parameters": [
          {
            "name": "warehouseId",
            "in": "path",
            "description": "Warehouse id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/WarehouseDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WarehouseDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/WarehouseDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/WarehouseDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated warehouse.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WarehouseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Create/Edit Warehouses module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No warehouse with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/warehouses/{warehouseId}/deactivate": {
      "post": {
        "tags": [
          "Warehouses"
        ],
        "summary": "Deactivates a warehouse.",
        "description": "Idempotent: deactivating an already inactive warehouse answers 200 without changing anything.\r\n            \r\nThe warehouse your account treats as its main one cannot be deactivated — same rule as the\r\napplication, answers `400`.\r\n            \r\n⚠️ It also **permanently deletes** which users were assigned to the warehouse. That is what\r\nthe application does, and reactivating the warehouse does not bring the assignments back:\r\nthey have to be set again by hand.\r\n            \r\nThe stock recorded against it is not moved anywhere.",
        "parameters": [
          {
            "name": "warehouseId",
            "in": "path",
            "description": "Warehouse id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deactivated, or already inactive."
          },
          "400": {
            "description": "A business rule rejected it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Warehouses module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No warehouse with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/warehouses/{warehouseId}/activate": {
      "post": {
        "tags": [
          "Warehouses"
        ],
        "summary": "Reactivates a warehouse.",
        "description": "Idempotent: reactivating an already active warehouse answers 200 without changing anything.\r\n            \r\nThe users that were assigned to it before the deactivation are not restored — see the note\r\non `/deactivate`.",
        "parameters": [
          {
            "name": "warehouseId",
            "in": "path",
            "description": "Warehouse id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Reactivated, or already active."
          },
          "400": {
            "description": "A business rule rejected it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Delete Warehouses module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No warehouse with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/waste-groups": {
      "get": {
        "tags": [
          "WasteGroups"
        ],
        "summary": "Lists the waste groups of your account.",
        "description": "The listing omits productIds — one extra query per row. Read GET /waste-groups/{id} for\r\nthe membership of a specific group. productCount is still included.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of waste groups.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WasteGroupDtoPaged"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Sales Projection module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "WasteGroups"
        ],
        "summary": "Creates a waste group.",
        "description": "name and wastePercentage are required. productIds is optional on create — a group may\r\nstart empty and have products added with a later PUT.",
        "requestBody": {
          "description": "The group to create. Any id sent in the body is ignored.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/WasteGroupDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WasteGroupDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/WasteGroupDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/WasteGroupDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Waste group created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WasteGroupDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Sales Projection module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/waste-groups/{wasteGroupId}": {
      "get": {
        "tags": [
          "WasteGroups"
        ],
        "summary": "Gets a single waste group by id, active or not, with its product membership.",
        "parameters": [
          {
            "name": "wasteGroupId",
            "in": "path",
            "description": "Waste group id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The waste group.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WasteGroupDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Sales Projection module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No waste group with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "WasteGroups"
        ],
        "summary": "Partially updates a waste group: only the fields you send change.",
        "description": "productIds absent leaves the current membership untouched; present (even an empty array)\r\nreplaces it entirely. productCount, active are read-only and ignored.",
        "parameters": [
          {
            "name": "wasteGroupId",
            "in": "path",
            "description": "Waste group id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to change.",
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/WasteGroupDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WasteGroupDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/WasteGroupDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/WasteGroupDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated group.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WasteGroupDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, business rule violation, or an id outside its catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Sales Projection module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No waste group with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/withholdings": {
      "get": {
        "tags": [
          "Withholdings"
        ],
        "summary": "Lists the withholdings of your account.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "description": "Keep only withholdings recorded on or after this date, `YYYY-MM-DD`. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Keep only withholdings recorded on or before this date, `YYYY-MM-DD`. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "active",
            "in": "query",
            "description": "Filter by active/reversed state. Omit to get both.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "purchaseId",
            "in": "query",
            "description": "Filter by the purchase (GET /api/v1/purchases) it was applied to. Optional.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Defaults to 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Page size. Defaults to 50, capped at 200.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of withholdings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WithholdingDtoPaged"
                }
              }
            }
          },
          "400": {
            "description": "A date is not ISO 8601, or `from` is later than `to`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Reports module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/withholdings/{withholdingId}": {
      "get": {
        "tags": [
          "Withholdings"
        ],
        "summary": "Gets a single withholding by id, active or not.",
        "parameters": [
          {
            "name": "withholdingId",
            "in": "path",
            "description": "Withholding id.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The withholding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WithholdingDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The integration user lacks the Reports module.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No withholding with that id in your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AccountDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Your account id — same value as the `id` field of `POST /auth/login`'s `account`.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Trade name.",
            "nullable": true
          },
          "legalName": {
            "type": "string",
            "description": "Legal name. Required.",
            "nullable": true
          },
          "taxId": {
            "type": "string",
            "description": "Tax id (CUIT or the local equivalent).",
            "nullable": true
          },
          "taxConditionId": {
            "type": "integer",
            "description": "Tax condition. Allowed values: GET /api/v1/tax-conditions.",
            "format": "int32",
            "nullable": true
          },
          "address": {
            "type": "string",
            "description": "Street address.",
            "nullable": true
          },
          "city": {
            "type": "string",
            "description": "City.",
            "nullable": true
          },
          "provinceId": {
            "type": "integer",
            "description": "Province, state or region. Allowed values: GET /api/v1/provinces.",
            "format": "int32",
            "nullable": true
          },
          "phones": {
            "type": "string",
            "description": "Free-text phone number(s).",
            "nullable": true
          },
          "emails": {
            "type": "string",
            "description": "Free-text email address(es).",
            "nullable": true
          },
          "contactName": {
            "type": "string",
            "description": "Contact person.",
            "nullable": true
          },
          "timeZone": {
            "type": "string",
            "description": "IANA time zone id. Defaults to your country's when never set.",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "description": "Free-form notes.",
            "nullable": true
          },
          "logoUrl": {
            "type": "string",
            "description": "Read-only in this version. There is no file-upload endpoint anywhere in this API yet.",
            "nullable": true
          },
          "country": {
            "type": "string",
            "description": "Read-only. Fixed at account creation.",
            "nullable": true
          },
          "planId": {
            "type": "integer",
            "description": "Read-only. Changes only through dedicated billing flows, never through this endpoint.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Your account — the brewery, distillery, cidery or distributor using this API."
      },
      "AssignCustomerCategoryRequestDto": {
        "type": "object",
        "properties": {
          "categoryId": {
            "type": "integer",
            "description": "Required. Allowed values: GET /api/v1/customer-categories.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "Request body to assign a category to a customer."
      },
      "AssignSalesRepRequestDto": {
        "type": "object",
        "properties": {
          "salesRepId": {
            "type": "integer",
            "description": "The user to assign. Omit or send `null` to unassign.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Body of `POST /leads/{id}/assign-sales-rep`."
      },
      "AuditEntryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Audit entry id.",
            "format": "int32"
          },
          "entityType": {
            "type": "string",
            "description": "The internal name of the entity type that changed, e.g. `\"Cliente\"`, `\"Producto\"`.",
            "nullable": true
          },
          "entityId": {
            "type": "integer",
            "description": "The id of the changed record, within its own entity type.",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "description": "When the change happened, ISO 8601.",
            "nullable": true
          },
          "userId": {
            "type": "integer",
            "description": "Id of the user who made the change.",
            "format": "int32"
          },
          "userName": {
            "type": "string",
            "description": "Display name of the user who made the change.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One change logged against an entity. Read-only, metadata only — no diff of the actual\r\nfield values (`previousJson`/`newJson` are not published yet, pending a security\r\ndecision on which entities are safe to expose in full; see AU.3 in the plan)."
      },
      "AuditEntryDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AuditEntryDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "BankAccountDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Bank account id. Assigned by the server; ignored on update.",
            "format": "int32"
          },
          "cbu": {
            "type": "string",
            "description": "CBU/IBAN-style account number.",
            "nullable": true
          },
          "alias": {
            "type": "string",
            "description": "Alias for the CBU, when the bank supports one.",
            "nullable": true
          },
          "number": {
            "type": "string",
            "description": "Account number as shown to the account holder.",
            "nullable": true
          },
          "bankId": {
            "type": "integer",
            "description": "Bank. Required on create. Allowed values: GET /api/v1/banks.",
            "format": "int32"
          },
          "accountTypeId": {
            "type": "integer",
            "description": "Account type. Required on create. Allowed values: GET /api/v1/bank-account-types.",
            "format": "int32"
          },
          "branch": {
            "type": "string",
            "description": "Branch name.",
            "nullable": true
          },
          "address": {
            "type": "string",
            "description": "Branch address.",
            "nullable": true
          },
          "currencyId": {
            "type": "integer",
            "description": "Currency of the account. Required on create. Allowed values: GET /api/v1/currencies.",
            "format": "int32"
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A bank account of your brewery."
      },
      "BankAccountDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BankAccountDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "BankMovementCreateDto": {
        "type": "object",
        "properties": {
          "typeId": {
            "type": "integer",
            "description": "Whether the movement is an income or an expense. Required. Allowed values:\r\nGET /api/v1/bank-movement-types.",
            "format": "int32"
          },
          "chartOfAccountId": {
            "type": "integer",
            "description": "The chart-of-accounts entry this movement posts to. Required. Allowed values:\r\nGET /api/v1/chart-of-accounts.",
            "format": "int32"
          },
          "bankPaymentTypeId": {
            "type": "integer",
            "description": "How the money moved. Required. Allowed values: GET /api/v1/bank-payment-types.",
            "format": "int32"
          },
          "amount": {
            "type": "number",
            "description": "Amount of the movement, always POSITIVE. Whether it adds to or subtracts from the\r\naccount's balance is decided by `typeId`, not by the sign you send.",
            "format": "double"
          },
          "date": {
            "type": "string",
            "description": "Date of the movement, ISO 8601 (yyyy-MM-dd). Required. Cannot be in the future.",
            "nullable": true
          },
          "description": {
            "maxLength": 500,
            "minLength": 0,
            "type": "string",
            "description": "What the movement is. Optional, defaults to empty.",
            "nullable": true
          },
          "reference": {
            "maxLength": 100,
            "minLength": 0,
            "type": "string",
            "description": "Free-text reference. Optional.",
            "nullable": true
          },
          "customerId": {
            "type": "integer",
            "description": "The customer whose current account this movement belongs to. Only valid on an income.\r\nOptional: a movement with neither customer nor supplier touches no current account.\r\nAllowed values: GET /api/v1/customers.",
            "format": "int32",
            "nullable": true
          },
          "supplierId": {
            "type": "integer",
            "description": "The supplier whose current account this movement belongs to. Only valid on an expense.\r\nOptional. Allowed values: GET /api/v1/suppliers.",
            "format": "int32",
            "nullable": true
          },
          "exchangeRate": {
            "type": "number",
            "description": "Exchange rate to apply. REQUIRED when the customer's or supplier's currency differs from\r\nthe bank account's currency: without it the amount posted to their current account would\r\nbe in the wrong currency. Always the value of 1 unit of the foreign currency in the local\r\ncurrency (e.g. 1450 for USD 1 = ARS 1450), whether the foreign currency is the account's or\r\nthe customer's/supplier's.",
            "format": "double",
            "nullable": true
          },
          "accountingDate": {
            "type": "string",
            "description": "Accounting date, ISO 8601, when it differs from `date`. Optional.",
            "nullable": true
          },
          "currentAccountNotes": {
            "maxLength": 500,
            "minLength": 0,
            "type": "string",
            "description": "Note to store on the current account entry. Optional, and ignored when neither\r\n            `customerId` nor `supplierId` is sent.",
            "nullable": true
          },
          "generateVoucher": {
            "type": "boolean",
            "description": "Whether to issue the voucher for this movement. Defaults to `false`.\r\n            \r\nOn an income with a `customerId` it issues a RECEIPT, readable afterwards at\r\nGET /api/v1/receipts. On an expense with a `supplierId` it issues a PAYMENT ORDER,\r\nreadable at GET /api/v1/payment-orders. Either way the new document's id comes back on the\r\nmovement, as `receiptId` or `paymentOrderId`.\r\n            \r\nRequires a counterparty: asking for a voucher on a movement with neither\r\n`customerId` nor `supplierId` is rejected. The voucher is issued once, with the\r\nmovement — there is no way to issue one for a movement recorded earlier."
          }
        },
        "additionalProperties": false,
        "description": "Body of POST /api/v1/bank-accounts/{bankAccountId}/movements."
      },
      "BankMovementDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Movement id.",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "description": "Date of the movement.",
            "format": "date-time"
          },
          "typeId": {
            "type": "integer",
            "description": "Whether this movement is an income or an expense. Allowed values: GET /api/v1/bank-movement-types.",
            "format": "int32"
          },
          "description": {
            "type": "string",
            "description": "What the movement is. Free text written by whoever generated it.",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "description": "Amount, SIGNED: positive on an income, negative on an expense. Read it together with\r\n`typeId`, which says the same thing without relying on the sign.",
            "format": "double"
          },
          "balance": {
            "type": "number",
            "description": "Balance after this movement.",
            "format": "double"
          },
          "previousBalance": {
            "type": "number",
            "description": "Balance before this movement.",
            "format": "double"
          },
          "currencyId": {
            "type": "integer",
            "description": "Currency of `amount`. Allowed values: GET /api/v1/currencies.",
            "format": "int32"
          },
          "paymentTypeId": {
            "type": "integer",
            "description": "How this movement was paid/collected. Allowed values: GET /api/v1/bank-payment-types.",
            "format": "int32"
          },
          "customerId": {
            "type": "integer",
            "description": "The customer this movement belongs to, when it is on the income side. Allowed values:\r\nGET /api/v1/customers.",
            "format": "int32",
            "nullable": true
          },
          "supplierId": {
            "type": "integer",
            "description": "The supplier this movement belongs to, when it is on the expense side. Allowed values:\r\nGET /api/v1/suppliers.",
            "format": "int32",
            "nullable": true
          },
          "reference": {
            "type": "string",
            "description": "Free-text reference for the movement.",
            "nullable": true
          },
          "chartOfAccountId": {
            "type": "integer",
            "description": "The chart-of-accounts entry this movement posts to. Allowed values:\r\nGET /api/v1/chart-of-accounts. Null on movements recorded by internal paths that do not\r\nset one (transfers between accounts, for instance).",
            "format": "int32",
            "nullable": true
          },
          "accountingDate": {
            "type": "string",
            "description": "Accounting date, when it differs from `date`. Null when the movement's accounting\r\ndate is the same as its date.",
            "format": "date-time",
            "nullable": true
          },
          "exchangeRate": {
            "type": "number",
            "description": "Exchange rate used, when the customer/supplier currency differs from the account's.",
            "format": "double",
            "nullable": true
          },
          "withholdingsTotal": {
            "type": "number",
            "description": "Sum of the withholdings (GET /api/v1/withholdings) applied on this movement, if any.",
            "format": "double",
            "nullable": true
          },
          "receiptId": {
            "type": "integer",
            "description": "The receipt issued for this movement, when one was. Resolvable at\r\nGET /api/v1/receipts/{id}. Only incomes have one.",
            "format": "int32",
            "nullable": true
          },
          "paymentOrderId": {
            "type": "integer",
            "description": "The payment order issued for this movement, when one was. Resolvable at\r\nGET /api/v1/payment-orders/{id}. Only expenses have one.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A movement (transaction) on a bank account."
      },
      "BankMovementDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BankMovementDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "BatchDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Batch id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "number": {
            "maxLength": 100,
            "minLength": 0,
            "type": "string",
            "description": "Batch number, as your brewery names it. Required on create and unique among your active\r\nbatches.",
            "nullable": true
          },
          "description": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Description. Required on create.",
            "nullable": true
          },
          "producedProductId": {
            "type": "integer",
            "description": "The beer this batch produces. Required on create. Listed by `GET /api/v1/products`;\r\nonly your own beers qualify, not complementary products or discounts.",
            "format": "int32"
          },
          "stageId": {
            "type": "integer",
            "description": "Read-only here. The batch's production stage. Set on create; afterwards it is changed only\r\nby `POST /api/v1/batches/{id}/stage`, because a stage change moves stock and reserves\r\na tank. Listed by `GET /api/v1/production-stages`.",
            "format": "int32"
          },
          "tankId": {
            "type": "integer",
            "description": "Tank the batch occupies. Required from fermentation onwards.",
            "format": "int32",
            "nullable": true
          },
          "recipeId": {
            "type": "integer",
            "description": "Recipe the batch was brewed from, if any.",
            "format": "int32",
            "nullable": true
          },
          "supplyWarehouseId": {
            "type": "integer",
            "description": "Warehouse the batch's supplies are taken from, when your account has more than one.",
            "format": "int32",
            "nullable": true
          },
          "date": {
            "type": "string",
            "description": "Read-only. Date the batch was registered. The server stamps it on create and never changes\r\nit afterwards, so sending it has no effect. Use `brewDate` for the date that matters\r\nto production.",
            "nullable": true
          },
          "brewDate": {
            "type": "string",
            "description": "Brew date, `YYYY-MM-DD` or a full ISO 8601 timestamp when the hour matters. It is the\r\ndate every task of the batch counts its days from.",
            "nullable": true
          },
          "keggingDate": {
            "type": "string",
            "description": "Kegging date, `YYYY-MM-DD` or a full ISO 8601 timestamp.",
            "nullable": true
          },
          "liters": {
            "type": "number",
            "description": "Litres in the batch. Cannot be lowered by an update: to take litres out you register waste,\r\nwhich is a different operation and keeps the loss accounted for.",
            "format": "double"
          },
          "brewLiters": {
            "type": "number",
            "description": "Litres actually brewed, before waste. Ignored while the batch enters the brewing stage: the\r\napplication copies `liters` into it at that moment, because that is what was brewed.",
            "format": "double",
            "nullable": true
          },
          "brewCount": {
            "type": "integer",
            "description": "How many brews make up this batch. Defaults to 1.",
            "format": "int32"
          },
          "notes": {
            "maxLength": 2000,
            "minLength": 0,
            "type": "string",
            "description": "Free-text notes.",
            "nullable": true
          },
          "discountsStock": {
            "type": "boolean",
            "description": "Read-only. True when the batch's supplies have been taken out of stock.\r\n            \r\nIt REPORTS what happened; it does not make it happen. To actually discount the supplies,\r\nsend `discountsStock: true` on `POST /api/v1/batches/{batchId}/stage` when the\r\nbatch enters the brewing stage. Making this one writable would mean a PUT of the notes\r\ncould silently move stock.\r\n            \r\nWhat was discounted is at `GET /api/v1/batches/{batchId}/supplies`."
          },
          "stockDiscountedOn": {
            "type": "string",
            "description": "Read-only. When the supplies were actually taken out of stock.",
            "format": "date-time",
            "nullable": true
          },
          "finishedOn": {
            "type": "string",
            "description": "Read-only. When the batch reached the finished stage.",
            "format": "date-time",
            "nullable": true
          },
          "parentBatchId": {
            "type": "integer",
            "description": "Read-only. The batch this one was split off from, if any. Splitting is not part of v1, so\r\nthis is reported and never written.",
            "format": "int32",
            "nullable": true
          },
          "split": {
            "type": "boolean",
            "description": "Read-only. True when this batch has been split."
          },
          "mergeResultBatchId": {
            "type": "integer",
            "description": "Read-only. The batch this one was merged into, if any.",
            "format": "int32",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A production batch (brew)."
      },
      "BatchDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BatchDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "BatchExtendedNotesDto": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "description": "Free-form HTML content. Null clears it. Absent on a PUT leaves it unchanged.",
            "nullable": true
          },
          "lastModifiedOn": {
            "type": "string",
            "description": "When the content was last saved. Read-only; null if it was never saved. Sending it has no\r\neffect — only content is written.",
            "format": "date-time",
            "nullable": true
          },
          "lastModifiedByUserId": {
            "type": "integer",
            "description": "Id of the user that last saved the content. Read-only; null if it was never saved.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Extended notes of a batch: long free-form HTML content from a rich text editor."
      },
      "BatchStageChangeDto": {
        "type": "object",
        "properties": {
          "stageId": {
            "type": "integer",
            "description": "The stage to move to. Required. Listed by `GET /api/v1/production-stages`.\r\n            \r\nA batch can only move forward, with one exception the application allows: a batch in the\r\nfiltering stage may go back. From the brewing stage it can only move to fermentation or\r\nstraight to finished.",
            "format": "int32"
          },
          "tankId": {
            "type": "integer",
            "description": "The tank the batch moves into. Required from fermentation onwards unless your account does\r\nnot manage tanks. A tank already holding another batch is rejected, naming that batch.",
            "format": "int32",
            "nullable": true
          },
          "supplyWarehouseId": {
            "type": "integer",
            "description": "Warehouse the batch's supplies come from. Only taken into account up to the fermentation\r\nstage, which is where the application still lets it change.",
            "format": "int32",
            "nullable": true
          },
          "discountsStock": {
            "type": "boolean",
            "description": "Discount the recipe's supplies from stock as part of this stage change. Defaults to\r\n`false`, which is what this endpoint always did before this field existed.\r\n            \r\nWHICH SUPPLIES: the ones on the batch's recipe that are marked as discounting stock, yeast\r\nexcluded. They are NOT sent in this request and cannot be overridden per batch — read them\r\nbeforehand with `GET /api/v1/recipes/{recipeId}`, where `ingredients` lists them\r\nwith their quantities. Each is multiplied by the batch's number of brews.\r\n            \r\nWHEN IT WORKS: only when the batch is entering the brewing stage and has not discounted\r\nbefore. Any other moment is rejected with `400` and the request has no effect,\r\nincluding the stage change itself. The batch must have a recipe.\r\n            \r\nIt can fail on a supply, not on the request: a quantity that would leave stock negative is\r\nrejected naming that supply. Nothing is written when that happens.\r\n            \r\nWhat was discounted is then readable at `GET /api/v1/batches/{batchId}/supplies`."
          }
        },
        "additionalProperties": false,
        "description": "The stage to move a batch to."
      },
      "BatchSupplyDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Movement id (StockMP.id).",
            "format": "int32"
          },
          "supplyId": {
            "type": "integer",
            "description": "The supply consumed. Listed by `GET /api/v1/supplies`. (idMP)",
            "format": "int32"
          },
          "supplyTypeId": {
            "type": "integer",
            "description": "Supply type. Listed by `GET /api/v1/raw-material-types`. (idTipoMP)",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Supply name at the time of reading. (nombre)",
            "nullable": true
          },
          "brand": {
            "type": "string",
            "description": "Supply brand, when it has one. (marca)",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "description": "Amount moved, SIGNED: positive when the supply left the warehouse for this batch, negative\r\nwhen it came back. Summing this column gives what the batch actually consumed.",
            "format": "double"
          },
          "unitId": {
            "type": "integer",
            "description": "Unit the amount is expressed in. Listed by `GET /api/v1/units`. (unidad)",
            "format": "int32",
            "nullable": true
          },
          "stockAfter": {
            "type": "number",
            "description": "Remaining stock of that supply right after this movement. (stock)",
            "format": "double"
          },
          "date": {
            "type": "string",
            "description": "When the movement happened. (fecha)",
            "format": "date-time"
          },
          "movementTypeId": {
            "type": "integer",
            "description": "1 = stock in, 2 = stock out. Read together with the sign of `quantity`: an \"in\"\r\nmovement on a batch is supply returning to the warehouse. (idTipoStock)",
            "format": "int32"
          },
          "purchaseId": {
            "type": "integer",
            "description": "The purchase this supply came from, when the movement can be traced to one. (idCompra)",
            "format": "int32",
            "nullable": true
          },
          "externalLotNumbers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The supplier's own lot numbers for this supply, as recorded when it was discounted. Empty\r\nwhen the account does not track them. (MPLoteExternoDescontado.nroLoteExterno)",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One supply movement a batch produced: what it consumed, and what came back."
      },
      "BatchTaskDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Batch task id.",
            "format": "int32"
          },
          "batchId": {
            "type": "integer",
            "description": "The batch this task belongs to.",
            "format": "int32"
          },
          "taskDefinitionId": {
            "type": "integer",
            "description": "The definition it was generated from.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Name of the task.",
            "nullable": true
          },
          "days": {
            "type": "integer",
            "description": "Days after the brew date on which the task falls due. Day 0 is the brew itself.",
            "format": "int32"
          },
          "time": {
            "type": "string",
            "description": "Time of day the task is due, `HH:mm`.",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "description": "Free-text notes.",
            "nullable": true
          },
          "measurementTypeId": {
            "type": "integer",
            "description": "Measurement the task asks for when completed, if any.",
            "format": "int32",
            "nullable": true
          },
          "discountsStock": {
            "type": "boolean",
            "description": "True when completing the task takes its supplies out of stock."
          },
          "assignedUserId": {
            "type": "integer",
            "description": "User the task is assigned to, if any.",
            "format": "int32",
            "nullable": true
          },
          "completed": {
            "type": "boolean",
            "description": "True once the task has been completed."
          },
          "completedOn": {
            "type": "string",
            "description": "When it was completed.",
            "format": "date-time",
            "nullable": true
          },
          "completedByUserId": {
            "type": "integer",
            "description": "Who completed it.",
            "format": "int32",
            "nullable": true
          },
          "completedTankId": {
            "type": "integer",
            "description": "Tank it was completed in, if the task asked for one.",
            "format": "int32",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "False once the task has been removed from the batch."
          }
        },
        "additionalProperties": false,
        "description": "A task of a batch: generated with the batch from its recipe."
      },
      "BrandDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Brand id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Required.",
            "nullable": true
          },
          "legalName": {
            "type": "string",
            "description": "Legal name.",
            "nullable": true
          },
          "address": {
            "type": "string",
            "description": "Street address.",
            "nullable": true
          },
          "city": {
            "type": "string",
            "description": "City.",
            "nullable": true
          },
          "state": {
            "type": "string",
            "description": "State/province/region.",
            "nullable": true
          },
          "phones": {
            "type": "string",
            "description": "Free-text phone number(s).",
            "nullable": true
          },
          "emails": {
            "type": "string",
            "description": "Free-text email address(es).",
            "nullable": true
          },
          "taxId": {
            "type": "string",
            "description": "Tax id (CUIT or the local equivalent).",
            "nullable": true
          },
          "taxConditionId": {
            "type": "integer",
            "description": "Tax condition. Allowed values: GET /api/v1/tax-conditions.",
            "format": "int32"
          },
          "logoUrl": {
            "type": "string",
            "description": "Read-only in this version. See the remarks above.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate."
          }
        },
        "additionalProperties": false,
        "description": "A brand of your brewery."
      },
      "BrandDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BrandDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "BreweryAssetDeliveryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Delivery note id.",
            "format": "int32"
          },
          "number": {
            "type": "string",
            "description": "The delivery note's own number.",
            "nullable": true
          },
          "customerId": {
            "type": "integer",
            "description": "The customer the assets were delivered to.",
            "format": "int32"
          },
          "customerLocationId": {
            "type": "integer",
            "description": "The customer's point of sale, if any.",
            "format": "int32",
            "nullable": true
          },
          "deliveryDate": {
            "type": "string",
            "description": "When the delivery happened.",
            "format": "date-time"
          },
          "createdOn": {
            "type": "string",
            "description": "When the delivery note was generated.",
            "format": "date-time"
          },
          "notes": {
            "type": "string",
            "description": "Free-text note.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "False when the delivery note was voided."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BreweryAssetDeliveryLineDto"
            },
            "description": "The brewery assets delivered.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A delivery note (remito) of one or more brewery assets to a customer."
      },
      "BreweryAssetDeliveryDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BreweryAssetDeliveryDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "BreweryAssetDeliveryLineDto": {
        "type": "object",
        "properties": {
          "assetId": {
            "type": "integer",
            "description": "Brewery asset id.",
            "format": "int32"
          },
          "description": {
            "type": "string",
            "description": "Read-only description, as recorded at delivery time.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One brewery asset on a delivery note."
      },
      "BreweryAssetDeliveryRequestDto": {
        "type": "object",
        "properties": {
          "customerId": {
            "type": "integer",
            "description": "Destination customer. Listed by `GET /api/v1/customers`.",
            "format": "int32"
          },
          "customerLocationId": {
            "type": "integer",
            "description": "Destination point of sale, if the customer has more than one. Listed by `GET /api/v1/customers/{customerId}/points-of-sale`.",
            "format": "int32",
            "nullable": true
          },
          "date": {
            "type": "string",
            "description": "When the delivery happened, ISO 8601.",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "description": "Free-text note.",
            "nullable": true
          },
          "assetIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "The brewery assets to deliver. Each must not currently be at a customer.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Delivering one or more brewery assets to a customer for the first time."
      },
      "BreweryAssetDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Brewery asset id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "code": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "The code printed or tagged on the equipment. Required on create, and unique among your brewery assets.",
            "nullable": true
          },
          "name": {
            "maxLength": 200,
            "minLength": 0,
            "type": "string",
            "nullable": true
          },
          "address": {
            "maxLength": 500,
            "minLength": 0,
            "type": "string",
            "nullable": true
          },
          "phone": {
            "maxLength": 100,
            "minLength": 0,
            "type": "string",
            "nullable": true
          },
          "brand": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "nullable": true
          },
          "netValue": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "usefulLife": {
            "type": "string",
            "description": "End of useful life, ISO 8601 date. Optional.",
            "nullable": true
          },
          "notes": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "nullable": true
          },
          "underMaintenance": {
            "type": "boolean",
            "description": "Read-only. True while the equipment is under maintenance."
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          },
          "customerId": {
            "type": "integer",
            "description": "Read-only. The customer currently holding the asset, if any. Listed by\r\n`GET /api/v1/customers`. To change it, see `POST /api/v1/brewery-assets/deliveries`.",
            "format": "int32",
            "nullable": true
          },
          "customerName": {
            "type": "string",
            "description": "Read-only. Name of that customer.",
            "nullable": true
          },
          "customerLocationId": {
            "type": "integer",
            "description": "Read-only. The customer's point of sale holding the asset, when it has one. Listed by\r\n`GET /api/v1/customers/{customerId}/points-of-sale`.",
            "format": "int32",
            "nullable": true
          },
          "deliveredOn": {
            "type": "string",
            "description": "Read-only. When it was delivered to that customer.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A brewery asset: reusable equipment (other than a tap system) you track by code as it moves\r\nto and from customers."
      },
      "BreweryAssetDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BreweryAssetDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "BreweryAssetReturnRequestDto": {
        "type": "object",
        "properties": {
          "assetIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "The brewery assets being returned. Each must currently be at a customer.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A customer returning one or more brewery assets."
      },
      "CalendarEventDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Event id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "categoryId": {
            "type": "integer",
            "description": "Required. Must be an id from `GET /event-categories`, active.",
            "format": "int32"
          },
          "eventDate": {
            "type": "string",
            "description": "Required. Date only (no time), ISO 8601 (`yyyy-MM-dd`).",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "Optional.",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "description": "Optional.",
            "format": "double",
            "nullable": true
          },
          "color": {
            "type": "string",
            "description": "Optional. When not sent on create, the event takes its category's color instead.\r\nAlways returns the value actually stored — this resource does not reproduce the two\r\nhardcoded color overrides the calendar widget paints for a paid Vencimiento/Entrega\r\nevent, that is UI-only rendering, not stored data.",
            "nullable": true
          },
          "applied": {
            "type": "boolean",
            "description": "Read-only. Set by other domains when they pay/collect against this event — never true\r\nfor an event created through this resource, since those domains never link to one."
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A manually-created calendar event (\"suelto\" — not linked to a purchase, check, cash\r\nregister, bank account or maintenance; those are reflected onto the calendar by their own\r\ndomain and are entirely out of scope for this resource, both for reading and writing)."
      },
      "CalendarEventDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CalendarEventDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "CalendarEventRecurringDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Template id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "title": {
            "type": "string",
            "description": "Optional.",
            "nullable": true
          },
          "eventDate": {
            "type": "string",
            "description": "Required. Date of the first occurrence, date only (no time), ISO 8601\r\n(`yyyy-MM-dd`).",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "Optional.",
            "nullable": true
          },
          "every": {
            "type": "integer",
            "description": "Required. How often it recurs, together with `period` — e.g. every 3 `months`.",
            "format": "int32"
          },
          "period": {
            "type": "string",
            "description": "Required. One of: `days`, `months`, `years`.",
            "nullable": true
          },
          "color": {
            "type": "string",
            "description": "Optional.",
            "nullable": true
          },
          "excludedDates": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Read-only. Occurrences excluded from the recurrence — dates, `yyyy-MM-dd`. Changed\r\nonly by `POST .../{id}/exclude-date`; there is no way to remove an already-excluded\r\ndate, same as the web application.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A recurring calendar event template (\"suelto\" — not linked to a maintenance asset; those\r\nalready publish their own recurrence via `maintenances`' `recurring`/\r\n`recurrenceEvery`/`recurrencePeriod` fields, not duplicated here)."
      },
      "CalendarEventRecurringDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CalendarEventRecurringDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "CashMovementDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Movement id.",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "description": "Date of the movement.",
            "format": "date-time"
          },
          "typeId": {
            "type": "integer",
            "description": "What kind of movement this is: `1` income, `2` expense, `3` shift opening,\r\n`4` shift closing. Fixed set, not a catalog.",
            "format": "int32"
          },
          "description": {
            "type": "string",
            "description": "What the movement is. Free text written by whoever generated it.",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "description": "Amount. Always positive: whether it increases or decreases the register's balance is\r\ndetermined by `typeId`, not by the sign.",
            "format": "double"
          },
          "balance": {
            "type": "number",
            "description": "Balance after this movement.",
            "format": "double"
          },
          "previousBalance": {
            "type": "number",
            "description": "Balance before this movement.",
            "format": "double"
          },
          "currencyId": {
            "type": "integer",
            "description": "Currency of `amount`. Allowed values: GET /api/v1/currencies.",
            "format": "int32"
          },
          "paymentTypeId": {
            "type": "integer",
            "description": "How this movement was paid/collected. Allowed values: GET /api/v1/payment-types.",
            "format": "int32"
          },
          "accountId": {
            "type": "integer",
            "description": "The account (GET /api/v1/chart-of-accounts) this movement posts to, when one is set.",
            "format": "int32",
            "nullable": true
          },
          "customerId": {
            "type": "integer",
            "description": "The customer this movement belongs to, when it is on the income side. Allowed values:\r\nGET /api/v1/customers.",
            "format": "int32",
            "nullable": true
          },
          "supplierId": {
            "type": "integer",
            "description": "The supplier this movement belongs to, when it is on the expense side. Allowed values:\r\nGET /api/v1/suppliers.",
            "format": "int32",
            "nullable": true
          },
          "bankId": {
            "type": "integer",
            "description": "The bank this movement relates to, when one is set. Allowed values: GET /api/v1/banks.",
            "format": "int32",
            "nullable": true
          },
          "bankMovementId": {
            "type": "integer",
            "description": "The bank account movement this cash movement is linked to, when one is set. See\r\nGET /api/v1/bank-accounts/{bankAccountId}/movements.",
            "format": "int32",
            "nullable": true
          },
          "reference": {
            "type": "string",
            "description": "Free-text reference for the movement.",
            "nullable": true
          },
          "accountingDate": {
            "type": "string",
            "description": "Accounting date, when it differs from `date`. Null when the movement's accounting\r\ndate is the same as its date.",
            "format": "date-time",
            "nullable": true
          },
          "exchangeRate": {
            "type": "number",
            "description": "Exchange rate used, when the customer/supplier currency differs from the register's.",
            "format": "double",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A movement (transaction) on a cash register."
      },
      "CashMovementDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CashMovementDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "CashRegisterDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Cash register id. Assigned by the server; ignored on update.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Name. Required. For the two system-defined registers this is always their fixed name.",
            "nullable": true
          },
          "assignedUserName": {
            "type": "string",
            "description": "Read-only. The user this register is assigned to, when one is set. There is no published\r\ncatalog of users yet, so the name is resolved for you instead of an id.",
            "nullable": true
          },
          "currencyId": {
            "type": "integer",
            "description": "Read-only. Your account's default currency — always applied on save regardless of what you send.",
            "format": "int32"
          },
          "balance": {
            "type": "number",
            "description": "Read-only. Current balance.",
            "format": "double"
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A cash register of your brewery (not a bank account — see /bank-accounts for those)."
      },
      "CashRegisterDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CashRegisterDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "CashRegisterShiftDto": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "number",
            "description": "The cash amount the shift opens or closes with. Must be zero or positive. Required —\r\nsending nothing opens or closes with zero, which is a valid but probably unintended value.",
            "format": "double"
          }
        },
        "additionalProperties": false,
        "description": "Body of `POST /api/v1/cash-registers/{cashRegisterId}/open` and\r\n`/close`."
      },
      "CatalogItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "The value to send in the corresponding field.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Human-readable name, for display in your own UI.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "An allowed value for a reference field, as returned by the discovery endpoints."
      },
      "ChartOfAccountDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Account id. Assigned by the server; ignored on update.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Name. Required. For system-defined accounts this is always their fixed name.",
            "nullable": true
          },
          "income": {
            "type": "boolean",
            "description": "`true` if this account only takes income, `false` if it only takes expenses,\r\n            `null` if it takes both.",
            "nullable": true
          },
          "supportsVoucher": {
            "type": "boolean",
            "description": "Whether a voucher/comprobante can be attached to a movement on this account."
          },
          "expenseCategoryId": {
            "type": "integer",
            "description": "Category of this account, when one is assigned. Allowed values: GET /api/v1/account-categories.",
            "format": "int32",
            "nullable": true
          },
          "brandId": {
            "type": "integer",
            "description": "Brand this account belongs to, when one is assigned; `null` otherwise. Reports classify\r\npurchases and cash/bank movements by the brand of their account. Allowed values: GET /api/v1/brands.\r\nOnly your own accounts can carry a brand, and assigning or changing it requires the multi-brand\r\nfeature to be enabled on your account (400 otherwise). Send `null` to remove it; omit the\r\nfield to keep the current one.",
            "format": "int32",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "An entry of your chart of accounts."
      },
      "ChartOfAccountDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChartOfAccountDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "CheckCollectDto": {
        "type": "object",
        "properties": {
          "cashRegisterId": {
            "type": "integer",
            "description": "The cash register the cheque is collected into. Allowed values:\r\nGET /api/v1/cash-registers. Send this OR `bankAccountId`, not both.",
            "format": "int32",
            "nullable": true
          },
          "bankAccountId": {
            "type": "integer",
            "description": "The bank account the cheque is credited to. Allowed values: GET /api/v1/bank-accounts.\r\nSend this OR `cashRegisterId`, not both. Own cheques (`kindId` = own) can only\r\nbe collected into a bank account.",
            "format": "int32",
            "nullable": true
          },
          "collectionDate": {
            "type": "string",
            "description": "Date the money is credited, ISO 8601 (yyyy-MM-dd). Required. On a cheque that was\r\ndeposited, it cannot be earlier than the deposit date.",
            "nullable": true
          },
          "chartOfAccountId": {
            "type": "integer",
            "description": "The chart-of-accounts entry the resulting movement posts to. Optional. Allowed values:\r\nGET /api/v1/chart-of-accounts.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Body of `POST /api/v1/checks/{checkId}/collect`."
      },
      "CheckDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Check id. Assigned by the server; ignored on update.",
            "format": "int32"
          },
          "number": {
            "type": "string",
            "description": "Check number, as printed on it. Required.",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "description": "Amount.",
            "format": "double"
          },
          "issuer": {
            "type": "string",
            "description": "Who issued the check.",
            "nullable": true
          },
          "issueDate": {
            "type": "string",
            "description": "Date printed on the check.",
            "format": "date-time"
          },
          "dueDate": {
            "type": "string",
            "description": "Due date. Must not be earlier than issueDate — the application rejects a check where it\r\nis.",
            "format": "date-time"
          },
          "collectionDate": {
            "type": "string",
            "description": "When the check was actually collected. Null until it is. Read-only: set by /collect.",
            "format": "date-time",
            "nullable": true
          },
          "bankId": {
            "type": "integer",
            "description": "Issuing bank. Allowed values: GET /api/v1/banks.",
            "format": "int32"
          },
          "customerId": {
            "type": "integer",
            "description": "The customer this check was received from, when it is a third-party check received as\r\npayment. Allowed values: GET /api/v1/customers.",
            "format": "int32",
            "nullable": true
          },
          "supplierId": {
            "type": "integer",
            "description": "The supplier this check was delivered to, when it was handed over as payment. Read-only:\r\nthe application itself never lets this change once the check exists (only customerId is\r\neditable). Allowed values: GET /api/v1/suppliers.",
            "format": "int32",
            "nullable": true
          },
          "kindId": {
            "type": "integer",
            "description": "Own check or third-party check. Allowed values: GET /api/v1/check-kinds.",
            "format": "int32"
          },
          "isEcheq": {
            "type": "boolean",
            "description": "True when this is an electronic check (e-cheq)."
          },
          "statusId": {
            "type": "integer",
            "description": "Read-only. Changed only by /collect and /deactivate. Allowed values: GET /api/v1/check-statuses.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A check received from a customer or delivered to a supplier."
      },
      "CheckDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "CodedCatalogItemDto": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "The value to send in the corresponding field, as text.",
            "nullable": true
          },
          "name": {
            "type": "string",
            "description": "Human-readable name, for display in your own UI.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "An allowed value identified by a code rather than by a number, as used by the tax authority\r\ncatalogs of some countries."
      },
      "CollectionCreateDto": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "description": "Date of the collection, ISO 8601 (yyyy-MM-dd). Required.",
            "nullable": true
          },
          "customerId": {
            "type": "integer",
            "description": "The customer paying. Required. Allowed values: GET /api/v1/customers.",
            "format": "int32"
          },
          "chartOfAccountId": {
            "type": "integer",
            "description": "The chart-of-accounts entry the collection posts to. Required. Allowed values:\r\nGET /api/v1/chart-of-accounts.",
            "format": "int32"
          },
          "description": {
            "maxLength": 500,
            "minLength": 0,
            "type": "string",
            "description": "What the collection is. Optional.",
            "nullable": true
          },
          "reference": {
            "maxLength": 100,
            "minLength": 0,
            "type": "string",
            "description": "Free-text reference carried to every movement. Optional.",
            "nullable": true
          },
          "currentAccountNotes": {
            "maxLength": 500,
            "minLength": 0,
            "type": "string",
            "description": "Note stored on the current account entry. Optional.",
            "nullable": true
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CollectionPaymentCreateDto"
            },
            "description": "Where the money went, one entry per destination. At least one is required, and they may\r\nmix: part in cash, part into a bank account, is the normal case.\r\n            \r\nThe total of the collection is the sum of the amounts — it is not sent separately.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Body of POST /api/v1/collections."
      },
      "CollectionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Collection id.",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "description": "Date of the collection.",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "description": "When the record was created, which can differ from `date`.",
            "format": "date-time"
          },
          "amount": {
            "type": "number",
            "description": "Total collected.",
            "format": "double"
          },
          "description": {
            "type": "string",
            "description": "What the collection is. Free text.",
            "nullable": true
          },
          "customerId": {
            "type": "integer",
            "description": "The customer who paid. Allowed values: GET /api/v1/customers.",
            "format": "int32"
          },
          "receiptId": {
            "type": "integer",
            "description": "The receipt issued for it, when it was. Resolvable at GET /api/v1/receipts/{id}. Null\r\nwhile the collection is pending approval.",
            "format": "int32",
            "nullable": true
          },
          "approved": {
            "type": "boolean",
            "description": "Whether it is approved. Accounts with the approval flow turned on register collections\r\npending, and nothing moves until someone approves them."
          },
          "currentAccountNotes": {
            "type": "string",
            "description": "Note stored on the customer's current account entry.",
            "nullable": true
          },
          "chartOfAccountId": {
            "type": "integer",
            "description": "The chart-of-accounts entry it posts to. Allowed values: GET /api/v1/chart-of-accounts.",
            "format": "int32",
            "nullable": true
          },
          "orderId": {
            "type": "integer",
            "description": "The order this collection was made against, when it came from one. Read it with\r\nGET /api/v1/orders/{orderId} (orders are read-only).",
            "format": "int32",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Whether the collection is active."
          },
          "cashMovementIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "The cash-register movements it produced. Only on GET /collections/{id}: a collection can\r\npay into several destinations at once, so returning them in a page would multiply rows.",
            "nullable": true
          },
          "bankMovementIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "The bank-account movements it produced. Only on GET /collections/{id}.",
            "nullable": true
          },
          "checkIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "The cheques received in it, resolvable at GET /api/v1/checks/{id}. Only on\r\nGET /collections/{id}.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A collection: money received from a customer, in one or more ways at once."
      },
      "CollectionDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CollectionDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "CollectionPaymentCreateDto": {
        "type": "object",
        "properties": {
          "destination": {
            "type": "string",
            "description": "Where this part of the money went. Required, and exactly one of:\r\n<list type=\"bullet\"><item>`cash_register` — a cash register of yours. Requires `cashRegisterId`.</item><item>`bank_account` — one of your bank accounts. Requires `bankAccountId` and\r\n`bankPaymentTypeId`.</item></list>\r\n            \r\nNOT AVAILABLE IN THIS VERSION, and measured before deciding (collections since\r\n2026-06-01): the main cash register, 9% of use, because the web application shows it only\r\nto users holding a specific permission and the integration user holds every permission the\r\nAPI declares — the API cannot reproduce that gate faithfully; and the pure current-account\r\nentry, 0.5% of use, because no money moves anywhere and the collection would come back\r\nwith no movements at all. The two destinations offered here cover 90% of real use, and\r\nadding the others later is additive.",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "description": "Amount received at this destination. Required, and must be greater than zero.",
            "format": "double"
          },
          "cashRegisterId": {
            "type": "integer",
            "description": "The cash register the money went into. Required when `destination` is\r\n`cash_register`, ignored otherwise. Allowed values: GET /api/v1/cash-registers.\r\n            \r\nIf your account works with cash register shifts, the register has to be open — otherwise\r\nthe whole collection is rejected and nothing is written.",
            "format": "int32",
            "nullable": true
          },
          "bankAccountId": {
            "type": "integer",
            "description": "The bank account the money went into. Required when `destination` is\r\n`bank_account`, ignored otherwise. Allowed values: GET /api/v1/bank-accounts.",
            "format": "int32",
            "nullable": true
          },
          "bankPaymentTypeId": {
            "type": "integer",
            "description": "How the money moved. REQUIRED when `destination` is `bank_account`. Allowed\r\nvalues: GET /api/v1/bank-payment-types.\r\n            \r\nIt is required and not optional for a measured reason: the underlying column has a foreign\r\nkey, and omitting it used to reach the database as a zero and fail there — a 500 instead of\r\na 400. See TestApiCollectionsDb.",
            "format": "int32",
            "nullable": true
          },
          "currencyId": {
            "type": "integer",
            "description": "Currency of this payment. Optional; defaults to your account's currency. Allowed values:\r\nGET /api/v1/currencies.",
            "format": "int32",
            "nullable": true
          },
          "exchangeRate": {
            "type": "number",
            "description": "Exchange rate to apply when the currency is not your account's. Optional.",
            "format": "double",
            "nullable": true
          },
          "checkNumber": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "Cheque number, when the customer paid with a cheque. Sending it creates the cheque and\r\nlinks it to this collection; it is then readable at GET /api/v1/checks.",
            "nullable": true
          },
          "checkIssuer": {
            "maxLength": 200,
            "minLength": 0,
            "type": "string",
            "description": "Who issued the cheque. Optional.",
            "nullable": true
          },
          "bankId": {
            "type": "integer",
            "description": "The cheque's bank. REQUIRED whenever `checkNumber` is sent. Allowed values:\r\nGET /api/v1/banks.",
            "format": "int32",
            "nullable": true
          },
          "checkIssueDate": {
            "type": "string",
            "description": "Cheque issue date, ISO 8601. Required whenever `checkNumber` is sent.",
            "nullable": true
          },
          "checkDueDate": {
            "type": "string",
            "description": "Cheque due date, ISO 8601. Required whenever `checkNumber` is sent.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One destination of a collection."
      },
      "ContactDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Contact id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Name. Required on create.",
            "nullable": true
          },
          "phone": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Phone number.",
            "nullable": true
          },
          "email": {
            "maxLength": 150,
            "minLength": 0,
            "type": "string",
            "description": "E-mail address.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A contact person of a customer."
      },
      "ConvertLeadRequestDto": {
        "type": "object",
        "properties": {
          "customerTypeId": {
            "type": "integer",
            "description": "The new customer's type. See `/customer-types`.",
            "format": "int32",
            "nullable": true
          },
          "categoryId": {
            "type": "integer",
            "description": "A category to assign the new customer to. See `/customer-categories`.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Body of `POST /leads/{id}/convert`. Both fields optional."
      },
      "CostingBulkRecalculationResultDto": {
        "type": "object",
        "properties": {
          "recalculated": {
            "type": "integer",
            "format": "int32"
          },
          "notApplicable": {
            "type": "integer",
            "description": "Skipped: on a recipe, or on a batch that isn't finished yet — not an error.",
            "format": "int32"
          },
          "safeguardAppliedCount": {
            "type": "integer",
            "description": "Of the recalculated ones, how many fell back to theoretical liters — see CostingRecalculationResultDto.safeguardApplied.",
            "format": "int32"
          },
          "skipped": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "One entry per costing that errored out instead of recalculating, as \"#id: reason\".",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Result of POST /costings/recalculate: a bulk recalculation from a date."
      },
      "CostingDetailDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Line id. Read-only: reported on GET, ignored on write.",
            "format": "int32"
          },
          "supplyId": {
            "type": "integer",
            "description": "The raw material this line costs. Listed by GET /api/v1/supplies.",
            "format": "int32",
            "nullable": true
          },
          "accountId": {
            "type": "integer",
            "description": "The expense account this line is charged to. Listed by GET /api/v1/expense-accounts.",
            "format": "int32",
            "nullable": true
          },
          "name": {
            "type": "string",
            "description": "Free-text description of the line.",
            "nullable": true
          },
          "cost": {
            "type": "number",
            "description": "Total cost of the line.",
            "format": "double"
          },
          "unitId": {
            "type": "integer",
            "description": "Unit the quantity is expressed in. Listed by GET /api/v1/units.",
            "format": "int32",
            "nullable": true
          },
          "unitCost": {
            "type": "number",
            "description": "Cost per unit.",
            "format": "double"
          },
          "quantity": {
            "type": "number",
            "description": "Quantity.",
            "format": "double"
          },
          "costUsd": {
            "type": "number",
            "description": "Cost of the line in USD, when the account tracks it in that currency.",
            "format": "double",
            "nullable": true
          },
          "manuallyAdded": {
            "type": "boolean",
            "description": "True for a line typed in by hand, as opposed to one the screen suggested."
          }
        },
        "additionalProperties": false,
        "description": "One cost line of a costing: a raw material, an expense account, or a manually-typed cost."
      },
      "CostingDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Costing id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "batchId": {
            "type": "integer",
            "description": "The batch this costing is for. Exactly one of batchId/recipeId is required on create.",
            "format": "int32",
            "nullable": true
          },
          "recipeId": {
            "type": "integer",
            "description": "The recipe this costing is for, when there is no batch yet. Listed by GET /api/v1/recipes.",
            "format": "int32",
            "nullable": true
          },
          "productId": {
            "type": "integer",
            "description": "Read-only. The product resolved from the batch or the recipe.",
            "format": "int32",
            "nullable": true
          },
          "liters": {
            "type": "number",
            "description": "Litres this costing covers.",
            "format": "double"
          },
          "date": {
            "type": "string",
            "description": "When it was recorded, ISO 8601.",
            "nullable": true
          },
          "name": {
            "type": "string",
            "description": "Name.",
            "nullable": true
          },
          "fixedSubtotal": {
            "type": "number",
            "description": "Sum of the fixed-cost detail lines.",
            "format": "double"
          },
          "variableSubtotal": {
            "type": "number",
            "description": "Sum of the variable-cost detail lines.",
            "format": "double"
          },
          "total": {
            "type": "number",
            "description": "Total cost.",
            "format": "double"
          },
          "costPerLiter": {
            "type": "number",
            "description": "Cost per litre.",
            "format": "double"
          },
          "kegCostPerLiter": {
            "type": "number",
            "description": "Cost per litre once kegged. See the remark on the class: the application does not\r\nrecompute this on a plain save either.",
            "format": "double"
          },
          "exchangeRate": {
            "type": "number",
            "description": "Exchange rate used for the USD-denominated lines, if any.",
            "format": "double",
            "nullable": true
          },
          "considerWaste": {
            "type": "boolean",
            "description": "Whether this costing's litre base accounts for waste."
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          },
          "preliminary": {
            "type": "boolean",
            "description": "Read-only. `true` when the costing was generated by the brewery's automatic lot costing and\r\nhas not been confirmed yet: it has no fixed costs and does not update the product costs. Ignored\r\non create and on update."
          },
          "confirmedAt": {
            "type": "string",
            "description": "Read-only. When a person confirmed this costing as final, having been preliminary (ISO 8601\r\ndate-time); `null` for costings that were never preliminary or are still preliminary.\r\nIgnored on create and on update.",
            "nullable": true
          },
          "detailLines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CostingDetailDto"
            },
            "description": "The cost lines. Replaces the entire collection when sent — see the remark on the class.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "The production cost of a batch or a recipe."
      },
      "CostingDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CostingDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "CostingHistoryEntryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "History entry id. Pass it as historyId to POST /costings/{costingId}/restore.",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "description": "When this version was recorded, ISO 8601.",
            "nullable": true
          },
          "action": {
            "type": "string",
            "description": "What happened: created, modified, recalculated, deactivated, reactivated, duplicated, restored, recalculationBackup, initialVersion.",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "description": "Free-text summary of what changed. Null for the synthetic initialVersion entry.",
            "nullable": true
          },
          "hasSnapshot": {
            "type": "boolean",
            "description": "Whether this entry can be restored. False for a purely informational entry (e.g. deactivated/reactivated) and for the synthetic initialVersion entry."
          }
        },
        "additionalProperties": false,
        "description": "One entry of a costing's edit history."
      },
      "CostingRecalculationImpactDto": {
        "type": "object",
        "properties": {
          "recalculable": {
            "type": "integer",
            "description": "Costings on a finished batch, from that date on — these are what a matching POST /costings/recalculate would process.",
            "format": "int32"
          },
          "notApplicable": {
            "type": "integer",
            "description": "Costings from that date on that a recalculation skips: on a recipe, or on a batch that isn't finished yet.",
            "format": "int32"
          },
          "batchLimit": {
            "type": "integer",
            "description": "POST /costings/recalculate rejects the batch if recalculable is over this.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "Result of GET /costings/recalculate-count: the impact of recalculating from a date."
      },
      "CostingRecalculationResultDto": {
        "type": "object",
        "properties": {
          "costing": {
            "$ref": "#/components/schemas/CostingDto"
          },
          "safeguardApplied": {
            "type": "boolean",
            "description": "True when the recorded production liters looked implausible and the recalculation fell\r\nback to the batch's theoretical liters instead."
          },
          "safeguardThresholdPercent": {
            "type": "integer",
            "description": "Minimum plausible percent of theoretical liters used by the check. Set only when safeguardApplied is true.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Result of POST /costings/{costingId}/recalculate."
      },
      "CostingRestoreRequestDto": {
        "type": "object",
        "properties": {
          "historyId": {
            "type": "integer",
            "description": "id of an entry from GET /costings/{costingId}/history with hasSnapshot=true.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "Body of POST /costings/{costingId}/restore."
      },
      "CreateInvitationRequestDto": {
        "type": "object",
        "properties": {
          "customerId": {
            "type": "integer",
            "description": "Required. Must be one of your account's own customers — see `/customers`.",
            "format": "int32"
          },
          "email": {
            "type": "string",
            "description": "Required.",
            "nullable": true
          },
          "franchise": {
            "type": "boolean",
            "description": "Grants franchise-wide access too. Defaults to `false`."
          },
          "canViewStock": {
            "type": "boolean",
            "description": "Whether the invited user will be able to see stock. Defaults to `false`."
          }
        },
        "additionalProperties": false,
        "description": "Body of `POST /invitations`."
      },
      "CreateLeadCommentRequestDto": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "description": "Required, non-empty.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Body of `POST /leads/{id}/comments`."
      },
      "CustomerBalanceDto": {
        "type": "object",
        "properties": {
          "customerId": {
            "type": "integer",
            "description": "Customer id.",
            "format": "int32"
          },
          "balance": {
            "type": "number",
            "description": "Outstanding balance. Positive means the customer owes your account. Expressed in the\r\ncurrency of the customer's current account.",
            "format": "double"
          },
          "accountCustomerId": {
            "type": "integer",
            "description": "The customer whose account this balance belongs to. Differs from customerId when the\r\ncustomer belongs to a group and does not have its own current account: in that case the\r\nbalance is the parent's.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "The current-account balance of a customer."
      },
      "CustomerCategoryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Customer category id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Required.",
            "nullable": true
          },
          "isSystem": {
            "type": "boolean",
            "description": "Read-only. System-defined categories cannot be edited, deactivated or reactivated\r\nthrough this resource."
          },
          "hasAssociatedCustomers": {
            "type": "boolean",
            "description": "Read-only. Whether any customer currently holds this category."
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A customer category used to classify the customers of your account."
      },
      "CustomerCategoryDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerCategoryDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "CustomerDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Customer id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "tradeName": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Trade name. Required on create, and must not match another active customer.",
            "nullable": true
          },
          "legalName": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Legal name.",
            "nullable": true
          },
          "taxId": {
            "maxLength": 30,
            "minLength": 0,
            "type": "string",
            "description": "Tax identification number (CUIT / RUT / RFC, depending on the country). In Chile it must not contain spaces.",
            "nullable": true
          },
          "address": {
            "maxLength": 400,
            "minLength": 0,
            "type": "string",
            "description": "Street address.",
            "nullable": true
          },
          "city": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "City.",
            "nullable": true
          },
          "postalCode": {
            "maxLength": 10,
            "minLength": 0,
            "type": "string",
            "description": "Postal code.",
            "nullable": true
          },
          "phones": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Phone numbers, free text.",
            "nullable": true
          },
          "emails": {
            "maxLength": 150,
            "minLength": 0,
            "type": "string",
            "description": "E-mail addresses, comma separated.",
            "nullable": true
          },
          "contactName": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Contact person.",
            "nullable": true
          },
          "notes": {
            "maxLength": 1000,
            "minLength": 0,
            "type": "string",
            "description": "Free-form notes.",
            "nullable": true
          },
          "code": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "Customer code used by your account.",
            "nullable": true
          },
          "taxConditionId": {
            "type": "integer",
            "description": "Tax condition id. Allowed values: GET /api/v1/tax-conditions. The set depends on the\r\ncountry of your account, so it is deliberately not enumerated in this specification.",
            "format": "int32"
          },
          "provinceId": {
            "type": "integer",
            "description": "Province, state or region. Allowed values: GET /api/v1/provinces. Null clears it.",
            "format": "int32",
            "nullable": true
          },
          "paymentTermsId": {
            "type": "integer",
            "description": "Payment terms. Allowed values: GET /api/v1/payment-terms. Defaults to current account\r\n(id 1) when a customer is created without it.",
            "format": "int32"
          },
          "currencyId": {
            "type": "integer",
            "description": "Currency of the customer's current account. Allowed values: GET /api/v1/currencies.\r\nNull uses your account's default currency. It cannot be changed once the customer has\r\ncurrent-account entries in another currency.",
            "format": "int32",
            "nullable": true
          },
          "customerTypeId": {
            "type": "integer",
            "description": "Customer type. Allowed values: GET /api/v1/customer-types. Inactive types are rejected.",
            "format": "int32",
            "nullable": true
          },
          "priceListId": {
            "type": "integer",
            "description": "Price list id, or null to use the default one. Allowed values: GET /api/v1/price-lists —\r\nthey are data of your account, not a fixed set.",
            "format": "int32",
            "nullable": true
          },
          "salesRepId": {
            "type": "integer",
            "description": "Sales representative assigned to the customer. Allowed values: GET /api/v1/sales-reps.",
            "format": "int32",
            "nullable": true
          },
          "logisticsProviderId": {
            "type": "integer",
            "description": "Logistics provider that delivers to this customer. Allowed values:\r\nGET /api/v1/logistics-providers, which is empty unless your account uses logistics providers.",
            "format": "int32",
            "nullable": true
          },
          "brandId": {
            "type": "integer",
            "description": "Brand the customer belongs to. Allowed values: GET /api/v1/brands.",
            "format": "int32",
            "nullable": true
          },
          "taxSystem": {
            "maxLength": 3,
            "minLength": 0,
            "type": "string",
            "description": "Tax regime code (Mexico, SAT). Allowed values: GET /api/v1/tax-systems.",
            "nullable": true
          },
          "invoiceUse": {
            "maxLength": 3,
            "minLength": 0,
            "type": "string",
            "description": "CFDI use code (Mexico, SAT). Allowed values: GET /api/v1/invoice-uses.",
            "nullable": true
          },
          "paymentForm": {
            "maxLength": 2,
            "minLength": 0,
            "type": "string",
            "description": "Payment form code (Mexico, SAT). Allowed values: GET /api/v1/payment-forms. Not to be\r\nconfused with paymentTermsId, which is how the customer pays you (current account or cash).",
            "nullable": true
          },
          "paymentMethod": {
            "maxLength": 3,
            "minLength": 0,
            "type": "string",
            "description": "Payment method code (Mexico, SAT). Allowed values: GET /api/v1/payment-methods.",
            "nullable": true
          },
          "dispatchType": {
            "type": "integer",
            "description": "Dispatch type for electronic dispatch notes (Chile, SII). Allowed values:\r\nGET /api/v1/dispatch-types.",
            "format": "int32",
            "nullable": true
          },
          "businessActivity": {
            "maxLength": 40,
            "minLength": 0,
            "type": "string",
            "description": "Business activity (\"giro\", Chile). Free text, uppercase, up to 40 characters. It is not a\r\ncatalog: the tax authority expects the wording used when the taxpayer registered.",
            "nullable": true
          },
          "parentCustomerId": {
            "type": "integer",
            "description": "Parent customer id when this customer belongs to a group. Valid values are the ids of\r\ncustomers returned by GET /api/v1/customers. Leave it null and the customer gets its own\r\ncurrent account.",
            "format": "int32",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "False when the customer has been deactivated. Read-only: use /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A customer of your account."
      },
      "CustomerDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "CustomerLedgerEntryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Movement id.",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "description": "Date of the movement.",
            "format": "date-time"
          },
          "description": {
            "type": "string",
            "description": "What the movement is. Free text written by whoever generated it.",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "description": "Amount. Positive increases what the customer owes your account, negative reduces it — a\r\npayment is negative.",
            "format": "double"
          },
          "balance": {
            "type": "number",
            "description": "Balance after this movement.",
            "format": "double"
          },
          "previousBalance": {
            "type": "number",
            "description": "Balance before this movement.",
            "format": "double"
          },
          "orderNumber": {
            "type": "string",
            "description": "Order number this movement refers to, when it came from an order. Text only, not an id:\r\nto read the order, look it up in GET /api/v1/orders by date and match its number.",
            "nullable": true
          },
          "invoiceNumber": {
            "type": "string",
            "description": "Invoice number this movement refers to, when the order it came from has one.",
            "nullable": true
          },
          "deliveryNoteNumber": {
            "type": "string",
            "description": "Delivery note number this movement refers to, when it came from one. Text only, same\r\nreason as orderNumber.",
            "nullable": true
          },
          "currencyId": {
            "type": "integer",
            "description": "Currency of the movement.",
            "format": "int32",
            "nullable": true
          },
          "reconciled": {
            "type": "boolean",
            "description": "True when the movement has been reconciled against its counterpart."
          },
          "createdOn": {
            "type": "string",
            "description": "When the movement was recorded, which may differ from its date.",
            "format": "date-time"
          }
        },
        "additionalProperties": false,
        "description": "One movement in a customer's current account."
      },
      "CustomerLedgerEntryDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerLedgerEntryDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "CustomerTypeDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Customer type id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Required.",
            "nullable": true
          },
          "isSystem": {
            "type": "boolean",
            "description": "Read-only. System-defined types cannot be edited, deactivated or reactivated through\r\nthis resource."
          },
          "hasAssociatedCustomers": {
            "type": "boolean",
            "description": "Read-only. Whether any active customer currently uses this type."
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A customer type used to classify the customers of your account."
      },
      "CustomerTypeDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerTypeDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "DebtorDto": {
        "type": "object",
        "properties": {
          "customerId": {
            "type": "integer",
            "description": "The customer that owes. See GET /api/v1/customers/{customerId}.",
            "format": "int32"
          },
          "balance": {
            "type": "number",
            "description": "Total outstanding balance as of `asOf`, in the account's default currency (or in\r\ndollars when the request asked for non-default-currency customers only).",
            "format": "double"
          },
          "invoicedBalance": {
            "type": "number",
            "description": "The part of `balance` that has been invoiced. Null when not computed.",
            "format": "double",
            "nullable": true
          },
          "deliveryNoteBalance": {
            "type": "number",
            "description": "The part of `balance` not yet invoiced — delivered on a delivery note and still\r\nunbilled. Equal to `balance - invoicedBalance`; published already resolved so that\r\nboth sides of the split agree.",
            "format": "double"
          },
          "overdueDebt": {
            "type": "number",
            "description": "Part of the balance that is already past its due date.",
            "format": "double"
          },
          "kegsInPossession": {
            "type": "integer",
            "description": "How many of your kegs this customer is currently holding.",
            "format": "int32"
          },
          "lastPaymentDate": {
            "type": "string",
            "description": "When this customer last paid. Null if they never did.",
            "format": "date-time",
            "nullable": true
          },
          "lastPurchaseDate": {
            "type": "string",
            "description": "When this customer last bought.",
            "format": "date-time"
          },
          "debt1To14Days": {
            "type": "number",
            "description": "Debt between 1 and 14 days old.",
            "format": "double"
          },
          "debt15To29Days": {
            "type": "number",
            "description": "Debt between 15 and 29 days old.",
            "format": "double"
          },
          "debt30To44Days": {
            "type": "number",
            "description": "Debt between 30 and 44 days old.",
            "format": "double"
          },
          "debt45To59Days": {
            "type": "number",
            "description": "Debt between 45 and 59 days old.",
            "format": "double"
          },
          "debt60To89Days": {
            "type": "number",
            "description": "Debt between 60 and 89 days old.",
            "format": "double"
          },
          "debt90PlusDays": {
            "type": "number",
            "description": "Debt 90 days old or older.",
            "format": "double"
          }
        },
        "additionalProperties": false,
        "description": "A customer with an outstanding balance, with its debt broken down by age."
      },
      "DebtorDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DebtorDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "DeliveryNoteDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Delivery note id.",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "description": "Date of the delivery note.",
            "format": "date-time"
          },
          "number": {
            "type": "string",
            "description": "Its number, as printed.",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "description": "Free-text notes.",
            "nullable": true
          },
          "total": {
            "type": "number",
            "description": "Total of the delivery note, when it carries one.",
            "format": "double",
            "nullable": true
          },
          "customerId": {
            "type": "integer",
            "description": "The customer it was delivered to. Allowed values: GET /api/v1/customers.",
            "format": "int32",
            "nullable": true
          },
          "supplierId": {
            "type": "integer",
            "description": "The supplier it was delivered to. Allowed values: GET /api/v1/suppliers.",
            "format": "int32",
            "nullable": true
          },
          "orderId": {
            "type": "integer",
            "description": "The order this delivery note fulfils, when it has one. Read it with\r\nGET /api/v1/orders/{orderId} (orders are read-only).",
            "format": "int32",
            "nullable": true
          },
          "originWarehouseId": {
            "type": "integer",
            "description": "Origin warehouse on a transfer. Allowed values: GET /api/v1/warehouses.",
            "format": "int32",
            "nullable": true
          },
          "destinationWarehouseId": {
            "type": "integer",
            "description": "Destination warehouse on a transfer. Allowed values: GET /api/v1/warehouses.",
            "format": "int32",
            "nullable": true
          },
          "address": {
            "type": "string",
            "description": "Delivery address written on the note.",
            "nullable": true
          },
          "deliveredAt": {
            "type": "string",
            "description": "When it was actually delivered, if recorded.",
            "format": "date-time",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Whether the delivery note is active."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeliveryNoteItemDto"
            },
            "description": "The items. Only populated on GET /delivery-notes/{id}: a note has several, so returning\r\nthem in a page would multiply rows and the total would stop matching.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A delivery note: what physically left, and to whom."
      },
      "DeliveryNoteDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeliveryNoteDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "DeliveryNoteItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Line id.",
            "format": "int32"
          },
          "productId": {
            "type": "integer",
            "description": "The product delivered, if the line is a product. Allowed values: GET /api/v1/products.",
            "format": "int32",
            "nullable": true
          },
          "supplyId": {
            "type": "integer",
            "description": "The supply delivered, if the line is a supply. Allowed values: GET /api/v1/supplies.",
            "format": "int32",
            "nullable": true
          },
          "kegId": {
            "type": "integer",
            "description": "The keg delivered, if the line is a keg. Allowed values: GET /api/v1/kegs.",
            "format": "int32",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "description": "Quantity delivered.",
            "format": "double"
          },
          "description": {
            "type": "string",
            "description": "What the line says, as written on the note.",
            "nullable": true
          },
          "unitPriceWithoutTax": {
            "type": "number",
            "description": "Unit price without taxes, when the line carries one.",
            "format": "double",
            "nullable": true
          },
          "batchId": {
            "type": "integer",
            "description": "The batch it came from, when it has one. Allowed values: GET /api/v1/batches.",
            "format": "int32",
            "nullable": true
          },
          "batchNumber": {
            "type": "string",
            "description": "Batch number as text, when recorded.",
            "nullable": true
          },
          "packagingId": {
            "type": "integer",
            "description": "The packaging format. Allowed values: GET /api/v1/packagings.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One line of a delivery note."
      },
      "DistributorPurchaseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Purchase id.",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "description": "Purchase date, `yyyy-MM-dd`.",
            "nullable": true
          },
          "dueDate": {
            "type": "string",
            "description": "Payment due date, `yyyy-MM-dd`. Null when the purchase has none.",
            "nullable": true
          },
          "supplierId": {
            "type": "integer",
            "description": "The supplier the kegs were bought from. See `/suppliers`.",
            "format": "int32"
          },
          "supplierName": {
            "type": "string",
            "description": "Display name of that supplier.",
            "nullable": true
          },
          "subtotal": {
            "type": "number",
            "description": "Amount before taxes.",
            "format": "double"
          },
          "taxes": {
            "type": "number",
            "description": "Taxes.",
            "format": "double"
          },
          "internalTaxes": {
            "type": "number",
            "description": "Internal taxes.",
            "format": "double"
          },
          "total": {
            "type": "number",
            "description": "Total amount of the purchase.",
            "format": "double"
          },
          "paid": {
            "type": "number",
            "description": "How much of the total has been paid so far.",
            "format": "double"
          },
          "invoiceNumber": {
            "type": "string",
            "description": "Invoice number, as recorded.",
            "nullable": true
          },
          "deliveryNoteNumber": {
            "type": "string",
            "description": "Delivery note number, as recorded.",
            "nullable": true
          },
          "currencyId": {
            "type": "integer",
            "description": "Currency of every amount here. See `/currencies`.",
            "format": "int32"
          },
          "warehouseId": {
            "type": "integer",
            "description": "Warehouse the goods went into. See `/warehouses`.",
            "format": "int32",
            "nullable": true
          },
          "kegPurchaseOrderId": {
            "type": "integer",
            "description": "The keg purchase order this purchase fulfils, if any. See `/keg-purchase-orders`.",
            "format": "int32",
            "nullable": true
          },
          "kegPurchaseOrderNumber": {
            "type": "string",
            "description": "Number of that order, as recorded on it.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "False when the purchase has been cancelled."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DistributorPurchaseLineDto"
            },
            "description": "The purchase's lines, one per item bought.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A purchase of kegs, containers, cases or mix packs from a supplier, made by a distributor."
      },
      "DistributorPurchaseDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DistributorPurchaseDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "DistributorPurchaseLineDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Line id.",
            "format": "int32"
          },
          "kind": {
            "type": "string",
            "description": "One of `keg`, `container`, `case` or `mixPack`.",
            "nullable": true
          },
          "productId": {
            "type": "integer",
            "description": "The product bought. See `/products`.",
            "format": "int32"
          },
          "productName": {
            "type": "string",
            "description": "Display name of that product.",
            "nullable": true
          },
          "productStyle": {
            "type": "string",
            "description": "Style of that product.",
            "nullable": true
          },
          "quantity": {
            "type": "integer",
            "description": "How many units this line covers.",
            "format": "int32"
          },
          "litres": {
            "type": "number",
            "description": "Litres of the item.",
            "format": "double"
          },
          "cost": {
            "type": "number",
            "description": "Cost of the line, in the purchase's currency.",
            "format": "double",
            "nullable": true
          },
          "code": {
            "type": "string",
            "description": "Your own code for the keg. Only on a `keg` line.",
            "nullable": true
          },
          "supplierCode": {
            "type": "string",
            "description": "The supplier's code for the keg. Only on a `keg` line.",
            "nullable": true
          },
          "supplierBatchNumber": {
            "type": "string",
            "description": "The supplier's batch number, as recorded.",
            "nullable": true
          },
          "kegId": {
            "type": "integer",
            "description": "The keg this line created or reused. Only on a `keg` line. See `/kegs`.",
            "format": "int32",
            "nullable": true
          },
          "containerId": {
            "type": "integer",
            "description": "Container bought. Only on a `container` line. See `/containers`.",
            "format": "int32",
            "nullable": true
          },
          "containerName": {
            "type": "string",
            "description": "Display name of that container.",
            "nullable": true
          },
          "caseId": {
            "type": "integer",
            "description": "Case bought. Only on a `case` line. See `/cases`.",
            "format": "int32",
            "nullable": true
          },
          "caseName": {
            "type": "string",
            "description": "Display name of that case.",
            "nullable": true
          },
          "expiryDate": {
            "type": "string",
            "description": "Expiry date of the goods, `yyyy-MM-dd`. Null when the line has none.",
            "nullable": true
          },
          "kegPurchaseOrderLineId": {
            "type": "integer",
            "description": "Write-only. The line of the keg purchase order this line fulfils, so that the order\r\nadvances. Always null when reading: the purchase's own lines do not store it.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One item bought in a distributor purchase."
      },
      "DistributorServiceAssignmentDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Assignment id. Omit it to create a new assignment. An entry you send <b>with</b> an id\r\nis kept exactly as it is — to change one, leave it out and send a new entry.",
            "format": "int32"
          },
          "customerId": {
            "type": "integer",
            "description": "The customer receiving the service. See `/customers`.",
            "format": "int32"
          },
          "customerName": {
            "type": "string",
            "description": "Read-only. Display name of that customer.",
            "nullable": true
          },
          "serviceId": {
            "type": "integer",
            "description": "The service provided. See `/distributor-services`.",
            "format": "int32"
          },
          "serviceName": {
            "type": "string",
            "description": "Read-only. Name of that service.",
            "nullable": true
          },
          "date": {
            "type": "string",
            "description": "Read-only. When the assignment was created, `yyyy-MM-dd`.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Which service a distributor provides to a customer on a supplier's behalf."
      },
      "DistributorServiceAssignmentsDto": {
        "type": "object",
        "properties": {
          "assignments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DistributorServiceAssignmentDto"
            },
            "description": "Every assignment this supplier should end up with. The collection is replaced whole:\r\nanything you leave out is deactivated, and an empty array clears them all.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "The whole set of assignments of one supplier."
      },
      "DistributorServiceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Service id.",
            "format": "int32"
          },
          "name": {
            "maxLength": 100,
            "minLength": 0,
            "type": "string",
            "description": "The service's name. Unique within your account.",
            "nullable": true
          },
          "levels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DistributorServiceLevelDto"
            },
            "description": "The service's tiers. Sending it REPLACES the whole collection; omitting it keeps the\r\ncurrent one. An entry with an `id` is updated, one without is created, and one you\r\nleave out is deactivated.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A service a distributor provides on a supplier's behalf, and the tiers by which it is paid."
      },
      "DistributorServiceDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DistributorServiceDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "DistributorServiceLevelDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Tier id. Omit it to create a new tier.",
            "format": "int32"
          },
          "litresPerMonth": {
            "type": "integer",
            "description": "Litres a month from which this tier applies.",
            "format": "int32"
          },
          "pricePerLitre": {
            "type": "number",
            "description": "What the distributor is paid per litre in this tier.",
            "format": "double",
            "nullable": true
          },
          "collectionCommissionPercent": {
            "type": "number",
            "description": "Commission on what was collected, as a percentage.",
            "format": "double",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One tier of a distributor service."
      },
      "DistributorServiceSettlementDto": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "description": "The date the run settled up to, `yyyy-MM-dd`. It identifies the run.",
            "nullable": true
          },
          "days": {
            "type": "integer",
            "description": "How many days the settled period covered.",
            "format": "int32"
          },
          "litresPerMonth": {
            "type": "integer",
            "description": "Litres a month the run was based on, across every supplier.",
            "format": "int32"
          },
          "total": {
            "type": "number",
            "description": "What the run charged in total, across every supplier.",
            "format": "double"
          }
        },
        "additionalProperties": false,
        "description": "One settlement run: what the distributor charged its suppliers on a given date."
      },
      "DistributorServiceSettlementDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DistributorServiceSettlementDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "DistributorServiceSettlementSupplierDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Settlement id, for this supplier in this run.",
            "format": "int32"
          },
          "supplierId": {
            "type": "integer",
            "description": "The supplier charged. See `/suppliers`.",
            "format": "int32"
          },
          "supplierName": {
            "type": "string",
            "description": "Display name of that supplier.",
            "nullable": true
          },
          "days": {
            "type": "integer",
            "description": "How many days the settled period covered for this supplier.",
            "format": "int32"
          },
          "litresPerMonth": {
            "type": "integer",
            "description": "Litres a month this supplier's commission was based on.",
            "format": "int32"
          },
          "amount": {
            "type": "number",
            "description": "What this supplier was charged.",
            "format": "double"
          },
          "description": {
            "type": "string",
            "description": "Human-readable breakdown of the charge, as it was written on the delivery note when the\r\nrun happened. It is text in the language of whoever ran it — do not parse it.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "What one supplier was charged in a settlement run."
      },
      "EventCategoryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Category id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Required.",
            "nullable": true
          },
          "color": {
            "type": "string",
            "description": "Optional. When not sent on an event that uses this category, the event takes this\r\ncategory's color instead.",
            "nullable": true
          },
          "isGlobal": {
            "type": "boolean",
            "description": "Read-only. A global category is defined by the platform and shared by every account —\r\nit cannot be edited, deactivated or reactivated through this resource."
          },
          "hasAssociatedEvents": {
            "type": "boolean",
            "description": "Read-only. Whether any calendar event currently uses this category."
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A category used to classify a calendar event (`calendar-events`)."
      },
      "EventCategoryDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventCategoryDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "ExcludeDateRequestDto": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "description": "Required. `yyyy-MM-dd`.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Body of `POST /calendar-events/recurring/{id}/exclude-date`."
      },
      "ExternalUserDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Link id.",
            "format": "int32"
          },
          "customerId": {
            "type": "integer",
            "description": "The customer this link belongs to. See `/customers`.",
            "format": "int32"
          },
          "email": {
            "type": "string",
            "description": "Read-only. The email address used to log in to the portal.",
            "nullable": true
          },
          "franchise": {
            "type": "boolean",
            "description": "Grants franchise-wide access."
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changes only through `/activate`/`/deactivate`."
          },
          "canViewStock": {
            "type": "boolean",
            "description": "Whether this customer can see stock."
          },
          "canViewComplementary": {
            "type": "boolean",
            "description": "Whether this customer can see complementary/related products."
          },
          "canViewPrices": {
            "type": "boolean",
            "description": "Whether this customer can see prices."
          },
          "includeTaxInOrders": {
            "type": "boolean",
            "description": "Whether orders placed by this customer include tax."
          },
          "removeOrderDetails": {
            "type": "boolean",
            "description": "Whether order line details are hidden from this customer."
          },
          "applyCustomerDiscount": {
            "type": "boolean",
            "description": "Whether this customer's own discount is applied to their orders."
          }
        },
        "additionalProperties": false,
        "description": "A customer's link to their own portal account in your cervecería. This is the per-account\r\nlink (`UsuarioExternoCliente`), not the customer's global login identity — the\r\nlogin's own credentials (password, reset token) are never exposed through this API."
      },
      "ExternalUserDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExternalUserDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "ExternalUserProductDto": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "integer",
            "description": "The product this configuration belongs to. See `/products`.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Read-only. The product's name.",
            "nullable": true
          },
          "style": {
            "type": "string",
            "description": "Read-only. The product's style.",
            "nullable": true
          },
          "isMixPack": {
            "type": "boolean",
            "description": "Read-only. Mix packs have a single presentation, never containers or cases."
          },
          "isComplementary": {
            "type": "boolean",
            "description": "Read-only. Complementary products have a single presentation too."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether the product is published to the portal under price lists 1 and 2. Derived from\r\nthe product-level presentation having a price list assigned."
          },
          "enabledForCategoryList": {
            "type": "boolean",
            "description": "Whether the product is published under price list 3, which only applies to customers in\r\nthe category configured for your account."
          },
          "presentations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExternalUserProductPresentationDto"
            },
            "description": "Read-only here. One entry per presentation the product is sold in: the product itself,\r\neach keg volume, each container and each case.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Which of your products are published to the customer portal, and in which presentations."
      },
      "ExternalUserProductDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExternalUserProductDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "ExternalUserProductHistoryEntryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "History entry id.",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "description": "When the change happened, ISO 8601.",
            "nullable": true
          },
          "userId": {
            "type": "integer",
            "description": "Id of the user who made the change.",
            "format": "int32"
          },
          "userName": {
            "type": "string",
            "description": "Display name of the user who made the change.",
            "nullable": true
          },
          "productId": {
            "type": "integer",
            "description": "The product whose assignment changed. See `/products`.",
            "format": "int32"
          },
          "productName": {
            "type": "string",
            "description": "Display name of that product.",
            "nullable": true
          },
          "kind": {
            "type": "string",
            "description": "One of `product`, `keg`, `container` or `case`.",
            "nullable": true
          },
          "litres": {
            "type": "number",
            "description": "Keg volume in litres, when GCerv.Api.Dto.ExternalUserProductHistoryEntryDto.kind is `keg`.",
            "format": "double",
            "nullable": true
          },
          "containerId": {
            "type": "integer",
            "description": "Container, when GCerv.Api.Dto.ExternalUserProductHistoryEntryDto.kind is `container`.",
            "format": "int32",
            "nullable": true
          },
          "containerName": {
            "type": "string",
            "description": "Display name of that container.",
            "nullable": true
          },
          "caseId": {
            "type": "integer",
            "description": "Case, when GCerv.Api.Dto.ExternalUserProductHistoryEntryDto.kind is `case`.",
            "format": "int32",
            "nullable": true
          },
          "caseName": {
            "type": "string",
            "description": "Display name of that case.",
            "nullable": true
          },
          "previousValue": {
            "type": "string",
            "description": "Opaque, human-readable description of the state before the change.",
            "nullable": true
          },
          "newValue": {
            "type": "string",
            "description": "Opaque, human-readable description of the state after the change.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One change to the portal assignment of a product: who published or unpublished what, and\r\nwhen."
      },
      "ExternalUserProductHistoryEntryDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExternalUserProductHistoryEntryDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "ExternalUserProductPresentationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Presentation id.",
            "format": "int32"
          },
          "kind": {
            "type": "string",
            "description": "One of `product`, `keg`, `container` or `case`.",
            "nullable": true
          },
          "litres": {
            "type": "number",
            "description": "Keg volume in litres, when GCerv.Api.Dto.ExternalUserProductPresentationDto.kind is `keg`. See `/keg-volumes`.",
            "format": "double",
            "nullable": true
          },
          "containerId": {
            "type": "integer",
            "description": "Container, when GCerv.Api.Dto.ExternalUserProductPresentationDto.kind is `container`. See `/containers`.",
            "format": "int32",
            "nullable": true
          },
          "caseId": {
            "type": "integer",
            "description": "Case, when GCerv.Api.Dto.ExternalUserProductPresentationDto.kind is `case`. See `/cases`.",
            "format": "int32",
            "nullable": true
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether this presentation is published under price lists 1 and 2."
          },
          "enabledForCategoryList": {
            "type": "boolean",
            "description": "Whether this presentation is published under price list 3."
          },
          "minimumPurchaseQuantity": {
            "type": "integer",
            "description": "Smallest quantity a portal customer may order of this presentation.",
            "format": "int32",
            "nullable": true
          },
          "portalStock": {
            "type": "number",
            "description": "Stock available to portal customers for this presentation. `null` means it has\r\nnever been set, which is not the same as having been set to zero.",
            "format": "double",
            "nullable": true
          },
          "updatedAt": {
            "type": "string",
            "description": "Read-only. When this presentation was last changed, `yyyy-MM-dd`.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One presentation of a product in the customer portal: the product itself, a keg volume, a\r\ncontainer or a case."
      },
      "FileDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "File id.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Original file name.",
            "nullable": true
          },
          "contentType": {
            "type": "string",
            "description": "MIME type, as uploaded.",
            "nullable": true
          },
          "entityType": {
            "type": "string",
            "description": "Free text — the type of entity this file is attached to, e.g. `\"Cliente\"`. Not a\r\nforeign key: there is no catalog to validate it against.",
            "nullable": true
          },
          "entityId": {
            "type": "string",
            "description": "Free text — the id of the entity this file is attached to, in whatever form the uploader used.",
            "nullable": true
          },
          "fileType": {
            "type": "string",
            "description": "Free text — a category for the file itself, e.g. `\"invoice\"`. Not related to `entityType`.",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "Free text.",
            "nullable": true
          },
          "date": {
            "type": "string",
            "description": "When the file was uploaded, ISO 8601.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Always `true` today: there is no un-deactivate path."
          }
        },
        "additionalProperties": false,
        "description": "An uploaded file's metadata. Read-only — `GET` and the response of `POST` only.\r\nThe actual content is fetched separately via `GET /files/{id}/content`."
      },
      "InvitationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Invitation id.",
            "format": "int32"
          },
          "customerId": {
            "type": "integer",
            "description": "The customer being invited. Must be one of your account's own — see `/customers`.",
            "format": "int32"
          },
          "email": {
            "type": "string",
            "description": "The email address the invitation was sent to.",
            "nullable": true
          },
          "franchise": {
            "type": "boolean",
            "description": "Whether this invitation also grants franchise-wide access."
          },
          "canViewStock": {
            "type": "boolean",
            "description": "Whether the invited user will be able to see stock."
          },
          "date": {
            "type": "string",
            "description": "When the invitation was created, ISO 8601.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A customer portal invitation, created via `POST /invitations`. Read-only — there is no\r\n`GET` to list or fetch one back (the web application itself has no such screen either,\r\nonly a count — see `GET /invitations/quota`)."
      },
      "InvitationQuotaDto": {
        "type": "object",
        "properties": {
          "used": {
            "type": "integer",
            "description": "How many invitations your account has sent so far.",
            "format": "int32"
          },
          "limit": {
            "type": "integer",
            "description": "Your account's configured limit.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "`GET /invitations/quota`. Informational only — the API does not block sending more invitations than `limit`."
      },
      "KegCleanRequestDto": {
        "type": "object",
        "properties": {
          "kegIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "The kegs to mark clean. Each must currently be marked dirty.",
            "nullable": true
          },
          "warehouseId": {
            "type": "integer",
            "description": "Supply warehouse the consumed supplies come out of. Listed by\r\n`GET /api/v1/supply-warehouses`. Ignored when `supplies` is empty.",
            "format": "int32",
            "nullable": true
          },
          "supplies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KegCleanSupplyLineRequestDto"
            },
            "description": "Supplies consumed while cleaning (detergent, sanitizer, etc.), if your account tracks\r\nthat. Omit or leave empty to mark the kegs clean without moving any supply stock.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Marking one or more kegs as clean, ready to be filled again."
      },
      "KegCleanSupplyLineRequestDto": {
        "type": "object",
        "properties": {
          "supplyId": {
            "type": "integer",
            "description": "Supply consumed. Listed by `GET /api/v1/supplies`.",
            "format": "int32"
          },
          "quantity": {
            "type": "number",
            "description": "Amount consumed. Always positive — a cleaning line is always an exit, so there's no sign\r\nto choose (unlike `POST /supplies/{id}/stock/adjustments`, which moves stock either way).",
            "format": "double"
          },
          "unitId": {
            "type": "integer",
            "description": "Unit `quantity` is expressed in. Omit to use the supply's own unit.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One supply consumed while cleaning."
      },
      "KegDiscardRequestDto": {
        "type": "object",
        "properties": {
          "forMaintenance": {
            "type": "boolean",
            "description": "True when the discard is part of sending the keg to maintenance."
          }
        },
        "additionalProperties": false,
        "description": "Discards the product currently in a keg — a write-off, not a normal emptying."
      },
      "KegDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Keg id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "code": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "The code printed or tagged on the keg. Required on create, and unique among your kegs.",
            "nullable": true
          },
          "liters": {
            "type": "number",
            "description": "Nominal capacity, in liters. Locked once the keg holds product or is at a customer.",
            "format": "double"
          },
          "actualLiters": {
            "type": "number",
            "description": "Read-only. How much it actually holds right now, in liters.",
            "format": "double",
            "nullable": true
          },
          "connector": {
            "type": "string",
            "description": "Valve/connector type: `G`, `A`, `S`, `K`, `D`, `CO` (Cornelius\r\nball lock), `CP` (Cornelius pin lock), `U` or `M`. Fixed set, not a catalog\r\nendpoint — same reason as `itemType` of `stock-movements`.",
            "nullable": true
          },
          "kegTypeId": {
            "type": "integer",
            "description": "Kind of keg. Required on create (defaults to DIN when omitted, same as the application). Listed by `GET /api/v1/keg-types`.",
            "format": "int32"
          },
          "kegTypeName": {
            "type": "string",
            "description": "Read-only. Name of that kind, in the language of your token.",
            "nullable": true
          },
          "warehouseId": {
            "type": "integer",
            "description": "The warehouse it's stored at when it isn't with a customer. Listed by `GET /api/v1/warehouses`.",
            "format": "int32",
            "nullable": true
          },
          "warehouseName": {
            "type": "string",
            "description": "Read-only. Name of that warehouse.",
            "nullable": true
          },
          "supplierId": {
            "type": "integer",
            "description": "The supplier that owns the keg, when it is not yours. Listed by `GET /api/v1/suppliers`.",
            "format": "int32",
            "nullable": true
          },
          "supplierName": {
            "type": "string",
            "description": "Read-only. Name of that supplier.",
            "nullable": true
          },
          "supplierCode": {
            "maxLength": 20,
            "minLength": 0,
            "type": "string",
            "description": "The supplier's own code for the keg. Required when `supplierId` is set. Only actually\r\nupdated on accounts with the distributor feature on — sent-but-ignored otherwise, same as\r\nthe application's own screen.",
            "nullable": true
          },
          "serialNumber": {
            "maxLength": 100,
            "minLength": 0,
            "type": "string",
            "description": "Serial number, free text.",
            "nullable": true
          },
          "status": {
            "type": "string",
            "description": "Read-only. Current status: `ok`, `atCustomer`, `underMaintenance` or\r\n`beingCleaned`. Who exactly has it, or what it's filled with, isn't published yet —\r\nsee the remark on the class.",
            "nullable": true
          },
          "availableForStock": {
            "type": "boolean",
            "description": "Read-only. False when the keg is set aside from stock counts (damaged, lost, written off)."
          },
          "customerId": {
            "type": "integer",
            "description": "Read-only. The customer currently holding the keg, when `status` is\r\n`atCustomer`. Listed by `GET /api/v1/customers`. To move it, see\r\n`POST /api/v1/kegs/transfers`.",
            "format": "int32",
            "nullable": true
          },
          "customerName": {
            "type": "string",
            "description": "Read-only. Name of that customer.",
            "nullable": true
          },
          "customerLocationId": {
            "type": "integer",
            "description": "Read-only. The customer's point of sale holding the keg, when it has one. Listed by\r\n`GET /api/v1/customers/{customerId}/points-of-sale`.",
            "format": "int32",
            "nullable": true
          },
          "reservedForOrderId": {
            "type": "integer",
            "description": "Read-only. The order this keg is set aside for, if any. Read it with `GET /api/v1/orders/{orderId}`; release it with `POST /api/v1/kegs/{id}/release-reservation`.",
            "format": "int32",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A keg: a reusable container tracked by code as it moves between your warehouses and customers."
      },
      "KegDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KegDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "KegEmptyRequestDto": {
        "type": "object",
        "properties": {
          "warehouseId": {
            "type": "integer",
            "description": "Warehouse to relocate the keg to, now that it's empty. Listed by `GET /api/v1/warehouses`. Omit to leave it where it is.",
            "format": "int32",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "description": "Free-text note.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Empties a keg: records that its product left it, and clears the keg's contents."
      },
      "KegMovementDto": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "description": "When the movement happened.",
            "format": "date-time"
          },
          "productName": {
            "type": "string",
            "description": "The product involved, if any (name and style combined, or the complementary product's own name).",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "What happened — kind of movement plus a short detail, already combined server-side.",
            "nullable": true
          },
          "batchLabel": {
            "type": "string",
            "description": "The batch involved, if any. Null when the movement isn't tied to one.",
            "nullable": true
          },
          "liters": {
            "type": "number",
            "description": "Liters moved. Null when the movement didn't move a specific quantity.",
            "format": "double",
            "nullable": true
          },
          "username": {
            "type": "string",
            "description": "Who recorded the movement.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "False when this movement was later reverted (e.g. an undone return or cleaning)."
          }
        },
        "additionalProperties": false,
        "description": "One entry in a keg's movement history: fills, empties, cleanings, transfers and more."
      },
      "KegPurchaseOrderDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Keg purchase order id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "supplierId": {
            "type": "integer",
            "description": "Supplier this order is for. Required. Allowed values: GET /api/v1/suppliers.",
            "format": "int32",
            "nullable": true
          },
          "number": {
            "type": "string",
            "description": "Read-only. Assigned by the server on create, sequential per account.",
            "nullable": true
          },
          "date": {
            "type": "string",
            "description": "Order date, ISO 8601. Defaults to now when creating.",
            "nullable": true
          },
          "deliveryDate": {
            "type": "string",
            "description": "Expected delivery date, ISO 8601. Optional.",
            "nullable": true
          },
          "applied": {
            "type": "boolean",
            "description": "Read-only. True once at least one delivery has been registered against this order."
          },
          "completed": {
            "type": "boolean",
            "description": "Read-only. True once every line has nothing left pending — set automatically, there is no\r\nmanual close for this resource."
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          },
          "detailLines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KegPurchaseOrderLineDto"
            },
            "description": "The order's lines. Replaces the entire collection when sent — see the remark on the class.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A keg purchase order: an intent to buy kegged product from a distributor's supplier."
      },
      "KegPurchaseOrderDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KegPurchaseOrderDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "KegPurchaseOrderLineDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Line id. Read-only: reported on GET, ignored on write.",
            "format": "int32"
          },
          "productId": {
            "type": "integer",
            "description": "Product to buy. Required. Allowed values: GET /api/v1/products.",
            "format": "int32",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "Free-form description of the line, as printed on the order.",
            "nullable": true
          },
          "quantity": {
            "type": "integer",
            "description": "How many kegs. Must be greater than zero.",
            "format": "int32"
          },
          "deliveredQuantity": {
            "type": "integer",
            "description": "Read-only. How many of this line have already been delivered.",
            "format": "int32"
          },
          "remainingQuantity": {
            "type": "integer",
            "description": "Read-only. quantity minus deliveredQuantity.",
            "format": "int32"
          },
          "liters": {
            "type": "number",
            "description": "Litres per keg on this line.",
            "format": "double"
          },
          "containerId": {
            "type": "integer",
            "description": "Container (individual sales format) this line is for, if any. Mutually exclusive with\r\ncaseId. Allowed values: GET /api/v1/containers.",
            "format": "int32",
            "nullable": true
          },
          "caseId": {
            "type": "integer",
            "description": "Case (grouped sales format) this line is for, if any. Mutually exclusive with\r\ncontainerId. Allowed values: GET /api/v1/cases.",
            "format": "int32",
            "nullable": true
          },
          "costPerLiter": {
            "type": "number",
            "description": "Read-only. The product's cost per litre at the time the line was saved.",
            "format": "double",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One line of a keg purchase order: which product, how many kegs, at what expected format."
      },
      "KegReleaseReservationRequestDto": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "integer",
            "description": "The order the keg is currently reserved for. Rejected if it doesn't match.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "Releases a keg set aside for an order, without moving it."
      },
      "KegReturnRequestDto": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "description": "When the keg was returned, ISO 8601. Rejected if it's in the future, before the keg left\r\nfor the customer, before the keg was created, or more than 180 days in the past.",
            "nullable": true
          },
          "returnedFull": {
            "type": "boolean",
            "description": "True when the keg came back still full (not consumed). False when it came back empty."
          },
          "returnsToStock": {
            "type": "boolean",
            "description": "Only meaningful when `returnedFull` is true: whether the product returns to sellable\r\nstock. When false and the account isn't a distributor, the product is discarded."
          },
          "fullReturnReasonId": {
            "type": "integer",
            "description": "Why it came back full. Only used when `returnedFull` is true. Listed by `GET /api/v1/reasons/keg-return`.",
            "format": "int32",
            "nullable": true
          },
          "notes": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Free-text note.",
            "nullable": true
          },
          "warehouseId": {
            "type": "integer",
            "description": "Warehouse to move the keg to. Listed by `GET /api/v1/warehouses`. Omit to leave it where it is.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A customer returning a keg to you."
      },
      "KegSupplierReturnLineRequestDto": {
        "type": "object",
        "properties": {
          "kegId": {
            "type": "integer",
            "description": "Keg id.",
            "format": "int32"
          },
          "returnedFull": {
            "type": "boolean",
            "description": "True when it's returned still full."
          }
        },
        "additionalProperties": false,
        "description": "One keg being returned to a supplier."
      },
      "KegSupplierReturnRequestDto": {
        "type": "object",
        "properties": {
          "supplierId": {
            "type": "integer",
            "description": "The supplier the kegs are being returned to. Listed by `GET /api/v1/suppliers`.",
            "format": "int32"
          },
          "notes": {
            "type": "string",
            "description": "Free-text note.",
            "nullable": true
          },
          "kegs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KegSupplierReturnLineRequestDto"
            },
            "description": "The kegs to return.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Returning one or more kegs to a supplier."
      },
      "KegTransferRequestDto": {
        "type": "object",
        "properties": {
          "destinationCustomerId": {
            "type": "integer",
            "description": "Destination customer. Listed by `GET /api/v1/customers`.",
            "format": "int32"
          },
          "destinationCustomerLocationId": {
            "type": "integer",
            "description": "Destination point of sale, if the customer has more than one. Listed by `GET /api/v1/customers/{customerId}/points-of-sale`.",
            "format": "int32",
            "nullable": true
          },
          "date": {
            "type": "string",
            "description": "When the transfer happened, ISO 8601. Not in the future, and not before the keg arrived at its current customer.",
            "nullable": true
          },
          "notes": {
            "maxLength": 200,
            "minLength": 0,
            "type": "string",
            "description": "Free-text note. At most 200 characters.",
            "nullable": true
          },
          "kegIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "The kegs to move. All must currently be at the same customer and point of sale.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A transfer of one or more kegs, currently at a customer, to another customer."
      },
      "KegUndoCleanRequestDto": {
        "type": "object",
        "properties": {
          "kegIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "The kegs to revert.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Undoing the most recent cleaning of one or more kegs."
      },
      "LeadCommentDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Comment id.",
            "format": "int32"
          },
          "text": {
            "type": "string",
            "description": "The comment text.",
            "nullable": true
          },
          "userId": {
            "type": "integer",
            "description": "Id of the user who logged the comment.",
            "format": "int32"
          },
          "userName": {
            "type": "string",
            "description": "Display name of the user who logged the comment.",
            "nullable": true
          },
          "date": {
            "type": "string",
            "description": "When the comment was logged, ISO 8601.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A comment logged against a lead. Read-only — created via `POST /leads/{id}/comments` only."
      },
      "LeadCommentDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadCommentDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "LeadDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Lead id. Assigned by the server; ignored on create.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Contact's name. At least one of `name`, `phone` or `email` is required.",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "description": "At least one of `name`, `phone` or `email` is required.",
            "nullable": true
          },
          "email": {
            "type": "string",
            "description": "At least one of `name`, `phone` or `email` is required.",
            "nullable": true
          },
          "source": {
            "type": "string",
            "description": "Where the lead came from — free text. Defaults to `\"Manual\"` when omitted on create.",
            "nullable": true
          },
          "businessName": {
            "type": "string",
            "description": "The prospect's business name.",
            "nullable": true
          },
          "businessType": {
            "type": "string",
            "description": "Kind of business or venue — free text.",
            "nullable": true
          },
          "city": {
            "type": "string",
            "description": "Free text.",
            "nullable": true
          },
          "salesRepId": {
            "type": "integer",
            "description": "The user handling this lead. Omit it on create to leave it unassigned — unless the\r\nintegration user itself has the salesperson role, in which case it is self-assigned\r\n(same as the web application; never happens for a token-based integration).",
            "format": "int32",
            "nullable": true
          },
          "contactedAt": {
            "type": "string",
            "description": "Read-only. When the lead was first captured, ISO 8601.",
            "nullable": true
          },
          "lastContactedAt": {
            "type": "string",
            "description": "Read-only. Last time a sales rep contacted this lead, ISO 8601. Changed only by the contact actions.",
            "nullable": true
          },
          "nextContactAt": {
            "type": "string",
            "description": "Read-only. Next scheduled contact, ISO 8601. Changed only by the schedule action.",
            "nullable": true
          },
          "inactiveManual": {
            "type": "boolean",
            "description": "Read-only. Manually flagged inactive. Changed only by the set-inactive action."
          },
          "isInactive": {
            "type": "boolean",
            "description": "Read-only, computed. True when the lead is not converted and either `inactiveManual`\r\nis set or too many days passed since the last contact (the threshold is per user, not\r\nper account — see `GET /leads/settings`)."
          },
          "daysSinceLastContact": {
            "type": "integer",
            "description": "Read-only, computed. Days since `lastContactedAt` (or `contactedAt` if there was none).",
            "format": "int32"
          },
          "lastNote": {
            "type": "string",
            "description": "Read-only. The most recent comment's text, if any. See `GET /leads/{id}/comments` for the full history.",
            "nullable": true
          },
          "customerId": {
            "type": "integer",
            "description": "Read-only. The customer this lead was converted into. Set only by the convert action.",
            "format": "int32",
            "nullable": true
          },
          "convertedAt": {
            "type": "string",
            "description": "Read-only. When the conversion happened, ISO 8601.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. The web application has no way to deactivate a lead — this is always\r\n`true` today, exposed for forward compatibility only."
          }
        },
        "additionalProperties": false,
        "description": "A sales lead — a prospective customer captured before they become a `customers` record."
      },
      "LeadDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "LeadSettingsDto": {
        "type": "object",
        "properties": {
          "inactiveAfterDays": {
            "type": "integer",
            "description": "Days without contact before a non-converted lead is considered inactive (feeds\r\n`isInactive`). Required on `PUT`, 0-3650. Defaults to 30 when never set.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "`GET`/`PUT /leads/settings`. This one setting is per integration user, not per\r\n            account — same as the web application, where each sales rep has their own threshold."
      },
      "LoginRequest": {
        "type": "object",
        "properties": {
          "apiKey": {
            "type": "string",
            "description": "Your account's API key. There is no user name and no password: the key identifies the\r\naccount and is the only credential. The account owner finds it in Settings.",
            "nullable": true
          },
          "deviceName": {
            "type": "string",
            "description": "Free-form client identifier, e.g. \"partner-acme-prod\". Used for auditing and selective revocation.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "The API key of your account."
      },
      "MaintenanceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "assetType": {
            "type": "string",
            "description": "One of `tank`, `keg`, `tapSystem`, `breweryAsset`. Required on create.\r\nRead-only afterwards: there is no way to move a maintenance to a different asset once\r\ncreated, same as the web application.",
            "nullable": true
          },
          "assetId": {
            "type": "integer",
            "description": "Id of the asset, in the catalog named by `assetType`: GET /api/v1/tanks, /kegs,\r\n/tap-systems or /brewery-assets respectively. Required on create, read-only afterwards.",
            "format": "int32"
          },
          "category": {
            "type": "integer",
            "description": "1 = maintenance, 2 = cleaning. Fixed set, no catalog — determines the meaning of\r\n`type`. Required on create, read-only afterwards.",
            "format": "int32"
          },
          "type": {
            "type": "integer",
            "description": "Meaning depends on `category`. If `category` is 1 (maintenance): 1 = preventive,\r\n2 = corrective. If `category` is 2 (cleaning): 1 = acidic, 2 = alkaline, 3 = other.\r\nFixed set, no catalog. Required on create, read-only afterwards.",
            "format": "int32"
          },
          "providerId": {
            "type": "integer",
            "description": "Provider performing the work. Allowed values: GET /api/v1/suppliers. Optional.",
            "format": "int32",
            "nullable": true
          },
          "eventDate": {
            "type": "string",
            "description": "When this maintenance is scheduled to happen. ISO 8601. Required on create, read-only\r\nafterwards — see POST /{id}/reschedule to change it.",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "description": "Free-text notes. Optional, set only at creation — there is no way to edit it afterwards\r\nin the web application either.",
            "nullable": true
          },
          "status": {
            "type": "string",
            "description": "Read-only. One of `pending`, `started`, `finished` — calculated from\r\n`startedAt`/`finishedAt`, not a stored column.",
            "nullable": true
          },
          "startedAt": {
            "type": "string",
            "description": "Read-only. ISO 8601. Set by POST /{id}/start.",
            "nullable": true
          },
          "finishedAt": {
            "type": "string",
            "description": "Read-only. ISO 8601. Set by POST /{id}/finish.",
            "nullable": true
          },
          "active": {
            "type": "boolean"
          },
          "recurring": {
            "type": "boolean",
            "description": "True if this is a recurring template — not a single occurrence, but the definition that\r\nPOST /{id}/recur generates new occurrences from. A template's own `status` is\r\nmeaningless (it never starts/finishes itself). Required on create if you want a template\r\ninstead of a single occurrence, read-only afterwards."
          },
          "recurrenceEvery": {
            "type": "integer",
            "description": "How often the template recurs, together with `recurrencePeriod` — e.g. every 3\r\n`months`. Required when `recurring` is true, ignored otherwise. Read-only\r\nafterwards. `null` when `recurring` is false.",
            "format": "int32",
            "nullable": true
          },
          "recurrencePeriod": {
            "type": "string",
            "description": "One of `days`, `months`, `years`. Required when `recurring` is true,\r\nignored otherwise. Read-only afterwards. `null` when `recurring` is false.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A scheduled or performed maintenance/cleaning task on brewery equipment."
      },
      "MaintenanceDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MaintenanceDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "MaintenanceSparePartLineDto": {
        "type": "object",
        "properties": {
          "sparePartId": {
            "type": "integer",
            "description": "Allowed values: GET /api/v1/spare-parts.",
            "format": "int32"
          },
          "warehouseId": {
            "type": "integer",
            "description": "Allowed values: GET /api/v1/warehouses.",
            "format": "int32"
          },
          "quantity": {
            "type": "number",
            "description": "Quantity discounted from stock when the maintenance is finished. Must be greater than zero; decimals are allowed.",
            "format": "double"
          }
        },
        "additionalProperties": false,
        "description": "One line of the spare parts sub-resource of a maintenance: a spare part, a warehouse, and a\r\nquantity. `GET`/`PUT /maintenances/{id}/spare-parts` always deal with the FULL set\r\nof lines — there is no partial merge and no per-line id, same criterion as\r\n`RecipeDto.ingredients`: sending the list replaces it completely."
      },
      "MeasurementCreateRequestDto": {
        "type": "object",
        "properties": {
          "measurementTypeId": {
            "type": "integer",
            "description": "Required. Listed by GET /api/v1/measurement-types.",
            "format": "int32"
          },
          "value": {
            "type": "number",
            "description": "Required. Only a temperature reading may be negative — a negative gravity or pH is rejected\r\nas a data-entry mistake, not a reading.",
            "format": "double",
            "nullable": true
          },
          "recordedOn": {
            "type": "string",
            "description": "When it was recorded, ISO 8601. Defaults to now.",
            "nullable": true
          },
          "brewMinutes": {
            "type": "integer",
            "description": "Minutes the brew took. Only meaningful for a reading taken on the brew day.",
            "format": "int32",
            "nullable": true
          },
          "brewNumber": {
            "type": "integer",
            "description": "Which brew, for a batch brewed more than once. Leave unset for a batch brewed a single time.",
            "format": "int32",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "description": "Free-text notes.",
            "nullable": true
          },
          "aroma": {
            "type": "string",
            "description": "Tasting note: aroma. Only meaningful for a tasting-note measurement type.",
            "nullable": true
          },
          "appearance": {
            "type": "string",
            "description": "Tasting note: appearance.",
            "nullable": true
          },
          "taste": {
            "type": "string",
            "description": "Tasting note: taste.",
            "nullable": true
          },
          "mouthfeel": {
            "type": "string",
            "description": "Tasting note: mouthfeel.",
            "nullable": true
          },
          "overallImpression": {
            "type": "string",
            "description": "Tasting note: overall impression.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "What to record when creating a measurement directly, without completing a task."
      },
      "MeasurementDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Measurement id.",
            "format": "int32"
          },
          "batchId": {
            "type": "integer",
            "description": "The batch this measurement belongs to.",
            "format": "int32"
          },
          "stageId": {
            "type": "integer",
            "description": "Production stage the batch was in when this was recorded. Listed by\r\nGET /api/v1/production-stages.",
            "format": "int32"
          },
          "measurementTypeId": {
            "type": "integer",
            "description": "What was measured. Listed by GET /api/v1/measurement-types.",
            "format": "int32"
          },
          "value": {
            "type": "number",
            "description": "The measured value.",
            "format": "double"
          },
          "recordedOn": {
            "type": "string",
            "description": "When it was recorded, ISO 8601.",
            "format": "date-time"
          },
          "brewMinutes": {
            "type": "integer",
            "description": "Minutes the brew took. Only meaningful for a reading taken on the brew day.",
            "format": "int32",
            "nullable": true
          },
          "brewNumber": {
            "type": "integer",
            "description": "Which brew, for a batch brewed more than once (its recipe needs several brews to fill one\r\nbatch). Null for a batch brewed a single time.",
            "format": "int32",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "description": "Free-text notes.",
            "nullable": true
          },
          "aroma": {
            "type": "string",
            "description": "Tasting note: aroma. Only meaningful for a tasting-note measurement type.",
            "nullable": true
          },
          "appearance": {
            "type": "string",
            "description": "Tasting note: appearance.",
            "nullable": true
          },
          "taste": {
            "type": "string",
            "description": "Tasting note: taste.",
            "nullable": true
          },
          "mouthfeel": {
            "type": "string",
            "description": "Tasting note: mouthfeel.",
            "nullable": true
          },
          "overallImpression": {
            "type": "string",
            "description": "Tasting note: overall impression.",
            "nullable": true
          },
          "batchTaskId": {
            "type": "integer",
            "description": "The batch task that recorded this measurement on completion, if any. Null for a measurement\r\nrecorded directly through this resource.",
            "format": "int32",
            "nullable": true
          },
          "recordedByUserId": {
            "type": "integer",
            "description": "User that recorded it.",
            "format": "int32"
          },
          "active": {
            "type": "boolean",
            "description": "False once the measurement has been deactivated."
          }
        },
        "additionalProperties": false,
        "description": "A measurement (reading) taken on a batch: gravity, pH, temperature, a tasting note…"
      },
      "MeasurementDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MeasurementDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "MixPackComplementaryItemDto": {
        "type": "object",
        "properties": {
          "complementaryProductId": {
            "type": "integer",
            "description": "The complementary product. Listed by `GET /api/v1/complementary-products`.",
            "format": "int32"
          },
          "quantity": {
            "type": "integer",
            "description": "How many of them the pack carries.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "One complementary product that comes with a mix pack."
      },
      "MixPackDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Mix pack id. It is the id of the product. Assigned by the server.",
            "format": "int32"
          },
          "name": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Name. Required on create and unique among your products.",
            "nullable": true
          },
          "code": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "Your own code for it.",
            "nullable": true
          },
          "style": {
            "maxLength": 150,
            "minLength": 0,
            "type": "string",
            "description": "Style shown next to the name.",
            "nullable": true
          },
          "priceWithoutTax": {
            "type": "number",
            "description": "Selling price without taxes.",
            "format": "double"
          },
          "alcoholFree": {
            "type": "boolean",
            "description": "True when the pack carries no alcohol. It is not decoration: it sets the product's ABV to\r\nzero, and an empty pack is always alcohol-free."
          },
          "vatPerceptions": {
            "type": "boolean",
            "description": "True when the product is subject to VAT perceptions."
          },
          "caseId": {
            "type": "integer",
            "description": "The kind of case the pack ships in. Listed by `GET /api/v1/cases`.",
            "format": "int32",
            "nullable": true
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MixPackItemDto"
            },
            "description": "The beers in the pack, each in its container, with how many of them. Sending it replaces the\r\nwhole composition; omitting it keeps the current one.",
            "nullable": true
          },
          "complementaryItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MixPackComplementaryItemDto"
            },
            "description": "The complementary products that come with the pack — a glass, an opener. Same replace rule\r\nas `items`.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate."
          }
        },
        "additionalProperties": false,
        "description": "A mix pack: a product whose contents are other products in given containers."
      },
      "MixPackDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MixPackDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "MixPackItemDto": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "integer",
            "description": "The beer. Listed by `GET /api/v1/brewable-products`.",
            "format": "int32"
          },
          "containerId": {
            "type": "integer",
            "description": "The container it comes in. Listed by `GET /api/v1/containers`.",
            "format": "int32"
          },
          "quantity": {
            "type": "integer",
            "description": "How many of them the pack carries.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "One beer, in one container, inside a mix pack."
      },
      "NotificationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Notification id.",
            "format": "int32"
          },
          "title": {
            "type": "string",
            "description": "Title.",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "Body text.",
            "nullable": true
          },
          "date": {
            "type": "string",
            "description": "When it was created, ISO 8601.",
            "nullable": true
          },
          "scope": {
            "type": "string",
            "description": "Who it targets: `global` (every account on the platform), `account` (every\r\nuser of your account) or `user` (only you — the id itself is not published, it is\r\nalways your own).",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Whether the notification is still active."
          }
        },
        "additionalProperties": false,
        "description": "A notification visible to your account."
      },
      "NotificationDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotificationDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "OrderDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Order id.",
            "format": "int32"
          },
          "number": {
            "type": "string",
            "description": "Its number, as printed.",
            "nullable": true
          },
          "date": {
            "type": "string",
            "description": "When the order was entered. It can be adjusted afterwards from the application.",
            "format": "date-time"
          },
          "estimatedDeliveryDate": {
            "type": "string",
            "description": "Estimated delivery date, when one was set.",
            "format": "date-time",
            "nullable": true
          },
          "deliveredAt": {
            "type": "string",
            "description": "When it was actually delivered, if it was.",
            "format": "date-time",
            "nullable": true
          },
          "customerId": {
            "type": "integer",
            "description": "The customer. Allowed values: GET /api/v1/customers.",
            "format": "int32"
          },
          "pointOfSaleId": {
            "type": "integer",
            "description": "The customer's point of sale (branch) it goes to, when it has one. Listed by\r\nGET /api/v1/customers/{customerId}/points-of-sale. Not a counter sale.",
            "format": "int32",
            "nullable": true
          },
          "salesRepId": {
            "type": "integer",
            "description": "The sales rep recorded on the order. Allowed values: GET /api/v1/sales-reps — which lists\r\nonly active sales reps, so an old order can point to one that is no longer there.",
            "format": "int32",
            "nullable": true
          },
          "statusId": {
            "type": "integer",
            "description": "Status. Allowed values: GET /api/v1/order-statuses.",
            "format": "int32"
          },
          "pendingApproval": {
            "type": "boolean",
            "description": "Whether the order is waiting for approval."
          },
          "isQuote": {
            "type": "boolean",
            "description": "Whether it is a quote rather than a firm order. Excluded from the list unless includeQuotes=true."
          },
          "isCounterSale": {
            "type": "boolean",
            "description": "Whether it is a counter sale. Excluded from the list unless includeCounterSales=true."
          },
          "currencyId": {
            "type": "integer",
            "description": "Currency. Null means the currency of your account. Allowed values: GET /api/v1/currencies.",
            "format": "int32",
            "nullable": true
          },
          "totalWithoutTax": {
            "type": "number",
            "description": "Total without taxes.",
            "format": "double"
          },
          "vat": {
            "type": "number",
            "description": "VAT, without the VAT perception.",
            "format": "double"
          },
          "internalTaxes": {
            "type": "number",
            "description": "Internal / excise taxes: Argentine internal taxes, Chilean ILA, Mexican IEPS, Peruvian ISC.",
            "format": "double"
          },
          "vatPerception": {
            "type": "number",
            "description": "VAT perception (Argentina). Zero elsewhere.",
            "format": "double"
          },
          "taxes": {
            "type": "number",
            "description": "All taxes: vat + internalTaxes + vatPerception.",
            "format": "double"
          },
          "total": {
            "type": "number",
            "description": "Order total: totalWithoutTax + taxes. Authoritative over the sum of the items.",
            "format": "double"
          },
          "totalLiters": {
            "type": "number",
            "description": "Total liters: kegs plus bottles and cans.",
            "format": "double"
          },
          "invoiceNumber": {
            "type": "string",
            "description": "Invoice number as text, when the order was invoiced.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Whether the order is active. A cancelled order is inactive."
          },
          "deletionReasonId": {
            "type": "integer",
            "description": "Why it was cancelled, when it was. Allowed values: GET /api/v1/reasons/order-deletion.",
            "format": "int32",
            "nullable": true
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderItemDto"
            },
            "description": "The items. Only populated on GET /orders/{orderId}: an order has several, so returning\r\nthem in a page would multiply rows and the total would stop matching.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A sales order, from the moment it is entered — before any delivery note exists."
      },
      "OrderDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "OrderItemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Item id.",
            "format": "int32"
          },
          "productId": {
            "type": "integer",
            "description": "The product. Allowed values: GET /api/v1/products.",
            "format": "int32"
          },
          "description": {
            "type": "string",
            "description": "What the item says, as entered (with the mix-pack contents when your account shows them).",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "description": "Quantity. Zero on a discount line.",
            "format": "double"
          },
          "liters": {
            "type": "number",
            "description": "Liters of the item.",
            "format": "double"
          },
          "unitPriceWithoutTax": {
            "type": "number",
            "description": "Unit price without taxes.",
            "format": "double"
          },
          "priceListId": {
            "type": "integer",
            "description": "The price list the price came from, if any. Allowed values: GET /api/v1/price-lists.",
            "format": "int32",
            "nullable": true
          },
          "containerId": {
            "type": "integer",
            "description": "The container (bottle, can) when sold by unit. Allowed values: GET /api/v1/containers.",
            "format": "int32",
            "nullable": true
          },
          "caseId": {
            "type": "integer",
            "description": "The case or pack when sold by case. Allowed values: GET /api/v1/cases.",
            "format": "int32",
            "nullable": true
          },
          "isMixPack": {
            "type": "boolean",
            "description": "Whether the item is a mix pack."
          },
          "totalWithoutTax": {
            "type": "number",
            "description": "Total without taxes. Negative on a discount line.",
            "format": "double"
          },
          "vat": {
            "type": "number",
            "description": "VAT.",
            "format": "double"
          },
          "internalTaxes": {
            "type": "number",
            "description": "Internal / excise taxes.",
            "format": "double"
          },
          "vatPerception": {
            "type": "number",
            "description": "VAT perception (Argentina). Zero elsewhere.",
            "format": "double"
          },
          "taxes": {
            "type": "number",
            "description": "All taxes: vat + internalTaxes + vatPerception. On items of orders entered up to May 2026 it is published as stored and may not match that sum (vat 0 with the VAT inside, or the perception left out).",
            "format": "double"
          },
          "total": {
            "type": "number",
            "description": "Item total: totalWithoutTax + taxes.",
            "format": "double"
          },
          "isDiscount": {
            "type": "boolean",
            "description": "Whether this is a discount line."
          },
          "discountedItemId": {
            "type": "integer",
            "description": "The item this line discounts. Null on a discount over the whole order.",
            "format": "int32",
            "nullable": true
          },
          "discountPercentage": {
            "type": "number",
            "description": "Discount percentage, when the discount was entered as a percentage.",
            "format": "double",
            "nullable": true
          },
          "discountAmount": {
            "type": "number",
            "description": "Discount amount, when recorded.",
            "format": "double",
            "nullable": true
          },
          "discountReasonId": {
            "type": "integer",
            "description": "Reason for the discount. Allowed values: GET /api/v1/reasons/order-discount.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One item of an order."
      },
      "PackProductStockDto": {
        "type": "object",
        "properties": {
          "warehouseId": {
            "type": "integer",
            "description": "Warehouse where the loose containers are, and where the cases end up.",
            "format": "int32"
          },
          "caseId": {
            "type": "integer",
            "description": "The case format to assemble. Listed by `GET /api/v1/cases`.",
            "format": "int32"
          },
          "cases": {
            "type": "integer",
            "description": "How many cases to assemble.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "Assembles loose containers of a product into cases."
      },
      "PaymentOrderDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Payment order id.",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "description": "Date of the payment order.",
            "format": "date-time"
          },
          "number": {
            "type": "string",
            "description": "The order's own number, as shown on the printed voucher. Assigned by the application from\r\nits own counter, so it is unique within your account but not across accounts.",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "What was paid. Written by the application when the payment is recorded — it summarises the\r\nmovement and the cheques involved, so it is free text and it is in Spanish, like the rows\r\nof a report.",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "description": "Amount paid, and it is <b>negative</b>: the application stores an outgoing payment as a\r\nnegative figure, and this API reports the stored value rather than flipping it. Summing\r\nthis field over a period gives a negative total — that is the expected result, not a bug.\r\n            \r\nMeasured over the whole production database on 2026-09-21: 161,184 orders negative, 652\r\nexactly zero (a payment recorded with no amount), and 11 positive. Treat a non-negative\r\namount as data worth checking on your side, not as a different kind of order.",
            "format": "double"
          },
          "supplierId": {
            "type": "integer",
            "description": "The supplier this payment went to. Allowed values: GET /api/v1/suppliers. Null when the\r\npayment was not made against a supplier account — about half of the orders in a typical\r\naccount are like this.",
            "format": "int32",
            "nullable": true
          },
          "userId": {
            "type": "integer",
            "description": "The user who recorded the payment. Allowed values: GET /api/v1/users. Null on orders old\r\nenough to predate the field.",
            "format": "int32",
            "nullable": true
          },
          "origin": {
            "type": "string",
            "description": "Where the payment was recorded: `cashRegister` or `bankAccount`. Null when the\r\nmovement that produced this order no longer exists — rare, but real, so the order is still\r\nlisted rather than hidden.",
            "nullable": true
          },
          "originMovementId": {
            "type": "integer",
            "description": "Id of the movement that produced this order — a cash movement\r\n(GET /api/v1/cash-registers/{id}/movements) or a bank movement\r\n(GET /api/v1/bank-accounts/{id}/movements), according to `origin`. Null together with\r\n`origin`.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A payment order: the voucher left behind by an outgoing payment."
      },
      "PaymentOrderDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentOrderDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "PointOfSaleDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Point of sale id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Name. Required on create.",
            "nullable": true
          },
          "address": {
            "maxLength": 400,
            "minLength": 0,
            "type": "string",
            "description": "Street address.",
            "nullable": true
          },
          "city": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "City.",
            "nullable": true
          },
          "provinceId": {
            "type": "integer",
            "description": "Province, state or region. Allowed values: GET /api/v1/provinces.",
            "format": "int32",
            "nullable": true
          },
          "postalCode": {
            "maxLength": 10,
            "minLength": 0,
            "type": "string",
            "description": "Postal code.",
            "nullable": true
          },
          "phones": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Phone numbers, free text.",
            "nullable": true
          },
          "emails": {
            "maxLength": 150,
            "minLength": 0,
            "type": "string",
            "description": "E-mail addresses, comma separated.",
            "nullable": true
          },
          "contactName": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "Contact person.",
            "nullable": true
          },
          "notes": {
            "maxLength": 300,
            "minLength": 0,
            "type": "string",
            "description": "Free-form notes.",
            "nullable": true
          },
          "openingHours": {
            "maxLength": 500,
            "minLength": 0,
            "type": "string",
            "description": "Opening days and hours, free text.",
            "nullable": true
          },
          "priceListId": {
            "type": "integer",
            "description": "Price list of this point of sale, or null to use the customer's. Allowed values:\r\nGET /api/v1/price-lists.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A point of sale of a customer."
      },
      "PortalPriceListsDto": {
        "type": "object",
        "properties": {
          "priceListId1": {
            "type": "integer",
            "description": "First price list the portal uses. Allowed values: GET /api/v1/price-lists.",
            "format": "int32",
            "nullable": true
          },
          "priceListId2": {
            "type": "integer",
            "description": "Second price list. Allowed values: GET /api/v1/price-lists.",
            "format": "int32",
            "nullable": true
          },
          "priceListId3": {
            "type": "integer",
            "description": "Third price list, applied only to customers in `restrictedToCustomerCategoryId`.\r\nAllowed values: GET /api/v1/price-lists.",
            "format": "int32",
            "nullable": true
          },
          "restrictedToCustomerCategoryId": {
            "type": "integer",
            "description": "The customer category that gets `priceListId3`. Allowed values:\r\nGET /api/v1/customer-categories. Null means the third list is not restricted to anyone.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Which price lists the customer portal publishes against, for your account."
      },
      "PriceDto": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "integer",
            "description": "The product being priced. Required. Listed by `GET /api/v1/products`.",
            "format": "int32"
          },
          "priceWithoutTax": {
            "type": "number",
            "description": "Price without taxes. The application always stores prices net; the taxes come from the\r\nproduct.",
            "format": "double"
          },
          "containerId": {
            "type": "integer",
            "description": "The container this price applies to, if the price is per container.",
            "format": "int32",
            "nullable": true
          },
          "caseId": {
            "type": "integer",
            "description": "The case this price applies to, if the price is per case.",
            "format": "int32",
            "nullable": true
          },
          "showInRewards": {
            "type": "boolean",
            "description": "True when the product shows up in the loyalty catalogue at this price."
          },
          "updatedOn": {
            "type": "string",
            "description": "Read-only. When the price was last set.",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "The price of one product, in one sales format, within a price list."
      },
      "PriceListDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Price list id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Name. Required on create, and it must not match another list of your account — including a\r\ndeactivated one, because reactivating it would leave two lists with the same name.",
            "nullable": true
          },
          "percentage": {
            "type": "number",
            "description": "Percentage applied over the product's base price for the products this list does not price\r\nexplicitly. A list can work by percentage, by explicit prices, or by both.",
            "format": "double",
            "nullable": true
          },
          "currencyId": {
            "type": "integer",
            "description": "Currency of the list. Omitting it uses your account's currency.",
            "format": "int32",
            "nullable": true
          },
          "isPointsList": {
            "type": "boolean",
            "description": "True when the list prices products in loyalty points instead of money. A points list is not\r\ninterchangeable with a money one: the customer's balance is counted in different units."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PriceDto"
            },
            "description": "The prices of this list. Each entry is matched by product, container and case: a match is\r\nupdated, anything else is added. Prices you do not send are <strong>kept</strong> — this\r\ncollection is merged, not replaced, and an empty array therefore changes nothing. Removing a\r\nprice from a list is not possible in this version.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A price list: what each product costs for the customers assigned to it."
      },
      "PriceListDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PriceListDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": { }
      },
      "ProductCaseDto": {
        "type": "object",
        "properties": {
          "caseId": {
            "type": "integer",
            "description": "The case or pack. Required. Allowed values: GET /api/v1/cases.",
            "format": "int32"
          },
          "price": {
            "type": "number",
            "description": "Selling price of the product in this case, taxes excluded.",
            "format": "double"
          },
          "unitCost": {
            "type": "number",
            "description": "Your cost per case. Used by the costing reports.",
            "format": "double"
          },
          "code": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "Code (SKU) of the product in this case.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "The price of a product in one case or pack format."
      },
      "ProductCategoryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Category id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Required. Must be unique among your active and inactive categories.",
            "nullable": true
          },
          "hasAssociatedProducts": {
            "type": "boolean",
            "description": "Read-only. Whether any product currently uses this category."
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A category used to group your products."
      },
      "ProductCategoryDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductCategoryDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "ProductContainerDto": {
        "type": "object",
        "properties": {
          "containerId": {
            "type": "integer",
            "description": "The container. Required. Allowed values: GET /api/v1/containers.",
            "format": "int32"
          },
          "price": {
            "type": "number",
            "description": "Selling price of the product in this container, taxes excluded.",
            "format": "double"
          },
          "unitCost": {
            "type": "number",
            "description": "Your cost per unit in this container. Used by the costing reports.",
            "format": "double"
          },
          "code": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "Code (SKU) of the product in this container.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "The price of a product in one individual container format."
      },
      "ProductDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Product id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "style": {
            "maxLength": 100,
            "minLength": 0,
            "type": "string",
            "description": "Style. Required, and it is the main part of the product's display name. For a complementary\r\nproduct it is used as its category, and the visible name comes from GCerv.Api.Dto.ProductDto.name.",
            "nullable": true
          },
          "name": {
            "maxLength": 500,
            "minLength": 0,
            "type": "string",
            "description": "Name. Required for complementary products. Two active products cannot share it.",
            "nullable": true
          },
          "code": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "Product code used by your account (SKU).",
            "nullable": true
          },
          "priceWithoutTax": {
            "type": "number",
            "description": "Base price, taxes excluded. For a product sold in several formats this is the fallback: the\r\nprice actually applied comes from containers and cases when the order names a format.\r\nA discount product (\"bonificación\") must have zero or a negative price.",
            "format": "double"
          },
          "internalTax": {
            "type": "number",
            "description": "Internal tax per unit, where the country charges one.",
            "format": "double",
            "nullable": true
          },
          "vatRate": {
            "type": "number",
            "description": "VAT rate applied to this product, as a percentage.",
            "format": "double",
            "nullable": true
          },
          "vatPerceptions": {
            "type": "boolean",
            "description": "True when this product is subject to VAT perceptions."
          },
          "minimumStock": {
            "type": "number",
            "description": "Stock level below which the application warns you.",
            "format": "double",
            "nullable": true
          },
          "plateDegrees": {
            "type": "number",
            "description": "Plato degrees of the beer.",
            "format": "double",
            "nullable": true
          },
          "abv": {
            "type": "number",
            "description": "Alcohol by volume, as a percentage. Used by the excise tax calculation in Ecuador.",
            "format": "double",
            "nullable": true
          },
          "ilaCode": {
            "maxLength": 10,
            "minLength": 0,
            "type": "string",
            "description": "Excise code (\"código ILA\"), the Chilean additional tax on alcoholic drinks. It applies in\r\nChile only; elsewhere the field is ignored. Allowed values:\r\n`GET /api/v1/ila-types`.",
            "nullable": true
          },
          "filtered": {
            "type": "boolean",
            "description": "True when the product is filtered. Only meaningful in Chile, where the tax on beer depends\r\non it."
          },
          "projectionDays": {
            "type": "integer",
            "description": "How many days ahead the stock projection reaches for this product.",
            "format": "int32"
          },
          "isComplementary": {
            "type": "boolean",
            "description": "True for a complementary product — something you buy and resell rather than brew. It\r\nchanges how the product is stocked and delivered, so it is not a cosmetic flag."
          },
          "tracksStock": {
            "type": "boolean",
            "description": "Whether the application keeps stock of this product. Only a complementary product may be\r\nstockless: setting it false on anything else is ignored, because the beer you brew always\r\nhas stock. Defaults to true."
          },
          "isMixPack": {
            "type": "boolean",
            "description": "True when the product is a mix pack. Read-only in v1: assembling a mix pack means choosing\r\nwhich products and formats go into it, which has its own flow in the application."
          },
          "productTypeId": {
            "type": "integer",
            "description": "Product type. Allowed values: GET /api/v1/product-types. Null clears it.",
            "format": "int32",
            "nullable": true
          },
          "supplierId": {
            "type": "integer",
            "description": "Supplier you buy this product from. Allowed values: GET /api/v1/suppliers. Null clears it.",
            "format": "int32",
            "nullable": true
          },
          "supplyId": {
            "type": "integer",
            "description": "The supply this product is drawn from, when it is stocked as a supply rather than brewed.\r\nAllowed values: GET /api/v1/supplies. Null clears it.",
            "format": "int32",
            "nullable": true
          },
          "categoryIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "The categories of the product. A product can hold several at once. Allowed values:\r\nGET /api/v1/product-categories. Sending it REPLACES the whole set; omitting it keeps the\r\ncurrent categories, and sending an empty array removes them all.",
            "nullable": true
          },
          "containers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductContainerDto"
            },
            "description": "Prices per individual container (bottle, can, keg). Sending it REPLACES the whole\r\ncollection; omitting it keeps the current one.",
            "nullable": true
          },
          "cases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductCaseDto"
            },
            "description": "Prices per case or pack. Sending it REPLACES the whole collection; omitting it keeps the\r\ncurrent one.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "False when the product has been deactivated. Read-only: use /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A product of your account: a beer you make, or a complementary product you resell."
      },
      "ProductDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "ProductStockByWarehouseDto": {
        "type": "object",
        "properties": {
          "warehouseId": {
            "type": "integer",
            "description": "Warehouse id. Listed by `GET /api/v1/warehouses`.",
            "format": "int32"
          },
          "warehouseName": {
            "type": "string",
            "description": "Warehouse name.",
            "nullable": true
          },
          "containers": {
            "type": "integer",
            "description": "Loose containers on hand. Set only when `productKind` is `own`.",
            "format": "int32",
            "nullable": true
          },
          "cases": {
            "type": "integer",
            "description": "Full cases on hand. Set only when `productKind` is `own`.",
            "format": "int32",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "description": "Units on hand. Set only when `productKind` is `mixPack` or `complementary`.",
            "format": "double",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "The stock of one product in one warehouse."
      },
      "ProductStockDto": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "integer",
            "description": "Product id.",
            "format": "int32"
          },
          "productKind": {
            "type": "string",
            "description": "How this product's stock is tracked. `own` sets `containers` and `cases` on\r\neach entry of GCerv.Api.Dto.ProductStockDto.byWarehouse; `mixPack` and `complementary` set\r\n`quantity` instead.",
            "nullable": true
          },
          "byWarehouse": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductStockByWarehouseDto"
            },
            "description": "Stock per warehouse. Empty when this product does not track stock at all — a discount or\r\nsurcharge line, or a complementary product with stock control turned off.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "The current stock of a product, by warehouse."
      },
      "PromotionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Promotion id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "description": {
            "type": "string",
            "description": "Required.",
            "nullable": true
          },
          "scope": {
            "type": "string",
            "description": "`cart` (applies to the whole order) or `per-product`. Required.",
            "nullable": true
          },
          "cumulative": {
            "type": "boolean",
            "description": "Whether this `cart` promotion can combine with per-product promotions."
          },
          "formatType": {
            "type": "string",
            "description": "`per-product` only. Which kind of format this promotion applies to: `barril`\r\n            (keg), `envase_suelto` (loose container) or `pack`. Fixed set, not a catalog.",
            "nullable": true
          },
          "productIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "`per-product` only. Products this promotion applies to. Allowed values: GET /api/v1/products.",
            "nullable": true
          },
          "containerId": {
            "type": "integer",
            "description": "`per-product` + `formatType=envase_suelto` only. Allowed values: GET /api/v1/containers.",
            "format": "int32",
            "nullable": true
          },
          "caseId": {
            "type": "integer",
            "description": "`per-product` + `formatType=pack` only. Allowed values: GET /api/v1/cases.",
            "format": "int32",
            "nullable": true
          },
          "liters": {
            "type": "number",
            "description": "`per-product` + `formatType=barril` only. Keg size in liters.",
            "format": "double",
            "nullable": true
          },
          "restrictToPriceLists": {
            "type": "boolean",
            "description": "`true` = only the price lists in `priceListIds` qualify; `false` = every\r\n            price list qualifies."
          },
          "priceListIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "Required when `restrictToPriceLists` is `true`. Allowed values: GET /api/v1/price-lists.",
            "nullable": true
          },
          "priceListNames": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Read-only. Names of the price lists in `priceListIds` that are still active.",
            "nullable": true
          },
          "hasNoActivePriceLists": {
            "type": "boolean",
            "description": "Read-only. `true` when `restrictToPriceLists` is set but none of its price\r\nlists are active anymore — the promotion cannot apply to anything right now."
          },
          "calculationType": {
            "type": "string",
            "description": "`percentage` or `quantity` (an MxN deal). Required.",
            "nullable": true
          },
          "discountPercentage": {
            "type": "number",
            "description": "Required when `calculationType=percentage`. Between 0 and 100.",
            "format": "double",
            "nullable": true
          },
          "buyQuantity": {
            "type": "integer",
            "description": "Required when `calculationType=quantity`: buy this many...",
            "format": "int32",
            "nullable": true
          },
          "payQuantity": {
            "type": "integer",
            "description": "Required when `calculationType=quantity`: ...pay for this many.",
            "format": "int32",
            "nullable": true
          },
          "combineProductQuantities": {
            "type": "boolean",
            "description": "`calculationType=quantity` only. Whether quantities of different eligible products combine to reach the deal.",
            "nullable": true
          },
          "cartThreshold": {
            "type": "number",
            "description": "`scope=cart` only. Minimum cart total for the discount to apply.",
            "format": "double",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate."
          }
        },
        "additionalProperties": false,
        "description": "A promotion of your brewery."
      },
      "PromotionDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PromotionDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "PurchaseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Purchase id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "purchaseTypeId": {
            "type": "integer",
            "description": "Purchase or credit note. Allowed values: GET /api/v1/purchase-types. Defaults to purchase.\r\nA credit note also needs creditNoteNumber, and originalPurchaseId when it corrects a\r\nspecific purchase. It cannot be changed after creation: the two kinds move stock in\r\nopposite directions.",
            "format": "int32"
          },
          "supplierId": {
            "type": "integer",
            "description": "Supplier that issued the voucher. Required. Allowed values: GET /api/v1/suppliers.\r\nIt can only be changed while the purchase has no lines and no payments.",
            "format": "int32",
            "nullable": true
          },
          "date": {
            "type": "string",
            "description": "Voucher date, ISO 8601. Defaults to now when creating.",
            "nullable": true
          },
          "deliveryDate": {
            "type": "string",
            "description": "Delivery date, ISO 8601. Optional.",
            "nullable": true
          },
          "dueDate": {
            "type": "string",
            "description": "Payment due date, ISO 8601. Optional. Setting it also schedules the reminder the\r\napplication shows in its agenda.",
            "nullable": true
          },
          "invoiceNumber": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "Invoice number. Either this or deliveryNoteNumber is required, and this one specifically\r\nbecomes required as soon as the purchase carries any amount.",
            "nullable": true
          },
          "deliveryNoteNumber": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "Delivery note number. Either this or invoiceNumber is required.",
            "nullable": true
          },
          "creditNoteNumber": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "Credit note number. Required when purchaseTypeId is the credit note one.",
            "nullable": true
          },
          "originalPurchaseId": {
            "type": "integer",
            "description": "The purchase this credit note corrects, when it corrects one. Valid values are the ids\r\nreturned by GET /api/v1/purchases. Only meaningful on a credit note.",
            "format": "int32",
            "nullable": true
          },
          "purchaseOrderId": {
            "type": "integer",
            "description": "The purchase order this purchase applies against, if any. Allowed values:\r\nGET /api/v1/purchase-orders. Optional — most purchases are not tied to one. Registering\r\na purchase with this set is what advances the order's applied/completed state.",
            "format": "int32",
            "nullable": true
          },
          "voucherTypeId": {
            "type": "integer",
            "description": "Fiscal voucher type. Allowed values: GET /api/v1/voucher-types.",
            "format": "int32",
            "nullable": true
          },
          "currencyId": {
            "type": "integer",
            "description": "Currency of the voucher. Allowed values: GET /api/v1/currencies. Defaults to your\r\naccount's currency. When it is not your account's currency, send exchangeRate too.",
            "format": "int32"
          },
          "exchangeRate": {
            "type": "number",
            "description": "Exchange rate to your account's currency. Required when currencyId is a foreign one.",
            "format": "double",
            "nullable": true
          },
          "accountId": {
            "type": "integer",
            "description": "Expense account the purchase is charged to. Allowed values: GET /api/v1/expense-accounts.",
            "format": "int32",
            "nullable": true
          },
          "paymentTypeId": {
            "type": "integer",
            "description": "Payment method agreed for this purchase. Allowed values: GET /api/v1/payment-types.",
            "format": "int32",
            "nullable": true
          },
          "subtotal": {
            "type": "number",
            "description": "Amount before taxes.",
            "format": "double",
            "nullable": true
          },
          "taxes": {
            "type": "number",
            "description": "Total taxes.",
            "format": "double",
            "nullable": true
          },
          "total": {
            "type": "number",
            "description": "Grand total.",
            "format": "double",
            "nullable": true
          },
          "vat": {
            "type": "number",
            "description": "VAT amount. Part of the Argentine tax breakdown; ignored elsewhere.",
            "format": "double",
            "nullable": true
          },
          "grossIncomeTax": {
            "type": "number",
            "description": "Gross income tax amount (\"IIBB\"). Part of the Argentine tax breakdown.",
            "format": "double",
            "nullable": true
          },
          "otherTaxes": {
            "type": "number",
            "description": "Any other tax amount.",
            "format": "double",
            "nullable": true
          },
          "withholdingRate": {
            "type": "number",
            "description": "Chile only. Fee withholding rate (percent, e.g. 15.25) applied to a fee receipt (BHE) or a\r\nthird-party services receipt (BTE) when your account is a withholding agent. The server takes it\r\nfrom the rate in force on the purchase date. Read-only. Null when the purchase has no withholding.",
            "format": "double",
            "nullable": true
          },
          "withholdingAmount": {
            "type": "number",
            "description": "Chile only. Amount withheld = subtotal (gross) × withholdingRate. On these purchases total is the\r\nnet amount owed to the supplier: subtotal + taxes − withholdingAmount. Read-only. These\r\nwithholdings are not listed in /api/v1/withholdings.",
            "format": "double",
            "nullable": true
          },
          "notes": {
            "maxLength": 500,
            "minLength": 0,
            "type": "string",
            "description": "Free-form notes.",
            "nullable": true
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseLineDto"
            },
            "description": "The lines of the purchase. Sending it REPLACES the whole collection; omitting it keeps the\r\ncurrent lines untouched. Each line moves stock, so the whole set is recalculated.",
            "nullable": true
          },
          "confirmDiscrepancy": {
            "type": "boolean",
            "description": "Set it to true to accept a purchase whose header subtotal does not match the sum of its\r\nlines. Without it such a request is rejected with 400 header_detail_mismatch, which is a\r\ndeliberate guard: the mismatch is almost always a data entry error, and once the purchase\r\nis paid it can no longer be corrected. Write-only."
          },
          "paid": {
            "type": "number",
            "description": "How much has already been paid. Read-only: payments have their own flow.",
            "format": "double"
          },
          "fullyPaid": {
            "type": "boolean",
            "description": "True when the purchase is settled. Read-only."
          },
          "active": {
            "type": "boolean",
            "description": "False when the purchase has been voided. Read-only: use /cancel."
          }
        },
        "additionalProperties": false,
        "description": "A purchase (or purchase credit note) recorded against a supplier."
      },
      "PurchaseDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "PurchaseLineDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Line id. Assigned by the server.",
            "format": "int32"
          },
          "description": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "What was bought, as it reads on the voucher. Required.",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "description": "How many units. Must be greater than zero.",
            "format": "double"
          },
          "cost": {
            "type": "number",
            "description": "Total cost of the line, in the currency of the purchase.",
            "format": "double",
            "nullable": true
          },
          "unitId": {
            "type": "integer",
            "description": "Unit of measure. Allowed values: GET /api/v1/units. When the line stocks a supply, the unit\r\nmust be convertible to that supply's base unit or the request is rejected.",
            "format": "int32",
            "nullable": true
          },
          "supplyId": {
            "type": "integer",
            "description": "Supply (raw material) this line stocks. Allowed values: GET /api/v1/supplies.",
            "format": "int32",
            "nullable": true
          },
          "complementaryProductId": {
            "type": "integer",
            "description": "Complementary product this line stocks. Allowed values: GET /api/v1/complementary-products.\r\nRequires warehouseId.",
            "format": "int32",
            "nullable": true
          },
          "sparePartId": {
            "type": "integer",
            "description": "Spare part this line stocks. Allowed values: GET /api/v1/spare-parts. Requires warehouseId.",
            "format": "int32",
            "nullable": true
          },
          "serviceId": {
            "type": "integer",
            "description": "Service this line pays for. Allowed values: GET /api/v1/purchasable-services. Moves no stock.",
            "format": "int32",
            "nullable": true
          },
          "warehouseId": {
            "type": "integer",
            "description": "Product warehouse the line stocks into. Allowed values: GET /api/v1/warehouses.",
            "format": "int32",
            "nullable": true
          },
          "supplyWarehouseId": {
            "type": "integer",
            "description": "Supply warehouse the line stocks into. Allowed values: GET /api/v1/supply-warehouses, which\r\nis empty unless your account uses several supply warehouses — leave it null then.",
            "format": "int32",
            "nullable": true
          },
          "vatAmount": {
            "type": "number",
            "description": "VAT amount of the line.",
            "format": "double",
            "nullable": true
          },
          "vatRate": {
            "type": "number",
            "description": "VAT rate applied to the line, as a percentage.",
            "format": "double",
            "nullable": true
          },
          "otherTaxes": {
            "type": "number",
            "description": "Any other tax amount of the line.",
            "format": "double",
            "nullable": true
          },
          "externalLots": {
            "type": "string",
            "description": "Supplier lot numbers, comma separated, for traceability of a stocked supply. Each number is\r\nlimited to 50 characters.",
            "nullable": true
          },
          "dryExtract": {
            "type": "number",
            "description": "Dry extract of the supply, when the purchase updates it (malt).",
            "format": "double",
            "nullable": true
          },
          "note": {
            "type": "string",
            "description": "Free-form note on the line.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One line of a purchase: what was bought, how much of it, and at what cost."
      },
      "PurchaseOrderDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Purchase order id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "supplierId": {
            "type": "integer",
            "description": "Supplier this order is for. Required. Allowed values: GET /api/v1/suppliers.",
            "format": "int32",
            "nullable": true
          },
          "number": {
            "type": "string",
            "description": "Read-only. Assigned by the server on create, sequential per account.",
            "nullable": true
          },
          "date": {
            "type": "string",
            "description": "Order date, ISO 8601. Defaults to now when creating.",
            "nullable": true
          },
          "deliveryDate": {
            "type": "string",
            "description": "Expected delivery date, ISO 8601. Optional.",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "description": "Free-form notes. Up to 500 characters.",
            "nullable": true
          },
          "subtotal": {
            "type": "number",
            "description": "Amount before taxes.",
            "format": "double",
            "nullable": true
          },
          "taxes": {
            "type": "number",
            "description": "Total taxes.",
            "format": "double",
            "nullable": true
          },
          "total": {
            "type": "number",
            "description": "Grand total.",
            "format": "double",
            "nullable": true
          },
          "applied": {
            "type": "boolean",
            "description": "Read-only. True once at least one Purchase has been registered against this order."
          },
          "completed": {
            "type": "boolean",
            "description": "Read-only. True once the order is fully settled — see POST .../complete."
          },
          "completedByUserId": {
            "type": "integer",
            "description": "Read-only. User that completed the order, if any.",
            "format": "int32",
            "nullable": true
          },
          "completedOn": {
            "type": "string",
            "description": "Read-only, ISO 8601. When the order was completed, if it was.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          },
          "detailLines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseOrderLineDto"
            },
            "description": "The order's lines. Replaces the entire collection when sent — see the remark on the class.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A purchase order: an intent to buy from a supplier, before any stock or money moves."
      },
      "PurchaseOrderDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseOrderDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "PurchaseOrderLineDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Line id. Read-only: reported on GET, ignored on write.",
            "format": "int32"
          },
          "description": {
            "type": "string",
            "description": "What to buy, as text. Required.",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "description": "How many units. Must be greater than zero.",
            "format": "double"
          },
          "deliveredQuantity": {
            "type": "number",
            "description": "Read-only. How much of this line has already been delivered via a Purchase.",
            "format": "double"
          },
          "remainingQuantity": {
            "type": "number",
            "description": "Read-only. quantity minus deliveredQuantity.",
            "format": "double"
          },
          "price": {
            "type": "number",
            "description": "Expected total cost of the line.",
            "format": "double",
            "nullable": true
          },
          "unitId": {
            "type": "integer",
            "description": "Unit of measure. Allowed values: GET /api/v1/units.",
            "format": "int32",
            "nullable": true
          },
          "supplyId": {
            "type": "integer",
            "description": "Supply (raw material) this line is for. Allowed values: GET /api/v1/supplies.",
            "format": "int32",
            "nullable": true
          },
          "complementaryProductId": {
            "type": "integer",
            "description": "Complementary product this line is for. Allowed values: GET /api/v1/complementary-products.",
            "format": "int32",
            "nullable": true
          },
          "sparePartId": {
            "type": "integer",
            "description": "Spare part this line is for. Allowed values: GET /api/v1/spare-parts.",
            "format": "int32",
            "nullable": true
          },
          "serviceId": {
            "type": "integer",
            "description": "Service this line is for. Allowed values: GET /api/v1/purchasable-services.",
            "format": "int32",
            "nullable": true
          },
          "vatAmount": {
            "type": "number",
            "description": "Expected VAT amount of the line.",
            "format": "double",
            "nullable": true
          },
          "vatRate": {
            "type": "number",
            "description": "Expected VAT rate, as a percentage. Free value, not a catalog.",
            "format": "double",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One line of a purchase order: what to buy, how much, and at what expected cost."
      },
      "RawMaterialValuationLineDto": {
        "type": "object",
        "properties": {
          "supplyId": {
            "type": "integer",
            "description": "Supply id. Listed by `GET /api/v1/supplies`.",
            "format": "int32"
          },
          "supplyTypeId": {
            "type": "integer",
            "description": "Kind of supply. Listed by `GET /api/v1/raw-material-types`.",
            "format": "int32"
          },
          "unitId": {
            "type": "integer",
            "description": "Unit `stock` and the cost fields are expressed in. Listed by `GET /api/v1/units`.",
            "format": "int32",
            "nullable": true
          },
          "stock": {
            "type": "number",
            "description": "Units in stock, as of `asOf`.",
            "format": "double"
          },
          "costPerUnitLastPurchase": {
            "type": "number",
            "description": "Cost per unit from the last purchase with a cost on record, on or before `asOf`.\r\nFalls back to `manualCost` when there is no such purchase — same fallback the web\r\nreport itself applies to this same column. `0` when neither is available.",
            "format": "double"
          },
          "totalLastPurchase": {
            "type": "number",
            "format": "double"
          },
          "costPerUnitWeightedAverage": {
            "type": "number",
            "description": "Weighted-average cost per unit over the last 3 purchases on or before `asOf`. Unlike\r\n`costPerUnitLastPurchase`, this one does <strong>not</strong> fall back to\r\n`manualCost` — same as the web report. `0` when there are no purchases to\r\naverage.",
            "format": "double"
          },
          "totalWeightedAverage": {
            "type": "number",
            "format": "double"
          },
          "manualCost": {
            "type": "number",
            "description": "Cost per unit set by hand on the supply (`unitCost` of `GET /supplies/{id}`).\r\n`0` when none was ever set. Exposed on its own because\r\n`costPerUnitLastPurchase` only uses it as a fallback — this field tells you whether\r\nthat fallback happened.",
            "format": "double"
          },
          "costDate": {
            "type": "string",
            "description": "Date of the purchase (or manual cost entry) `costPerUnitLastPurchase` came from,\r\n`yyyy-MM-dd`. Not the same as `asOf`: this is when the cost was recorded, not\r\nthe cutoff date you asked for.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One line of the current valuation of your raw material (supply) stock."
      },
      "ReceiptDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Receipt id.",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "description": "Date of the receipt.",
            "format": "date-time"
          },
          "number": {
            "type": "string",
            "description": "The receipt's own number, as shown on the printed voucher. Assigned by the application\r\nfrom its own counter, so it is unique within your account but not across accounts.",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "What was collected. Written by the application when the collection is recorded, so it is\r\nfree text and it is in Spanish, like the rows of a report.",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "description": "Amount collected. Normally positive — unlike a payment order, which is stored negative.\r\nA small number of receipts are negative (12,727 of 823,931 across the whole production\r\ndatabase on 2026-09-21): those are corrections, not a different kind of receipt.",
            "format": "double"
          },
          "customerId": {
            "type": "integer",
            "description": "The customer this receipt was issued to. Allowed values: GET /api/v1/customers. Almost\r\nevery receipt has one; exactly one of `customerId`/`supplierId` is populated.",
            "format": "int32",
            "nullable": true
          },
          "supplierId": {
            "type": "integer",
            "description": "The supplier this receipt belongs to, on the rare receipts issued against a supplier.\r\nAllowed values: GET /api/v1/suppliers.",
            "format": "int32",
            "nullable": true
          },
          "userId": {
            "type": "integer",
            "description": "The user who recorded the collection. Allowed values: GET /api/v1/users. Null on receipts\r\nold enough to predate the field.",
            "format": "int32",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Whether the receipt is still active. Unlike payment orders, receipts do get deactivated\r\n(10,523 of 823,931 on 2026-09-21), so this is real information and the list can include\r\nthem with `includeInactive=true`."
          },
          "cashMovementIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "Ids of the cash register movements this receipt covers. Only returned by\r\n`GET /receipts/{receiptId}`; always null in the list.",
            "nullable": true
          },
          "bankMovementIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "Ids of the bank account movements this receipt covers. Only returned by\r\n`GET /receipts/{receiptId}`; always null in the list.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A receipt: the voucher left behind by an incoming payment."
      },
      "ReceiptDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "RecipeDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Recipe id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "maxLength": 100,
            "minLength": 0,
            "type": "string",
            "description": "Name. Required on create and unique among your recipes.",
            "nullable": true
          },
          "producedProductId": {
            "type": "integer",
            "description": "The beer this recipe produces. Required on create. Listed by\r\n`GET /api/v1/brewable-products`.",
            "format": "int32"
          },
          "liters": {
            "type": "integer",
            "description": "Litres the recipe is written for. The batch scales its quantities from this.",
            "format": "int32"
          },
          "brewMaster": {
            "maxLength": 100,
            "minLength": 0,
            "type": "string",
            "description": "Brewmaster who wrote it.",
            "nullable": true
          },
          "originalGravity": {
            "type": "integer",
            "description": "Original gravity. Whole number — the column does not store decimals.",
            "format": "int32",
            "nullable": true
          },
          "finalGravity": {
            "type": "integer",
            "description": "Final gravity. Whole number — the column does not store decimals.",
            "format": "int32",
            "nullable": true
          },
          "ibu": {
            "type": "integer",
            "description": "Bitterness in IBU. Whole number — the column does not store decimals.",
            "format": "int32",
            "nullable": true
          },
          "abv": {
            "type": "number",
            "description": "Alcohol by volume, in percent.",
            "format": "double",
            "nullable": true
          },
          "srm": {
            "type": "number",
            "description": "Colour in SRM.",
            "format": "double",
            "nullable": true
          },
          "mashRatio": {
            "type": "number",
            "description": "Mash ratio, litres of water per kilogram of grain.",
            "format": "double",
            "nullable": true
          },
          "notes": {
            "maxLength": 500,
            "minLength": 0,
            "type": "string",
            "description": "Free-text notes.",
            "nullable": true
          },
          "style": {
            "type": "string",
            "description": "Read-only. The style of the beer the recipe produces.",
            "nullable": true
          },
          "ingredients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecipeIngredientDto"
            },
            "description": "The ingredients. Sending it replaces the whole set; omitting it keeps the current\r\ningredients; an empty array removes them all.",
            "nullable": true
          },
          "taskDefinitionIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "The task definitions a batch made from this recipe schedules. Sending it replaces the whole\r\nset; omitting it keeps the current ones. Ids come from\r\n`GET /api/v1/task-definitions`.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A recipe: what a batch of a given beer is made of, and which tasks it schedules."
      },
      "RecipeDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecipeDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "RecipeIngredientDto": {
        "type": "object",
        "properties": {
          "supplyId": {
            "type": "integer",
            "description": "The supply. Required. Listed by `GET /api/v1/supplies`.",
            "format": "int32"
          },
          "supplyTypeId": {
            "type": "integer",
            "description": "Kind of supply — malt, hops, yeast. Omitting it takes the one the supply itself declares,\r\nwhich is what the application does. Listed by `GET /api/v1/raw-material-types`.",
            "format": "int32",
            "nullable": true
          },
          "useId": {
            "type": "integer",
            "description": "What the ingredient is used for — mash, boil, whirlpool, dry hopping. Listed by\r\n`GET /api/v1/raw-material-uses`.",
            "format": "int32",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "description": "How much of it. Required.",
            "format": "double"
          },
          "unitId": {
            "type": "integer",
            "description": "Unit the quantity is expressed in. Listed by `GET /api/v1/units`.",
            "format": "int32",
            "nullable": true
          },
          "description": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Description shown on the recipe sheet. Required by the column; omitting it takes the\r\nsupply's own name.",
            "nullable": true
          },
          "notes": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Free-text notes.",
            "nullable": true
          },
          "discountsStock": {
            "type": "boolean",
            "description": "True when brewing a batch from this recipe takes the ingredient out of stock. Yeast is\r\nalways false: the application manages it through its own containers."
          },
          "position": {
            "type": "integer",
            "description": "Order of the ingredient on the recipe sheet.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One ingredient of a recipe."
      },
      "RegisterLeadContactRequestDto": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "description": "When the contact happened, `yyyy-MM-dd` or ISO 8601 with time. Omit it to use now.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Body of `POST /leads/{id}/register-contact`."
      },
      "RescheduleMaintenanceRequestDto": {
        "type": "object",
        "properties": {
          "eventDate": {
            "type": "string",
            "description": "Required. ISO 8601.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Request body for POST /maintenances/{id}/reschedule."
      },
      "ReturnablePackagingDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Returnable packaging id. Assigned by the server; ignored on update.",
            "format": "int32"
          },
          "name": {
            "maxLength": 200,
            "minLength": 0,
            "type": "string",
            "description": "Name. Required.",
            "nullable": true
          },
          "brand": {
            "maxLength": 200,
            "minLength": 0,
            "type": "string",
            "description": "Brand printed on it, when it has one.",
            "nullable": true
          },
          "color": {
            "maxLength": 100,
            "minLength": 0,
            "type": "string",
            "description": "Colour, as free text.",
            "nullable": true
          },
          "containerId": {
            "type": "integer",
            "description": "The container format this returnable is. Required. Allowed values:\r\nGET /api/v1/containers.",
            "format": "int32"
          },
          "supplyId": {
            "type": "integer",
            "description": "READ-ONLY. The supply that backs this returnable's stock. Assigned by the server on\r\ncreation, provisioning a new supply when none exists yet. Resolvable at\r\nGET /api/v1/supplies.",
            "format": "int32",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "READ-ONLY. Whether the definition is active."
          }
        },
        "additionalProperties": false,
        "description": "A returnable packaging: a crate or bottle format that comes back."
      },
      "ReturnablePackagingDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReturnablePackagingDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "ScheduleNextContactRequestDto": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "description": "When to follow up next, `yyyy-MM-dd` or ISO 8601 with time. Omit it (or send\r\n`null`) to clear a previously scheduled date — this endpoint's only job is to set\r\nor clear this one field.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Body of `POST /leads/{id}/next-contact`."
      },
      "ServiceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Service id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Required. At most 100 characters.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A service your account can be billed for by a supplier — an item a purchase can pay\r\n            without moving stock, alongside supplies, complementary products and spare parts."
      },
      "ServiceDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ServiceDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "SetLeadInactiveRequestDto": {
        "type": "object",
        "properties": {
          "inactive": {
            "type": "boolean",
            "description": "Required."
          }
        },
        "additionalProperties": false,
        "description": "Body of `POST /leads/{id}/set-inactive`."
      },
      "SparePartDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "code": {
            "type": "string",
            "description": "Free-text code. Optional, no uniqueness enforced.",
            "nullable": true
          },
          "name": {
            "type": "string",
            "description": "Required.",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "Optional, up to 250 characters.",
            "nullable": true
          },
          "minimumStock": {
            "type": "number",
            "description": "Threshold used for the low-stock alert. Optional.",
            "format": "double",
            "nullable": true
          },
          "active": {
            "type": "boolean"
          }
        },
        "additionalProperties": false,
        "description": "A spare part used in equipment maintenance."
      },
      "SparePartDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SparePartDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "SparePartMovementDto": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "description": "ISO 8601.",
            "nullable": true
          },
          "warehouseId": {
            "type": "integer",
            "description": "Allowed values: GET /api/v1/warehouses.",
            "format": "int32"
          },
          "previousWarehouseId": {
            "type": "integer",
            "description": "Set only for the destination leg of a transfer — the warehouse stock came from.",
            "format": "int32",
            "nullable": true
          },
          "balance": {
            "type": "number",
            "description": "Stock in `warehouseId` right after this movement.",
            "format": "double"
          },
          "previousBalance": {
            "type": "number",
            "description": "Stock in `warehouseId` right before this movement.",
            "format": "double"
          },
          "description": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One stock movement of a spare part — an adjustment, a transfer leg, or a discount from a finished maintenance."
      },
      "SparePartMovementDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SparePartMovementDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "SparePartStockAdjustmentDto": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": "number",
            "description": "How much to move. Positive enters stock, negative takes it out. Zero is rejected.",
            "format": "double"
          },
          "warehouseId": {
            "type": "integer",
            "description": "Allowed values: GET /api/v1/warehouses.",
            "format": "int32"
          },
          "note": {
            "type": "string",
            "description": "Free-text note. Optional.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A manual stock adjustment for one spare part: how much to move, and where."
      },
      "SparePartStockByWarehouseDto": {
        "type": "object",
        "properties": {
          "warehouseId": {
            "type": "integer",
            "description": "Allowed values: GET /api/v1/warehouses.",
            "format": "int32"
          },
          "warehouseName": {
            "type": "string",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "SparePartStockDto": {
        "type": "object",
        "properties": {
          "sparePartId": {
            "type": "integer",
            "format": "int32"
          },
          "total": {
            "type": "number",
            "description": "Stock on hand across every warehouse.",
            "format": "double"
          },
          "minimumStock": {
            "type": "number",
            "description": "Threshold below which the spare part is reported as running low. From GET /spare-parts/{id}.",
            "format": "double",
            "nullable": true
          },
          "byWarehouse": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SparePartStockByWarehouseDto"
            },
            "description": "Stock per warehouse — every active warehouse of your account, including ones with zero stock of this spare part.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Stock on hand of a spare part, overall and per warehouse."
      },
      "SparePartStockTransferDto": {
        "type": "object",
        "properties": {
          "fromWarehouseId": {
            "type": "integer",
            "description": "Allowed values: GET /api/v1/warehouses.",
            "format": "int32"
          },
          "toWarehouseId": {
            "type": "integer",
            "description": "Allowed values: GET /api/v1/warehouses. Must be different from fromWarehouseId.",
            "format": "int32"
          },
          "quantity": {
            "type": "number",
            "description": "How much to move. Must be greater than zero; decimals are allowed.",
            "format": "double"
          }
        },
        "additionalProperties": false,
        "description": "Moves stock of one spare part from one warehouse to another."
      },
      "StandaloneMeasurementCreateRequestDto": {
        "type": "object",
        "properties": {
          "measurementTypeId": {
            "type": "integer",
            "description": "Required. Listed by GET /api/v1/measurement-types.",
            "format": "int32"
          },
          "value": {
            "type": "number",
            "description": "Required.",
            "format": "double",
            "nullable": true
          },
          "recordedOn": {
            "type": "string",
            "description": "When it was recorded, ISO 8601. Defaults to now.",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "description": "Free-text notes.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "What to record when creating a standalone measurement."
      },
      "StandaloneMeasurementDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Measurement id.",
            "format": "int32"
          },
          "measurementTypeId": {
            "type": "integer",
            "description": "What was measured. Listed by GET /api/v1/measurement-types.",
            "format": "int32"
          },
          "value": {
            "type": "number",
            "description": "The measured value.",
            "format": "double"
          },
          "recordedOn": {
            "type": "string",
            "description": "When it was recorded, ISO 8601.",
            "format": "date-time"
          },
          "notes": {
            "type": "string",
            "description": "Free-text notes.",
            "nullable": true
          },
          "recordedByUserId": {
            "type": "integer",
            "description": "User that recorded it.",
            "format": "int32"
          },
          "active": {
            "type": "boolean",
            "description": "False once the measurement has been deactivated."
          }
        },
        "additionalProperties": false,
        "description": "A measurement not tied to any batch."
      },
      "StandaloneMeasurementDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StandaloneMeasurementDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "StockCostValuationLineDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "What kind of stock position this line is: `keg`, `container`, `case`,\r\n`mixPack` or `complementary`. Same vocabulary as `stock-valuation`. No\r\n`tank` value in this version (see remarks).",
            "nullable": true
          },
          "productId": {
            "type": "integer",
            "description": "Product id. Listed by `GET /api/v1/products`.",
            "format": "int32"
          },
          "containerId": {
            "type": "integer",
            "description": "Loose container. Set only when `type` is `container`. Listed by `GET /api/v1/containers`.",
            "format": "int32",
            "nullable": true
          },
          "caseId": {
            "type": "integer",
            "description": "Case (or mix pack). Set only when `type` is `case`. Listed by `GET /api/v1/cases`.",
            "format": "int32",
            "nullable": true
          },
          "stock": {
            "type": "number",
            "description": "Units in stock.",
            "format": "double"
          },
          "liters": {
            "type": "number",
            "format": "double"
          },
          "costPerUnit": {
            "type": "number",
            "description": "Production cost per unit, at whatever level of the costing cascade resolved it (see GCerv.Api.Dto.StockCostValuationLineDto.costOrigin). `0` when undetermined.",
            "format": "double"
          },
          "costPerLiter": {
            "type": "number",
            "description": "Production cost per liter. Only meaningful for `keg` lines.",
            "format": "double"
          },
          "total": {
            "type": "number",
            "format": "double"
          },
          "costOrigin": {
            "type": "string",
            "nullable": true
          },
          "preliminaryCosting": {
            "type": "boolean",
            "description": "`true` when the lot costing that resolved this line is a <strong>preliminary costing</strong>\r\n            generated automatically by the brewery's automatic batch costing: it includes supplies only,\r\n            with <strong>no fixed costs</strong>. Only ever `true` together with\r\n            `costOrigin = lotCosting`; `costOrigin` keeps its value, this field is the extra\r\n            qualifier. `false` for every brewery that does not use automatic batch costing."
          },
          "warehouseName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One line of the current stock valuation at production cost."
      },
      "StockMovementDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Line id. Unique across the whole resource.",
            "format": "int32"
          },
          "transferId": {
            "type": "integer",
            "description": "Groups every line moved together in the same transfer. More than one line shares a\r\n`transferId` when a single transfer moved more than one product/container/case.",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "description": "When the transfer happened.",
            "format": "date-time"
          },
          "warehouseFromId": {
            "type": "integer",
            "description": "Warehouse the stock left. Listed by `GET /api/v1/warehouses`.",
            "format": "int32"
          },
          "warehouseFromName": {
            "type": "string",
            "nullable": true
          },
          "warehouseToId": {
            "type": "integer",
            "description": "Warehouse the stock arrived at. Listed by `GET /api/v1/warehouses`.",
            "format": "int32"
          },
          "warehouseToName": {
            "type": "string",
            "nullable": true
          },
          "itemType": {
            "type": "string",
            "description": "What kind of stock this line moved: `container`, `case`, `mixPack` or `complementary`.",
            "nullable": true
          },
          "productId": {
            "type": "integer",
            "description": "Product id. Listed by `GET /api/v1/products`.",
            "format": "int32"
          },
          "containerId": {
            "type": "integer",
            "description": "Loose container moved. Set only when `itemType` is `container`.",
            "format": "int32",
            "nullable": true
          },
          "caseId": {
            "type": "integer",
            "description": "Case (or mix pack) moved. Set only when `itemType` is `case` or `mixPack`.",
            "format": "int32",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "description": "How many units moved.",
            "format": "double"
          }
        },
        "additionalProperties": false,
        "description": "One line of a transfer of product or packaging stock between two warehouses."
      },
      "StockMovementDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StockMovementDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "StockMovementLineRequestDto": {
        "type": "object",
        "properties": {
          "itemType": {
            "type": "string",
            "description": "What kind of stock this line moves: `container`, `case` or `complementary`.\r\nDecides which of `containerId`/`caseId` is required.",
            "nullable": true
          },
          "productId": {
            "type": "integer",
            "description": "Product id. Listed by `GET /api/v1/products`.",
            "format": "int32"
          },
          "containerId": {
            "type": "integer",
            "description": "Loose container moved. Required when `itemType` is `container`.",
            "format": "int32",
            "nullable": true
          },
          "caseId": {
            "type": "integer",
            "description": "Case moved. Required when `itemType` is `case`.",
            "format": "int32",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "description": "How many units to move.",
            "format": "double"
          }
        },
        "additionalProperties": false,
        "description": "One line of a transfer request."
      },
      "StockMovementRequestDto": {
        "type": "object",
        "properties": {
          "warehouseFromId": {
            "type": "integer",
            "description": "Warehouse the stock leaves. Listed by `GET /api/v1/warehouses`.",
            "format": "int32"
          },
          "warehouseToId": {
            "type": "integer",
            "description": "Warehouse the stock arrives at. Listed by `GET /api/v1/warehouses`.",
            "format": "int32"
          },
          "notes": {
            "type": "string",
            "description": "Free-text note for the delivery note this creates. Optional.",
            "nullable": true
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StockMovementLineRequestDto"
            },
            "description": "One or more lines to move in the same transfer.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A transfer of product or packaging stock between two of your warehouses."
      },
      "StockValuationLineDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "What kind of stock position this line is: `keg`, `container`, `case`,\r\n`mixPack` or `complementary`. Same vocabulary as `itemType` on\r\n`stock-movements`, plus `keg` (which that resource excludes on purpose).",
            "nullable": true
          },
          "productId": {
            "type": "integer",
            "description": "Product id. Listed by `GET /api/v1/products`.",
            "format": "int32"
          },
          "containerId": {
            "type": "integer",
            "description": "Loose container. Set only when `type` is `container`. Listed by `GET /api/v1/containers`.",
            "format": "int32",
            "nullable": true
          },
          "caseId": {
            "type": "integer",
            "description": "Case (or mix pack). Set only when `type` is `case`. Listed by `GET /api/v1/cases`.",
            "format": "int32",
            "nullable": true
          },
          "stock": {
            "type": "number",
            "description": "Units in stock.",
            "format": "double"
          },
          "liters": {
            "type": "number",
            "format": "double"
          },
          "pricePerUnit": {
            "type": "number",
            "description": "Current sale price per unit, without tax. `0` when the product has none set.",
            "format": "double"
          },
          "pricePerLiter": {
            "type": "number",
            "description": "Current sale price per liter, without tax. Only meaningful for `keg` lines.",
            "format": "double"
          },
          "total": {
            "type": "number",
            "format": "double"
          },
          "warehouseName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SupplierBalanceDto": {
        "type": "object",
        "properties": {
          "supplierId": {
            "type": "integer",
            "description": "Supplier id.",
            "format": "int32"
          },
          "balance": {
            "type": "number",
            "description": "What you owe the supplier right now. Positive means you owe; negative means you paid in\r\nadvance.",
            "format": "double"
          },
          "currencyId": {
            "type": "integer",
            "description": "Currency the balance is expressed in — the supplier's own currency.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A supplier's outstanding balance."
      },
      "SupplierCategoryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Category id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Required. Must be unique among your active and inactive categories.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A category used to group your suppliers."
      },
      "SupplierCategoryDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplierCategoryDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "SupplierDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Supplier id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "tradeName": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Trade name. Required on create.",
            "nullable": true
          },
          "legalName": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Legal name. Two active suppliers of the same currency cannot share it.",
            "nullable": true
          },
          "taxId": {
            "maxLength": 30,
            "minLength": 0,
            "type": "string",
            "description": "Tax identification number (CUIT / RUT / RFC, depending on the country). Two active\r\nsuppliers of the same currency cannot share it.",
            "nullable": true
          },
          "address": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Street address.",
            "nullable": true
          },
          "city": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "City.",
            "nullable": true
          },
          "postalCode": {
            "maxLength": 10,
            "minLength": 0,
            "type": "string",
            "description": "Postal code.",
            "nullable": true
          },
          "phones": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Phone numbers, free text.",
            "nullable": true
          },
          "emails": {
            "maxLength": 150,
            "minLength": 0,
            "type": "string",
            "description": "E-mail addresses, comma separated.",
            "nullable": true
          },
          "contactName": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Contact person.",
            "nullable": true
          },
          "notes": {
            "maxLength": 500,
            "minLength": 0,
            "type": "string",
            "description": "Free-form notes.",
            "nullable": true
          },
          "mapsAddress": {
            "maxLength": 500,
            "minLength": 0,
            "type": "string",
            "description": "Address as written for map lookups. Free text; not validated against any provider.",
            "nullable": true
          },
          "taxConditionId": {
            "type": "integer",
            "description": "Tax condition id. Allowed values: GET /api/v1/tax-conditions. The set depends on the\r\ncountry of your account, so it is deliberately not enumerated in this specification.",
            "format": "int32"
          },
          "provinceId": {
            "type": "integer",
            "description": "Province, state or region. Allowed values: GET /api/v1/provinces. Null clears it.",
            "format": "int32",
            "nullable": true
          },
          "currencyId": {
            "type": "integer",
            "description": "Currency of the supplier's current account. Allowed values: GET /api/v1/currencies.\r\nDefaults to your account's currency when creating. It cannot be changed once the supplier\r\nhas current-account entries.",
            "format": "int32"
          },
          "supplierTypeId": {
            "type": "integer",
            "description": "Supplier type. Allowed values: GET /api/v1/supplier-types. Null clears it.\r\nOnly suppliers of the logistics type can be assigned to a customer as its logistics provider.",
            "format": "int32",
            "nullable": true
          },
          "categoryId": {
            "type": "integer",
            "description": "Supplier category. Allowed values: GET /api/v1/supplier-categories. Null clears it.",
            "format": "int32",
            "nullable": true
          },
          "defaultAccountId": {
            "type": "integer",
            "description": "Expense account this supplier's purchases default to. Allowed values:\r\nGET /api/v1/expense-accounts. Null clears it.",
            "format": "int32",
            "nullable": true
          },
          "paymentTermDays": {
            "type": "integer",
            "description": "Agreed payment term, in days. Informative: it does not schedule anything by itself.",
            "format": "int32",
            "nullable": true
          },
          "latitude": {
            "type": "number",
            "description": "Latitude. Sending null resets it to 0, which the application reads as \"not set\".",
            "format": "double",
            "nullable": true
          },
          "longitude": {
            "type": "number",
            "description": "Longitude. Sending null resets it to 0, which the application reads as \"not set\".",
            "format": "double",
            "nullable": true
          },
          "driverName": {
            "maxLength": 200,
            "minLength": 0,
            "type": "string",
            "description": "Driver name, for electronic dispatch notes.",
            "nullable": true
          },
          "driverTaxId": {
            "maxLength": 20,
            "minLength": 0,
            "type": "string",
            "description": "Driver tax id, for electronic dispatch notes.",
            "nullable": true
          },
          "vehiclePlate": {
            "maxLength": 20,
            "minLength": 0,
            "type": "string",
            "description": "Vehicle plate, for electronic dispatch notes.",
            "nullable": true
          },
          "createdOn": {
            "type": "string",
            "description": "When the supplier was created. Read-only: assigned by the server.",
            "format": "date-time"
          },
          "active": {
            "type": "boolean",
            "description": "False when the supplier has been deactivated. Read-only: use /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A supplier of your account."
      },
      "SupplierDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplierDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "SupplierItemMappingDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Mapping id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "supplierId": {
            "type": "integer",
            "description": "The supplier this mapping applies to. Null applies to every supplier.",
            "format": "int32",
            "nullable": true
          },
          "invoiceDescription": {
            "type": "string",
            "description": "The invoice text this mapping matches. Required on create. Read-only afterwards — see the\r\nremark on the class.",
            "nullable": true
          },
          "supplyId": {
            "type": "integer",
            "description": "Supply (raw material) this description maps to. Allowed values: GET /api/v1/supplies.",
            "format": "int32",
            "nullable": true
          },
          "serviceId": {
            "type": "integer",
            "description": "Service this description maps to. Allowed values: GET /api/v1/purchasable-services.",
            "format": "int32",
            "nullable": true
          },
          "complementaryProductId": {
            "type": "integer",
            "description": "Complementary product this description maps to. Allowed values: GET /api/v1/complementary-products.",
            "format": "int32",
            "nullable": true
          },
          "sparePartId": {
            "type": "integer",
            "description": "Spare part this description maps to. Allowed values: GET /api/v1/spare-parts.",
            "format": "int32",
            "nullable": true
          },
          "otherDescription": {
            "type": "string",
            "description": "Free-text label used only when none of the four ids above could be resolved. Not settable\r\nfrom the web screen that manages this resource — only a different, unrelated flow writes\r\nit — but it is a real, persisted field.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false
      },
      "SupplierItemMappingDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplierItemMappingDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "SupplierLedgerEntryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Movement id.",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "description": "Date of the movement.",
            "format": "date-time"
          },
          "description": {
            "type": "string",
            "description": "What the movement is. Free text written by whoever generated it.",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "description": "Amount. Positive increases what you owe the supplier, negative reduces it — a payment is\r\nnegative.",
            "format": "double"
          },
          "balance": {
            "type": "number",
            "description": "Balance after this movement.",
            "format": "double"
          },
          "previousBalance": {
            "type": "number",
            "description": "Balance before this movement.",
            "format": "double"
          },
          "invoiceNumber": {
            "type": "string",
            "description": "Invoice number this movement refers to, when it came from a purchase.",
            "nullable": true
          },
          "purchaseId": {
            "type": "integer",
            "description": "The purchase that generated it, if any. Read it with GET /api/v1/purchases/{id}.",
            "format": "int32",
            "nullable": true
          },
          "currencyId": {
            "type": "integer",
            "description": "Currency of the movement.",
            "format": "int32"
          },
          "reconciled": {
            "type": "boolean",
            "description": "True when the movement has been reconciled against its counterpart."
          },
          "createdOn": {
            "type": "string",
            "description": "When the movement was recorded, which may differ from its date.",
            "format": "date-time"
          }
        },
        "additionalProperties": false,
        "description": "One movement in a supplier's current account."
      },
      "SupplierLedgerEntryDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplierLedgerEntryDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "SupplyConvertibleUnitsDto": {
        "type": "object",
        "properties": {
          "supplyId": {
            "type": "integer",
            "description": "Supply id.",
            "format": "int32"
          },
          "baseUnitId": {
            "type": "integer",
            "description": "The unit its stock is counted in. Everything converts to this one.",
            "format": "int32",
            "nullable": true
          },
          "unitIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "The units you may send, including the base one.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "The units a quantity of this supply may be expressed in."
      },
      "SupplyDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Supply id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Name. Required on create and unique among your supplies.",
            "nullable": true
          },
          "brand": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Brand. Shown next to the name wherever the supply is listed.",
            "nullable": true
          },
          "supplyTypeId": {
            "type": "integer",
            "description": "Kind of supply — malt, hops, yeast, packaging. Required on create. Listed by\r\n`GET /api/v1/raw-material-types`.",
            "format": "int32"
          },
          "typeName": {
            "type": "string",
            "description": "Read-only. The name of the kind, in the language of your token.",
            "nullable": true
          },
          "unitId": {
            "type": "integer",
            "description": "Unit the stock of this supply is counted in. Everything else — purchases, recipes — is\r\nconverted to it. Listed by `GET /api/v1/units`.",
            "format": "int32",
            "nullable": true
          },
          "supplierId": {
            "type": "integer",
            "description": "The supplier you usually buy it from. Listed by `GET /api/v1/suppliers`.",
            "format": "int32",
            "nullable": true
          },
          "packaging": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "How it comes packaged — \"bag\", \"drum\". Free text.",
            "nullable": true
          },
          "packagingQuantity": {
            "type": "number",
            "description": "How much one package holds, in `unitId`.",
            "format": "double"
          },
          "caseId": {
            "type": "integer",
            "description": "The case this supply corresponds to, when it is returnable packaging. Listed by\r\n`GET /api/v1/cases`.",
            "format": "int32",
            "nullable": true
          },
          "dryExtract": {
            "type": "number",
            "description": "Dry extract, for malts. Used by the brewing calculations.",
            "format": "double",
            "nullable": true
          },
          "minimumStock": {
            "type": "number",
            "description": "Stock level below which the supply is reported as running low. Stored in its own record, so\r\nsending it here is enough — there is no separate endpoint.",
            "format": "double",
            "nullable": true
          },
          "unitCost": {
            "type": "number",
            "description": "Cost per unit you set by hand, in your account's currency. Sending it records a new cost\r\nentry; the previous ones are kept as history. Omit it to leave the cost alone.",
            "format": "double",
            "nullable": true
          },
          "stock": {
            "type": "number",
            "description": "Read-only. Stock on hand, in `unitId`.",
            "format": "double"
          },
          "lastPurchasePrice": {
            "type": "number",
            "description": "Read-only. What the last purchase paid per unit, <strong>as recorded</strong>, in the\r\ncurrency of `currencyId`. It is not converted to your account's currency: converting\r\nsilently would hand you a number whose unit you cannot see.",
            "format": "double",
            "nullable": true
          },
          "lastPurchaseUnitId": {
            "type": "integer",
            "description": "Read-only. The unit that last purchase was expressed in.",
            "format": "int32",
            "nullable": true
          },
          "currencyId": {
            "type": "integer",
            "description": "Read-only. Currency of the recorded cost.",
            "format": "int32",
            "nullable": true
          },
          "accountId": {
            "type": "integer",
            "description": "Read-only. Expense account this supply is charged to, if one is assigned.",
            "format": "int32",
            "nullable": true
          },
          "expenseCategoryId": {
            "type": "integer",
            "description": "Read-only. Category of that expense account.",
            "format": "int32",
            "nullable": true
          },
          "shared": {
            "type": "boolean",
            "description": "Read-only. True when the supply belongs to the system and is shared by every account: it can\r\nbe used but not modified, and any write against it is rejected."
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A supply: a raw material or consumable you buy, hold in stock and use up."
      },
      "SupplyDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplyDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "SupplyExternalLotDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Record id.",
            "format": "int32"
          },
          "lotNumber": {
            "type": "string",
            "description": "The lot number as the supplier labelled it.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "True while the lot is still on record. A cancelled purchase switches it off."
          },
          "purchaseId": {
            "type": "integer",
            "description": "The purchase that brought it in. Read it with GET /api/v1/purchases/{id}.",
            "format": "int32",
            "nullable": true
          },
          "invoiceNumber": {
            "type": "string",
            "description": "Invoice number of that purchase.",
            "nullable": true
          },
          "purchaseDate": {
            "type": "string",
            "description": "Date of that purchase.",
            "format": "date-time",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "description": "How much came in, in `unitId`.",
            "format": "double",
            "nullable": true
          },
          "unitId": {
            "type": "integer",
            "description": "Unit that quantity is expressed in.",
            "format": "int32",
            "nullable": true
          },
          "consumedByBatchIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "Ids of the production batches that used this lot.",
            "nullable": true
          },
          "consumedByPackagingRunIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "Ids of the packaging runs that used this lot.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One external lot of a supply: the batch number it arrived with."
      },
      "SupplyProjectionDto": {
        "type": "object",
        "properties": {
          "supplyTypeId": {
            "type": "integer",
            "description": "The kind of supply the projection was asked for.",
            "format": "int32"
          },
          "unitId": {
            "type": "integer",
            "description": "The unit EVERY series is expressed in. See the remark above.",
            "format": "int32",
            "nullable": true
          },
          "fromDate": {
            "type": "string",
            "description": "First day of the projection, which is today.",
            "format": "date-time"
          },
          "days": {
            "type": "integer",
            "description": "How many days it covers. Comes from your account's configuration.",
            "format": "int32"
          },
          "series": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplyProjectionSeriesDto"
            },
            "description": "One series per supply.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Projected stock of the supplies of one kind, day by day."
      },
      "SupplyProjectionSeriesDto": {
        "type": "object",
        "properties": {
          "supplyId": {
            "type": "integer",
            "description": "Supply id.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Supply name, with its brand when it has one.",
            "nullable": true
          },
          "quantities": {
            "type": "array",
            "items": {
              "type": "number",
              "format": "double"
            },
            "description": "Projected stock, one entry per day starting at `fromDate`. Negative means the planned\r\nbatches would run the supply out on that day.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "The projected stock of one supply, one value per day."
      },
      "SupplyStockAdjustmentDto": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": "number",
            "description": "How much to move, in `unitId` (or the supply's own unit when `unitId` is\r\nomitted). Positive enters stock, negative takes it out.",
            "format": "double"
          },
          "unitId": {
            "type": "integer",
            "description": "Unit `quantity` is expressed in. Listed by `GET /api/v1/units`. Omit it to use\r\nthe supply's own unit — see `unitId` of `GET /supplies/{id}`.",
            "format": "int32",
            "nullable": true
          },
          "supplyWarehouseId": {
            "type": "integer",
            "description": "Supply warehouse the movement applies to. Listed by\r\n`GET /api/v1/supply-warehouses`, which is empty unless your account uses several —\r\nleave it null then.",
            "format": "int32",
            "nullable": true
          },
          "movementDate": {
            "type": "string",
            "description": "When the movement happened, ISO 8601. Omit it to use now. Rejected if it is more than 30\r\ndays in the past.",
            "nullable": true
          },
          "note": {
            "maxLength": 128,
            "minLength": 0,
            "type": "string",
            "description": "Free-form note on the movement.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A manual stock adjustment for one supply: how much to move, and where."
      },
      "SupplyStockByWarehouseDto": {
        "type": "object",
        "properties": {
          "warehouseId": {
            "type": "integer",
            "description": "Warehouse id. Listed by `GET /api/v1/supply-warehouses`.",
            "format": "int32"
          },
          "warehouseName": {
            "type": "string",
            "description": "Warehouse name.",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "description": "Stock on hand in that warehouse.",
            "format": "double"
          }
        },
        "additionalProperties": false,
        "description": "The stock of one supply in one warehouse."
      },
      "SupplyStockCountDto": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": "number",
            "description": "The quantity actually counted, in `unitId` (or the supply's own unit when\r\n`unitId` is omitted). An absolute value, not a delta: it replaces the previous\r\nquantity instead of adding to or subtracting from it. For a movement relative to current\r\nstock, use `POST /api/v1/supplies/{id}/stock/adjustments` instead.",
            "format": "double"
          },
          "unitId": {
            "type": "integer",
            "description": "Unit `quantity` is expressed in. Listed by `GET /api/v1/units`. Omit it to use\r\nthe supply's own unit — see `unitId` of `GET /supplies/{id}`.",
            "format": "int32",
            "nullable": true
          },
          "supplyWarehouseId": {
            "type": "integer",
            "description": "Supply warehouse the count applies to. Listed by\r\n`GET /api/v1/supply-warehouses`, which is empty unless your account uses several —\r\nleave it null then.",
            "format": "int32",
            "nullable": true
          },
          "movementDate": {
            "type": "string",
            "description": "When the count happened, ISO 8601. Omit it to use now. Rejected if it is more than 30\r\ndays in the past.",
            "nullable": true
          },
          "note": {
            "maxLength": 128,
            "minLength": 0,
            "type": "string",
            "description": "Free-form note on the count.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A physical stock count for one supply: the quantity actually on hand, as counted."
      },
      "SupplyStockDto": {
        "type": "object",
        "properties": {
          "supplyId": {
            "type": "integer",
            "description": "Supply id.",
            "format": "int32"
          },
          "unitId": {
            "type": "integer",
            "description": "Unit the quantities are expressed in.",
            "format": "int32",
            "nullable": true
          },
          "total": {
            "type": "number",
            "description": "Stock on hand across every warehouse.",
            "format": "double"
          },
          "minimumStock": {
            "type": "number",
            "description": "Stock level below which the supply is reported as running low.",
            "format": "double",
            "nullable": true
          },
          "byWarehouse": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplyStockByWarehouseDto"
            },
            "description": "Stock per warehouse. Empty when your account does not use multiple supply warehouses — then\r\n`total` is the whole answer.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "The stock of one supply, overall and per warehouse."
      },
      "SupplyTransferDto": {
        "type": "object",
        "properties": {
          "transferId": {
            "type": "integer",
            "description": "Id of the delivery note (`Remito`) the transfer generated. Shared by every line.",
            "format": "int32"
          },
          "fromWarehouseId": {
            "type": "integer",
            "description": "Source warehouse.",
            "format": "int32"
          },
          "toWarehouseId": {
            "type": "integer",
            "description": "Destination warehouse.",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "description": "When the transfer was recorded.",
            "format": "date-time"
          },
          "notes": {
            "type": "string",
            "description": "Note on the transfer, if one was sent.",
            "nullable": true
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplyTransferLineDto"
            },
            "description": "The supplies moved.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A transfer just created: what moved, from where, to where."
      },
      "SupplyTransferLineDto": {
        "type": "object",
        "properties": {
          "supplyId": {
            "type": "integer",
            "description": "Supply moved.",
            "format": "int32"
          },
          "quantity": {
            "type": "number",
            "description": "How much moved, in `unitId`.",
            "format": "double"
          },
          "unitId": {
            "type": "integer",
            "description": "Unit `quantity` is expressed in.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One supply moved, as recorded."
      },
      "SupplyTransferLineRequestDto": {
        "type": "object",
        "properties": {
          "supplyId": {
            "type": "integer",
            "description": "Supply to move. Listed by `GET /api/v1/supplies`.",
            "format": "int32"
          },
          "quantity": {
            "type": "number",
            "description": "How much to move, in `unitId` (or the supply's own unit when omitted). Must be positive.",
            "format": "double"
          },
          "unitId": {
            "type": "integer",
            "description": "Unit `quantity` is expressed in. Listed by `GET /api/v1/units`. Omit it to use the supply's own unit.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One supply moved by a transfer, and how much."
      },
      "SupplyTransferRequestDto": {
        "type": "object",
        "properties": {
          "toWarehouseId": {
            "type": "integer",
            "description": "Destination warehouse. Listed by `GET /api/v1/supply-warehouses`, same catalog as\r\nthe warehouse of the route.",
            "format": "int32"
          },
          "notes": {
            "maxLength": 128,
            "minLength": 0,
            "type": "string",
            "description": "Free-form note on the transfer.",
            "nullable": true
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplyTransferLineRequestDto"
            },
            "description": "The supplies to move, one line each.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A transfer of one or more supplies from one supply warehouse to another."
      },
      "SupplyWarehouseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Warehouse id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Name. Required on create.",
            "nullable": true
          },
          "code": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "Your own code for it.",
            "nullable": true
          },
          "address": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Street address.",
            "nullable": true
          },
          "city": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Town or city.",
            "nullable": true
          },
          "provinceId": {
            "type": "integer",
            "description": "Province, state or region. Listed by `GET /api/v1/provinces`.",
            "format": "int32",
            "nullable": true
          },
          "provinceName": {
            "type": "string",
            "description": "Read-only. The name of that province, in the language of your token.",
            "nullable": true
          },
          "phone": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Phone number.",
            "nullable": true
          },
          "dimensions": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Free-text description of its size or layout.",
            "nullable": true
          },
          "logisticsAddress": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Address to hand to a courier, when it differs from the postal one.",
            "nullable": true
          },
          "latitude": {
            "type": "number",
            "description": "Latitude. Sending null resets it to 0 — see the remark on the class.",
            "format": "double",
            "nullable": true
          },
          "longitude": {
            "type": "number",
            "description": "Longitude. Sending null resets it to 0 — see the remark on the class.",
            "format": "double",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A supply warehouse: a place where you keep raw materials."
      },
      "SupplyWarehouseDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplyWarehouseDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "TankDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Tank id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Name. Required on create.",
            "nullable": true
          },
          "tankTypeId": {
            "type": "integer",
            "description": "What kind of tank it is. Required on create. Listed by GET /api/v1/tank-types.",
            "format": "int32",
            "nullable": true
          },
          "woodTypeId": {
            "type": "integer",
            "description": "The kind of wood, only meaningful when the tank is a barrel. Listed by GET /api/v1/wood-types.",
            "format": "int32",
            "nullable": true
          },
          "liters": {
            "type": "integer",
            "description": "Capacity, in litres. Required on create.",
            "format": "int32"
          },
          "status": {
            "type": "string",
            "description": "Read-only. One of: empty, withContent, dirty, underMaintenance, cleaning, reserved. Changed\r\nonly by moving a batch through its stages or by the (unpublished) maintenance module.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A tank: where a batch ferments, matures, or ages in wood."
      },
      "TankDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TankDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "TapSystemDeliveryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Delivery note id.",
            "format": "int32"
          },
          "number": {
            "type": "string",
            "description": "The delivery note's own number.",
            "nullable": true
          },
          "customerId": {
            "type": "integer",
            "description": "The customer the tap systems were delivered to.",
            "format": "int32"
          },
          "customerLocationId": {
            "type": "integer",
            "description": "The customer's point of sale, if any.",
            "format": "int32",
            "nullable": true
          },
          "deliveryDate": {
            "type": "string",
            "description": "When the delivery happened.",
            "format": "date-time"
          },
          "createdOn": {
            "type": "string",
            "description": "When the delivery note was generated.",
            "format": "date-time"
          },
          "notes": {
            "type": "string",
            "description": "Free-text note.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "False when the delivery note was voided."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TapSystemDeliveryLineDto"
            },
            "description": "The tap systems delivered.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A delivery note (remito) of one or more tap systems to a customer."
      },
      "TapSystemDeliveryDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TapSystemDeliveryDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "TapSystemDeliveryLineDto": {
        "type": "object",
        "properties": {
          "tapSystemId": {
            "type": "integer",
            "description": "Tap system id.",
            "format": "int32"
          },
          "description": {
            "type": "string",
            "description": "Read-only description, as recorded at delivery time.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "One tap system on a delivery note."
      },
      "TapSystemDeliveryRequestDto": {
        "type": "object",
        "properties": {
          "customerId": {
            "type": "integer",
            "description": "Destination customer. Listed by `GET /api/v1/customers`.",
            "format": "int32"
          },
          "customerLocationId": {
            "type": "integer",
            "description": "Destination point of sale, if the customer has more than one. Listed by `GET /api/v1/customers/{customerId}/points-of-sale`.",
            "format": "int32",
            "nullable": true
          },
          "date": {
            "type": "string",
            "description": "When the delivery happened, ISO 8601.",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "description": "Free-text note.",
            "nullable": true
          },
          "tapSystemIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "The tap systems to deliver. Each must not currently be at a customer.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Delivering one or more tap systems to a customer for the first time."
      },
      "TapSystemDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Tap system id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "code": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "The code printed or tagged on the equipment. Required on create, and unique among your tap systems.",
            "nullable": true
          },
          "name": {
            "maxLength": 200,
            "minLength": 0,
            "type": "string",
            "nullable": true
          },
          "address": {
            "maxLength": 500,
            "minLength": 0,
            "type": "string",
            "nullable": true
          },
          "phone": {
            "maxLength": 100,
            "minLength": 0,
            "type": "string",
            "nullable": true
          },
          "connector": {
            "type": "string",
            "description": "Valve/connector type: `G`, `A`, `S`, `D` or `CO` (Cornelius).\r\nFixed set, not a catalog endpoint. `D` and `CO` are only valid on non-Argentina\r\naccounts, same restriction the application's own screen enforces by hiding the option.",
            "nullable": true
          },
          "tapSystemTypeId": {
            "type": "integer",
            "description": "Kind of tap system. Listed by `GET /api/v1/tap-system-types`.",
            "format": "int32",
            "nullable": true
          },
          "tapSystemTypeName": {
            "type": "string",
            "description": "Read-only. Name of that kind, in the language of your token.",
            "nullable": true
          },
          "fullWithCo2": {
            "type": "boolean",
            "description": "Whether it comes complete with a CO2 setup.",
            "nullable": true
          },
          "brand": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "nullable": true
          },
          "netValue": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "usefulLife": {
            "type": "string",
            "description": "End of useful life, ISO 8601 date. Optional.",
            "nullable": true
          },
          "notes": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "nullable": true
          },
          "underMaintenance": {
            "type": "boolean",
            "description": "Read-only. True while the equipment is under maintenance."
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          },
          "customerId": {
            "type": "integer",
            "description": "Read-only. The customer currently holding the tap system, if any. Listed by\r\n`GET /api/v1/customers`. To change it, see `POST /api/v1/tap-systems/deliveries`.",
            "format": "int32",
            "nullable": true
          },
          "customerName": {
            "type": "string",
            "description": "Read-only. Name of that customer.",
            "nullable": true
          },
          "customerLocationId": {
            "type": "integer",
            "description": "Read-only. The customer's point of sale holding the tap system, when it has one. Listed\r\nby `GET /api/v1/customers/{customerId}/points-of-sale`.",
            "format": "int32",
            "nullable": true
          },
          "deliveredOn": {
            "type": "string",
            "description": "Read-only. When it was delivered to that customer.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A tap system (dispenser): the reusable equipment used to pour draft beer, tracked by code as\r\nit moves to and from customers."
      },
      "TapSystemDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TapSystemDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "TapSystemReturnRequestDto": {
        "type": "object",
        "properties": {
          "tapSystemIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "The tap systems being returned. Each must currently be at a customer.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A customer returning one or more tap systems."
      },
      "TaskCompletionDto": {
        "type": "object",
        "properties": {
          "completedOn": {
            "type": "string",
            "description": "When the task was completed, ISO 8601. Defaults to now. Only honoured for batch tasks: a\r\nstandalone task is always stamped with the moment it was completed.",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "description": "Notes to record on completion. Replaces the task's notes.",
            "nullable": true
          },
          "measurementTypeId": {
            "type": "integer",
            "description": "The measurement being reported, if the task asks for one. Listed by\r\n`GET /api/v1/measurement-types`.",
            "format": "int32",
            "nullable": true
          },
          "value": {
            "type": "number",
            "description": "The measured value. Only a temperature may be negative: a negative gravity or pH is\r\nrejected, since it is a data-entry mistake rather than a reading.",
            "format": "double",
            "nullable": true
          },
          "brewMinutes": {
            "type": "integer",
            "description": "Minutes the brew took. Only meaningful for a task that falls on the brew day.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "What to record when completing a task."
      },
      "TaskDefinitionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Task definition id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "maxLength": 200,
            "minLength": 0,
            "type": "string",
            "description": "Name. Required on create; two active definitions of your account cannot share it.",
            "nullable": true
          },
          "isGroup": {
            "type": "boolean",
            "description": "True when this definition is a group that contains other definitions instead of a task on\r\nits own. A group is what the application shows with \"(Grupo)\" appended to its name."
          },
          "parentTaskId": {
            "type": "integer",
            "description": "Id of the group this definition belongs to, if any.",
            "format": "int32",
            "nullable": true
          },
          "childTaskIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "Ids of the definitions contained in this group. Only meaningful when `isGroup` is\r\ntrue. Sending it replaces the whole set; omitting it keeps the current one; an empty array\r\nempties the group.",
            "nullable": true
          },
          "days": {
            "type": "integer",
            "description": "Days after the brew date on which the task falls due. Used when the batch's recipe\r\ngenerates its tasks: day 0 is the brew itself.",
            "format": "int32",
            "nullable": true
          },
          "notes": {
            "maxLength": 1000,
            "minLength": 0,
            "type": "string",
            "description": "Free-text notes.",
            "nullable": true
          },
          "measurementTypeId": {
            "type": "integer",
            "description": "Measurement the task asks for when it is completed, if any.",
            "format": "int32",
            "nullable": true
          },
          "discountsStock": {
            "type": "boolean",
            "description": "True when completing the task takes its supplies out of stock."
          },
          "isShared": {
            "type": "boolean",
            "description": "Read-only. True for a definition shared by every account, which you may use but not\r\nmodify. Writing to a shared definition answers `400`."
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A reusable task definition: the template a task is created from, not a task to be done."
      },
      "TaskDefinitionDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskDefinitionDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "TaskDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Task id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "taskDefinitionId": {
            "type": "integer",
            "description": "The definition this task comes from. Required on create; listed by\r\n`GET /api/v1/task-definitions`.",
            "format": "int32"
          },
          "name": {
            "maxLength": 100,
            "minLength": 0,
            "type": "string",
            "description": "Name of this particular task. Defaults to the definition's name when omitted on create,\r\nso a caller that only sends `taskDefinitionId` gets something readable.",
            "nullable": true
          },
          "dueDate": {
            "type": "string",
            "description": "Date the task is due, `YYYY-MM-DD`. Required on create.",
            "nullable": true
          },
          "time": {
            "maxLength": 5,
            "minLength": 0,
            "type": "string",
            "description": "Time of day the task is due, `HH:mm`. Optional.",
            "nullable": true
          },
          "notes": {
            "maxLength": 1000,
            "minLength": 0,
            "type": "string",
            "description": "Free-text notes.",
            "nullable": true
          },
          "tankId": {
            "type": "integer",
            "description": "Tank the task is about, if any.",
            "format": "int32",
            "nullable": true
          },
          "assignedUserId": {
            "type": "integer",
            "description": "User the task is assigned to, if any. Listed by `GET /api/v1/users`.",
            "format": "int32",
            "nullable": true
          },
          "includeInCalendar": {
            "type": "boolean",
            "description": "True when the task shows up on the production calendar."
          },
          "completed": {
            "type": "boolean",
            "description": "Read-only. Set by `POST /api/v1/tasks/{id}/complete`."
          },
          "completedOn": {
            "type": "string",
            "description": "Read-only. When the task was completed.",
            "format": "date-time",
            "nullable": true
          },
          "completedByUserId": {
            "type": "integer",
            "description": "Read-only. Who completed it. Taken from the token, never from the body.",
            "format": "int32",
            "nullable": true
          },
          "createdOn": {
            "type": "string",
            "description": "Read-only. When the task was created. Set by the server.",
            "format": "date-time"
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate."
          }
        },
        "additionalProperties": false,
        "description": "A standalone task: something to be done on a date, not attached to a batch."
      },
      "TaskDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "UnpackProductStockDto": {
        "type": "object",
        "properties": {
          "warehouseId": {
            "type": "integer",
            "description": "Warehouse where the cases are, and where the loose containers end up.",
            "format": "int32"
          },
          "caseId": {
            "type": "integer",
            "description": "The case format to disassemble. Listed by `GET /api/v1/cases`.",
            "format": "int32"
          },
          "cases": {
            "type": "integer",
            "description": "How many cases to disassemble.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "Disassembles cases of a product back into loose containers."
      },
      "WarehouseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Warehouse id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "Name. Required on create.",
            "nullable": true
          },
          "code": {
            "maxLength": 15,
            "minLength": 0,
            "type": "string",
            "description": "Your own code for it. Required on create.",
            "nullable": true
          },
          "warehouseTypeId": {
            "type": "integer",
            "description": "What kind of warehouse it is. Listed by `GET /api/v1/warehouse-types`.",
            "format": "int32",
            "nullable": true
          },
          "warehouseTypeName": {
            "type": "string",
            "description": "Read-only. The name of that type, in the language of your token.",
            "nullable": true
          },
          "address": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Street address.",
            "nullable": true
          },
          "city": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Town or city.",
            "nullable": true
          },
          "provinceId": {
            "type": "integer",
            "description": "Province, state or region. Listed by `GET /api/v1/provinces`.",
            "format": "int32",
            "nullable": true
          },
          "provinceName": {
            "type": "string",
            "description": "Read-only. The name of that province, in the language of your token.",
            "nullable": true
          },
          "phone": {
            "maxLength": 250,
            "minLength": 0,
            "type": "string",
            "description": "Phone number.",
            "nullable": true
          },
          "dimensions": {
            "maxLength": 100,
            "minLength": 0,
            "type": "string",
            "description": "Free-text description of its size or layout.",
            "nullable": true
          },
          "logisticsAddress": {
            "maxLength": 500,
            "minLength": 0,
            "type": "string",
            "description": "Address to hand to a courier, when it differs from the postal one.",
            "nullable": true
          },
          "latitude": {
            "type": "number",
            "description": "Latitude. Sending null resets it to 0 — see the remark on the class.",
            "format": "double",
            "nullable": true
          },
          "longitude": {
            "type": "number",
            "description": "Longitude. Sending null resets it to 0 — see the remark on the class.",
            "format": "double",
            "nullable": true
          },
          "main": {
            "type": "boolean",
            "description": "Read-only. True on the warehouse your account treats as its main one."
          },
          "active": {
            "type": "boolean",
            "description": "Read-only. Changed only by /deactivate and /activate."
          }
        },
        "additionalProperties": false,
        "description": "A warehouse: a place where you keep finished product, kegs and containers."
      },
      "WarehouseDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WarehouseDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "WasteCreateRequestDto": {
        "type": "object",
        "properties": {
          "stageId": {
            "type": "integer",
            "description": "Required. Listed by GET /api/v1/production-stages.",
            "format": "int32",
            "nullable": true
          },
          "wasteTypeId": {
            "type": "integer",
            "description": "Required. Listed by GET /api/v1/waste-types.",
            "format": "int32",
            "nullable": true
          },
          "liters": {
            "type": "number",
            "description": "Required. Cannot be greater than the batch's current liters.",
            "format": "double",
            "nullable": true
          },
          "recordedOn": {
            "type": "string",
            "description": "Required, ISO 8601. Cannot be later than today.",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "description": "Free-text notes.",
            "nullable": true
          },
          "finalizeBatch": {
            "type": "boolean",
            "description": "Defaults to false. True finishes the batch (same as the \"finaliza\" checkbox on the\r\nscreen) — meant for when this loss brings the batch down to 0 liters, but the API does\r\nnot enforce that: it is the caller's decision, not derived from the liters."
          }
        },
        "additionalProperties": false,
        "description": "What to record when logging a loss on a batch."
      },
      "WasteDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Waste record id.",
            "format": "int32"
          },
          "batchId": {
            "type": "integer",
            "description": "The batch this loss belongs to.",
            "format": "int32"
          },
          "stageId": {
            "type": "integer",
            "description": "Production stage this loss is attributed to. Listed by GET /api/v1/production-stages.",
            "format": "int32",
            "nullable": true
          },
          "wasteTypeId": {
            "type": "integer",
            "description": "What kind of loss. Listed by GET /api/v1/waste-types.",
            "format": "int32",
            "nullable": true
          },
          "liters": {
            "type": "number",
            "description": "Liters lost.",
            "format": "double"
          },
          "recordedOn": {
            "type": "string",
            "description": "When it was recorded, ISO 8601.",
            "format": "date-time"
          },
          "notes": {
            "type": "string",
            "description": "Free-text notes.",
            "nullable": true
          },
          "tankId": {
            "type": "integer",
            "description": "Read-only. The tank the batch was in when this was recorded, stamped from the batch —\r\nnever part of the request. Listed by GET /api/v1/tanks.",
            "format": "int32",
            "nullable": true
          },
          "barrels": {
            "type": "string",
            "description": "Read-only. Kegs involved, only set for a loss recorded while kegging — free text, not a\r\nlist of keg ids.",
            "nullable": true
          },
          "externalBatchNumber": {
            "type": "string",
            "description": "Read-only. External batch number, only set for a loss recorded while packaging.",
            "nullable": true
          },
          "recordedByUserId": {
            "type": "integer",
            "description": "User that recorded it.",
            "format": "int32",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "Always true today: a waste record is never deactivated."
          }
        },
        "additionalProperties": false,
        "description": "A production loss (waste) recorded on a batch: kettle loss, filtering, packaging…"
      },
      "WasteDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WasteDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "WasteGroupDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Waste group id. Assigned by the server; ignored on create and on update.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Required. Must be unique among your groups.",
            "nullable": true
          },
          "wastePercentage": {
            "type": "number",
            "description": "Required, 0.01 to 100. Must be unique among your groups.",
            "format": "double"
          },
          "productIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "The products in this group. Listed by GET /api/v1/brewable-products. Replaces the entire\r\ncollection when sent — see the remark on the class.",
            "nullable": true
          },
          "productCount": {
            "type": "integer",
            "description": "Read-only. How many products are in the group right now.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A group of your own brewed products that shares one expected waste percentage, used to\r\nproject how many liters a planned brew will actually yield."
      },
      "WasteGroupDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WasteGroupDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      },
      "WithholdingDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Withholding id.",
            "format": "int32"
          },
          "typeId": {
            "type": "integer",
            "description": "Kind of withholding. Allowed values: GET /api/v1/withholding-types.",
            "format": "int32"
          },
          "currencyId": {
            "type": "integer",
            "description": "Currency of `amount`.",
            "format": "int32"
          },
          "amount": {
            "type": "number",
            "description": "Amount withheld.",
            "format": "double"
          },
          "percentage": {
            "type": "number",
            "description": "Percentage the withholding was computed from, when the application recorded one. Purely\r\ninformational: it is never reconciled against `amount` server-side.",
            "format": "double",
            "nullable": true
          },
          "jurisdiction": {
            "type": "string",
            "description": "Tax jurisdiction of the withholding.",
            "nullable": true
          },
          "certificateNumber": {
            "type": "string",
            "description": "Withholding certificate number, when one was recorded.",
            "nullable": true
          },
          "active": {
            "type": "boolean",
            "description": "False once the withholding was reversed — always as a side effect of cancelling the bank\r\nmovement it came from, never on its own."
          },
          "purchaseId": {
            "type": "integer",
            "description": "The purchase this withholding was applied to, when it came from the supplier side and\r\nthat purchase is a regular one (not a keg purchase). Allowed values: GET /api/v1/purchases.",
            "format": "int32",
            "nullable": true
          },
          "orderNumber": {
            "type": "string",
            "description": "Order number this withholding was applied to, when it came from the customer side. Text\r\nonly, not an id: to read the order, look it up in GET /api/v1/orders by date and match its\r\nnumber.",
            "nullable": true
          },
          "kegPurchaseInvoiceNumber": {
            "type": "string",
            "description": "Invoice number of the keg purchase this withholding was applied to, when it came from a\r\nkeg purchase rather than a regular one. Text only: the keg purchase itself\r\n(`CompraBarril`, not `keg-purchase-orders`) is not published in this version.",
            "nullable": true
          },
          "kegPurchaseDeliveryNoteNumber": {
            "type": "string",
            "description": "Delivery note number of that same keg purchase, when there is no invoice number.",
            "nullable": true
          },
          "createdOn": {
            "type": "string",
            "description": "When the withholding was recorded.",
            "format": "date-time"
          }
        },
        "additionalProperties": false,
        "description": "A withholding (retención) applied on a payment to your account or to a supplier."
      },
      "WithholdingDtoPaged": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WithholdingDto"
            },
            "description": "The items in this page.",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "description": "Page number, 1-based.",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "description": "The page size actually applied.",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "description": "Total number of records matching the filter, not the number in this page.",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "A page of results."
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "http",
        "description": "Paste the accessToken returned by POST /api/v1/auth/login",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "security": [
    {
      "Bearer": [ ]
    }
  ]
}