{
  "openapi": "3.1.0",
  "info": {
    "title": "FastAPI",
    "version": "0.1.0"
  },
  "paths": {
    "/hello": {
      "get": {
        "summary": "Hello",
        "operationId": "hello_hello_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/reset/prod": {
      "delete": {
        "tags": [
          "Administration"
        ],
        "summary": "Reset Production And Traceability Data",
        "description": "Truncate all production and traceability collections.\n\nDeletes every document from the traceability collections (Batch, Job,\nWorkOrder, Event, Serial, Issue, etc.) within a single ArangoDB transaction,\nthen re-inserts a clean site Queue document and removes media sub-directories\n(`serial`, `traceability`, `issue`) from the `/media` volume.\n\n**WARNING:** This operation is irreversible. Use only in development or\ncontrolled staging environments.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `admin:operation:reset-prod`",
        "operationId": "reset_production_and_traceability_data_reset_prod_delete",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Transaction or filesystem error during truncation"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/reset/inventory": {
      "delete": {
        "tags": [
          "Administration"
        ],
        "summary": "Reset Warehouse Data",
        "description": "Truncate inventory movement data.\n\nDeletes all records from `movement` and `MovementList` collections, then\nremoves all `is_in_position` edges whose `_from` vertex is a `Product`\ndocument. Position-definition documents (locations, bins) are preserved.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `admin:operation:reset-inventory`",
        "operationId": "reset_warehouse_data_reset_inventory_delete",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error while truncating inventory collections"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/force-delete-work-order/{work_order_key}": {
      "delete": {
        "tags": [
          "Administration"
        ],
        "summary": "Force Delete Work Order Data",
        "description": "Permanently delete a work order and all related traceability data.\n\nCascades through Job, Batch, StepExecutionData, WorkSession, Event,\nbatch_serial, contains, wip and issue_rel records linked to the given\nwork order key. Removes the work order from the site Queue. This is a\nhard delete \u2014 no audit trail is preserved. Use only when a work order\nwas created in error.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `admin:operation:force-delete-work-order`",
        "operationId": "force_delete_work_order_data_force_delete_work_order__work_order_key__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "work_order_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Work Order Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "WorkOrder with the given key does not exist"
          },
          "500": {
            "description": "Transaction error during cascade deletion"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/auth": {
      "post": {
        "tags": [
          "Security"
        ],
        "summary": "Authenticate User",
        "description": "Authenticate a user and issue a bearer token.\n\nValidates the supplied username and password against the `User` collection.\nIf the user has `reset_password=True`, returns a short-lived password-reset\ntoken (`action=reset_password`) instead of a full session token. Otherwise\nissues a 24-hour session token (`action=start_session`) and closes any\npreviously active sessions for the same user.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** *(public \u2014 no auth)*",
        "operationId": "authenticate_user_auth_post",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/Body_authenticate_user_auth_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthAPIResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid credentials \u2014 username/password mismatch or user disabled"
          },
          "500": {
            "description": "Unexpected server error during credential verification"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/user/{user_key}/verify": {
      "post": {
        "tags": [
          "Security"
        ],
        "summary": "Verify User Password",
        "description": "Verify a user's current password.\n\nChecks the supplied plain-text password against the bcrypt hash stored for\n`user_key`. Returns 200 on success; raises 401 on mismatch. Used by the\nfrontend before allowing sensitive operations that require re-confirmation.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `auth:user:verify`",
        "operationId": "verify_user_password_user__user_key__verify_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "user_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Body_verify_user_password_user__user_key__verify_post"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "401": {
            "description": "Password does not match the stored hash for the given user"
          },
          "500": {
            "description": "Unexpected error during password verification"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/whoami": {
      "get": {
        "tags": [
          "Security"
        ],
        "summary": "Get Current User",
        "description": "Return the user key extracted from the current session token.\n\nDecodes the bearer token from the `Authorization` header and returns the\n`consumer_key` (ArangoDB `_key` of the `User` document). Useful for\nfrontend bootstrapping to confirm the session is still valid and to\nretrieve the caller's identity.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `auth:session:whoami`",
        "operationId": "get_current_user_whoami_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "401": {
            "description": "JWT is missing, expired, or otherwise invalid"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/session": {
      "post": {
        "tags": [
          "Security"
        ],
        "summary": "Start User Session",
        "description": "Open a new user session after token issuance.\n\nCalled immediately after `POST /auth` with the same bearer token. Validates\nthat `user_key` matches the token's `consumer_key` and that the token context\nis `USER_SESSION`. Creates a `UserSession` document and updates `User.last_login`\nwithin a single ArangoDB transaction. Returns session metadata including name,\nscope, and preferences for frontend initialisation.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `auth:session:start`",
        "operationId": "start_user_session_session_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Body_start_user_session_session_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "401": {
            "description": "Token consumer key or context does not match expected values; token is revoked"
          },
          "500": {
            "description": "Transaction error while creating UserSession or updating User record"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/session/{session_key}": {
      "delete": {
        "tags": [
          "Security"
        ],
        "summary": "Close User Session",
        "description": "Close an active user session and revoke its token.\n\nLooks up the `UserSession` by `session_key`, validates that the caller owns\nit (token signature match), and calls `auth.close_session`. With `?force=true`\nan admin or production-scoped user can close another user's session. The bearer\ntoken is decoded with `verify_expiration=False` so expired tokens can still\ntrigger a logout.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `auth:session:close`",
        "operationId": "close_user_session_session__session_key__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "session_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Session Key"
            }
          },
          {
            "name": "force",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "default": false,
              "title": "Force"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "401": {
            "description": "Token does not own the session and caller lacks admin/production scope for force-close"
          },
          "500": {
            "description": "Database error while invalidating the session token"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/product/{product_key}/bom": {
      "get": {
        "tags": [
          "Product"
        ],
        "summary": "Get Product Bom",
        "description": "Retrieve the Bill of Materials for a product.\n\nReturns an ordered list of `BomLineRead` objects for `product_key`, each\nincluding component code, description, quantity, phase assignment, and\nconsumption options.\n\n**Emits:** *(direct query \u2014 no event class)*\n\n**Required scope:** `product:bom:read`",
        "operationId": "get_product_bom_product__product_key__bom_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "product_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Product Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Get Product Bom Product  Product Key  Bom Get"
                }
              }
            }
          },
          "500": {
            "description": "Database query error fetching BoM"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/product/{product_key_or_code}/bom": {
      "put": {
        "tags": [
          "Product"
        ],
        "summary": "Update Bom",
        "description": "Replace the Bill of Materials for a product.\n\nPerforms a full replace: the existing BoM is deleted and `new_bom` is\ninserted atomically within a single transaction. Pass `by_code=true` to\nresolve `product_key_or_code` as a product code rather than an ArangoDB key.\n\n- Lines without an explicit `phase_key` are assigned to the product's last\n  phase.\n- After insert, a loop-detection query runs; if circular dependencies are\n  found the transaction is aborted and HTTP 403 is returned with the loop data.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `product:bom:update`",
        "operationId": "update_bom_product__product_key_or_code__bom_put",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "product_key_or_code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Product Key Or Code"
            }
          },
          {
            "name": "by_code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "By Code"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BomLineWriteIn"
                },
                "title": "New Bom"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "401": {
            "description": "Product not found by key"
          },
          "403": {
            "description": "BoM update would create a circular component dependency"
          },
          "422": {
            "description": "Product has no production process \u2014 BoM cannot be assigned"
          },
          "500": {
            "description": "Transaction error during BoM replace"
          }
        }
      }
    },
    "/config": {
      "get": {
        "tags": [
          "Administration"
        ],
        "summary": "Get Config",
        "description": "Return all platform configuration values.\n\nReads every document from the `Config` collection and flattens them into\na single JSON object keyed by `_key`. Simple scalar values (str, int, bool)\nare unwrapped from their `value` wrapper field; dict values are returned as-is.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** *(public \u2014 no auth)*",
        "operationId": "get_config_config_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error while reading Config collection"
          }
        }
      },
      "patch": {
        "tags": [
          "Administration"
        ],
        "summary": "Update Config",
        "description": "Upsert one or more platform configuration entries.\n\nAccepts a flat JSON object where each key maps to a config entry `_key`.\nMissing keys with known defaults are reset to their default values.\nPassing `null` for an unknown key is a no-op. If `allow_independent_reordering_of_job_queues`\nis set to `false`, all operator queues with `independent=true` are\nsynchronously reverted and job queues are reordered.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `admin:config:write`",
        "operationId": "update_config_config_patch",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": true,
                "type": "object",
                "title": "Config"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Transaction error while upserting Config documents"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/config/{key}/file": {
      "put": {
        "tags": [
          "Administration"
        ],
        "summary": "Update Config File",
        "description": "Upload or remove a file-backed configuration entry.\n\nStores the uploaded file at `{media_root}/config/{key}/{filename}` and\nupdates the `Config` document's `value` field with the resulting path.\nIf `file` is omitted, the existing file is deleted and `value` is set to\n`null`. Replaces any previously stored file for the same key.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `admin:config:write`",
        "operationId": "update_config_file_config__key__file_put",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_update_config_file_config__key__file_put"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Filesystem or database error while replacing the config file"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/custom-data": {
      "get": {
        "tags": [
          "Administration"
        ],
        "summary": "List Custom Data",
        "description": "List all custom-data entries, optionally filtered by a search string.\n\nExecutes an AQL query against the `CustomData` collection. When `search`\nis provided, filters by case-insensitive substring match against both the\ndocument `_key` and the `description` field. Results are sorted by `_key`.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `admin:custom-data:read`",
        "operationId": "list_custom_data_custom_data_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Search"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CustomData"
                  },
                  "title": "Response List Custom Data Custom Data Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/custom-data/{key}": {
      "get": {
        "tags": [
          "Administration"
        ],
        "summary": "Get Custom Data",
        "description": "Retrieve a single custom-data entry by key.\n\nLooks up the `CustomData` document with `_key == key`. Returns 404 if\nno document exists for that key.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `admin:custom-data:read`",
        "operationId": "get_custom_data_custom_data__key__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomData"
                }
              }
            }
          },
          "404": {
            "description": "No CustomData document exists for the given key"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Administration"
        ],
        "summary": "Upsert Custom Data",
        "description": "Create or replace a custom-data entry.\n\nValidates `key` format (lowercase alphanumeric + underscore, max 64 chars),\nthen inserts or replaces the `CustomData` document. Existing documents are\nfully replaced (`check_rev=False`). Returns a message indicating whether\nthe entry was created or updated.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `admin:custom-data:write`",
        "operationId": "upsert_custom_data_custom_data__key__put",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomData"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "422": {
            "description": "Key fails format validation (must match `^[a-z][a-z0-9_]*$`, max 64 chars)"
          },
          "500": {
            "description": "Database error during upsert"
          }
        }
      },
      "delete": {
        "tags": [
          "Administration"
        ],
        "summary": "Delete Custom Data",
        "description": "Delete a custom-data entry by key.\n\nReturns 404 if the document does not exist. On success, permanently\nremoves the `CustomData` document from the collection.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `admin:custom-data:write`",
        "operationId": "delete_custom_data_custom_data__key__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "No CustomData document exists for the given key"
          },
          "500": {
            "description": "Database error during deletion"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/files": {
      "post": {
        "tags": [
          "Attachments"
        ],
        "summary": "Upload Files",
        "description": "Upload one or more files and attach them to an entity.\n\nValidates the target entity and subfolder path via `verify_target_data`,\nthen writes each uploaded file to the configured file storage under\n`{bucket}/{object_key}/{subfolder}/`. When `reset_folder=true`, the\ntarget subfolder is cleared before writing. No auth dependency is declared\non the decorator \u2014 access is controlled by the caller's session token\nchecked upstream by middleware.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `attachment:file:upload`",
        "operationId": "upload_files_files_post",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_upload_files_files_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "The target entity (Issue, Product, WorkOrder, etc.) does not exist, or the referenced subfolder/field is invalid"
          },
          "500": {
            "description": "Filesystem error while writing one of the uploaded files"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Attachments"
        ],
        "summary": "Delete Files",
        "description": "Delete one or more named files from an entity's file bucket.\n\nValidates the target entity via `verify_target_data`, then deletes each\nfilename from `{bucket}/{object_key}/{subfolder}/`. Returns 404 for the\nfirst missing file encountered.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `attachment:file:delete`",
        "operationId": "delete_files_files_delete",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Body_delete_files_files_delete"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "The target entity does not exist, or a named file does not exist in the specified bucket/folder"
          },
          "500": {
            "description": "Filesystem error during deletion"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/field": {
      "post": {
        "tags": [
          "Quality"
        ],
        "summary": "Create Field",
        "description": "Create a new custom field definition.\n\nInserts a `CustomField` document after verifying that no existing field\nproduces the same slug (derived by converting the `name` to snake_case).\nThe slug is used as the field identifier in form templates and data exports.\n\nReturns HTTP 409 if the slug already exists.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `quality:form:create`",
        "operationId": "create_field_field_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomField"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "409": {
            "description": "A custom field with the same slug already exists"
          },
          "500": {
            "description": "Database insert or slug-check error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Quality"
        ],
        "summary": "Fetch Field",
        "description": "Fetch custom field definitions, optionally filtered by name or key.\n\nReturns all `CustomField` documents sorted alphabetically by name.\nPass `name` to filter by exact field name, or `key` to fetch a single\nfield by its ArangoDB `_key`. Both filters can be combined.\n\n**Emits:** *(direct query \u2014 no event class)*\n\n**Required scope:** `quality:form:read`",
        "operationId": "fetch_field_field_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Name"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Fetch Field Field Get"
                }
              }
            }
          },
          "500": {
            "description": "Database query error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/field/{field_key}": {
      "put": {
        "tags": [
          "Quality"
        ],
        "summary": "Replace Field Metadata",
        "description": "Replace a custom field definition.\n\nPerforms a full replace of the `CustomField` document identified by\n`field_key`. Validates that the resulting slug does not collide with any\nother existing field (self-collision is allowed). Returns HTTP 409 on\nconflict.\n\nThe payload must include `_key` in `field_data`.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `quality:form:update`",
        "operationId": "replace_field_metadata_field__field_key__put",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "field_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Field Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomField"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "409": {
            "description": "Another field with the same slug already exists"
          },
          "500": {
            "description": "Database update or slug-check error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Quality"
        ],
        "summary": "Delete Field",
        "description": "Delete a custom field and all its associated list values.\n\nRemoves the `CustomField` document and, if the field type is `choice`,\ndeletes all linked `CustomListValue` documents in the same transaction.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `quality:form:update`",
        "operationId": "delete_field_field__field_key__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "field_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Field Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database delete error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/list": {
      "get": {
        "tags": [
          "Quality"
        ],
        "summary": "Fetch Custom List Values",
        "description": "Fetch paginated list values for a choice-type custom field.\n\nReturns up to `limit` `CustomListValue` records for the given `field_key`,\nsorted by `sort_by`. Pass `search` to filter by a substring match across\nboth `value` and `ext_key` (case-insensitive).\n\n**Emits:** *(direct query \u2014 no event class)*\n\n**Required scope:** `quality:form:read`",
        "operationId": "fetch_custom_list_values_list_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "field_key",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Field Key"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100,
              "title": "Limit"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Search"
            }
          },
          {
            "name": "sort_by",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "value",
              "title": "Sort By"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Fetch Custom List Values List Get"
                }
              }
            }
          },
          "500": {
            "description": "Database query error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/list/{field_key}": {
      "post": {
        "tags": [
          "Quality"
        ],
        "summary": "Create Or Update Custom List Values",
        "description": "Bulk upsert list values for a choice-type custom field.\n\nInserts or replaces `CustomListValue` records for `field_key`. When\n`reset=true`, all existing values for the field are deleted before\ninserting `new_values`, performing a full replacement. When `reset=false`,\nsupplied values are upserted (insert-or-replace by `_key`).\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `quality:form:update`",
        "operationId": "create_or_update_custom_list_values_list__field_key__post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "field_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Field Key"
            }
          },
          {
            "name": "reset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Reset"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CustomListValue"
                },
                "title": "New Values"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Database insert/replace error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Quality"
        ],
        "summary": "Delete Custom List Value",
        "description": "Delete specific list values from a choice-type custom field.\n\nRemoves the `CustomListValue` documents whose `_key` is in `value_key`\n(repeated query parameter). Only values belonging to `field_key` are\ntargeted by the URL path; the deletion itself operates on `_key` only.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `quality:form:update`",
        "operationId": "delete_custom_list_value_list__field_key__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "field_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Field Key"
            }
          },
          {
            "name": "value_key",
            "in": "query",
            "required": true,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "title": "Value Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Database delete error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/serial-field": {
      "get": {
        "tags": [
          "Serial"
        ],
        "summary": "Fetch Field",
        "description": "Return the configured serial custom field definitions.\n\nReads the `serial_fields` key from the `Config` collection and returns the\nlist of field definitions used to render extra data entry forms for serial\nnumbers. Returns an empty list if no serial fields have been configured.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `serial:read`",
        "operationId": "fetch_field_serial_field_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {},
                  "type": "array",
                  "title": "Response Fetch Field Serial Field Get"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/serial-batch": {
      "get": {
        "tags": [
          "Serial"
        ],
        "summary": "Get Serial Batch",
        "description": "Return all serials belonging to a production batch.\n\nQueries the `GET_ALL_SERIALS_IN_BATCH` AQL query against the `Serial`\ncollection for the given `batch_key`. When `filter_empty=True`, serials\nwithout a code are excluded from the result.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `serial:read`",
        "operationId": "get_serial_batch_serial_batch_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "batch_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Batch Key"
            }
          },
          {
            "name": "filter_empty",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Filter Empty"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Get Serial Batch Serial Batch Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/component-batch": {
      "get": {
        "tags": [
          "Serial"
        ],
        "summary": "Get Serial Batch",
        "description": "Return all component serials linked to a batch.\n\nQueries the `GET_ALL_COMPONENTS_IN_BATCH` AQL query starting from\n`Batch/<batch_key>` and returns all serials that are linked as components\nvia the `contains` edge collection.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `serial:read`",
        "operationId": "get_serial_batch_component_batch_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "batch_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Batch Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Get Serial Batch Component Batch Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/serial-parents": {
      "get": {
        "tags": [
          "Serial"
        ],
        "summary": "Get Serial Parents",
        "description": "Return the ancestor chain for a serial number.\n\nTraverses the `contains` edge collection upward from `Serial/<serial_key>`\nand returns the list of parent serials in bottom-up order (closest parent\nfirst), then reverses it so the root ancestor is first.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `serial:read`",
        "operationId": "get_serial_parents_serial_parents_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "serial_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Serial Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Get Serial Parents Serial Parents Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/serial-children": {
      "get": {
        "tags": [
          "Serial"
        ],
        "summary": "Get Serial Children",
        "description": "Return the direct children of a serial number.\n\nTraverses one level down the `contains` edge collection from\n`Serial/<serial_key>` and returns all immediate child serials.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `serial:read`",
        "operationId": "get_serial_children_serial_children_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "serial_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Serial Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Get Serial Children Serial Children Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/serial-hierarchy": {
      "get": {
        "tags": [
          "Serial"
        ],
        "summary": "Get Serial Hierarchy",
        "description": "Get the serial hierarchy, from the root ancestor (the one with no parent) to all descendants of the given serial.\n\nResolves the root ancestor of `serial_key` using `GET_SERIAL_ROOT_ANCESTOR`,\nthen builds a full recursive `SerialTreeNode` tree by walking the `contains`\nedge collection downward. Returns a list containing the single root node with\nall descendants nested under `children`.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `serial:read`",
        "operationId": "get_serial_hierarchy_serial_hierarchy_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "serial_key",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Serial Key"
            }
          },
          {
            "name": "include_expected_components",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true,
              "title": "Include Expected Components"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SerialTreeNode"
                  },
                  "title": "Response Get Serial Hierarchy Serial Hierarchy Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/wip-serial": {
      "get": {
        "tags": [
          "Serial"
        ],
        "summary": "Get Serial Wip",
        "description": "Return WIP serials available for a work order, job, or phase.\n\nQueries `GET_AVAILABLE_WIP_SERIALS` to find serials currently in WIP status\nthat can be assigned to the given work order, job, or phase combination.\nUsed by the production UI to populate the serial selector when starting a batch.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `serial:read`",
        "operationId": "get_serial_wip_wip_serial_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "wo_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Wo Key"
            }
          },
          {
            "name": "job_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Job Key"
            }
          },
          {
            "name": "phase_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Phase Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SerialSelection"
                  },
                  "title": "Response Get Serial Wip Wip Serial Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/serial-selection": {
      "get": {
        "tags": [
          "Serial"
        ],
        "summary": "Get Serial Selection",
        "description": "Return a filtered list of serials for use in UI selection widgets.\n\nExecutes `GET_ALL_SERIALS` with the given filters and returns serial objects\nsuitable for display in dropdowns and search-as-you-type widgets. Supports\nfiltering by work order, product, batch, inventory state, and release status.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `serial:read`",
        "operationId": "get_serial_selection_serial_selection_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Search"
            }
          },
          {
            "name": "wo_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Wo Key"
            }
          },
          {
            "name": "product_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Product Key"
            }
          },
          {
            "name": "batch_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Batch Key"
            }
          },
          {
            "name": "free_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Free Only"
            }
          },
          {
            "name": "inventory_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Inventory Only"
            }
          },
          {
            "name": "inventory_in_position_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Inventory In Position Key"
            }
          },
          {
            "name": "include_unreleased",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Include Unreleased"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Get Serial Selection Serial Selection Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/serial/{serial_key}": {
      "get": {
        "tags": [
          "Serial"
        ],
        "summary": "Get Serial From Key",
        "description": "Fetch a serial document by its primary key.\n\nRetrieves the raw `Serial` document from ArangoDB by `serial_key`. Returns\nthe full document including all custom data fields and lifecycle timestamps.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `serial:read`",
        "operationId": "get_serial_from_key_serial__serial_key__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "serial_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Serial Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Get Serial From Key Serial  Serial Key  Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/serial-code": {
      "get": {
        "tags": [
          "Serial"
        ],
        "summary": "Get Serial From Code",
        "description": "Look up serials by code and optional product filter.\n\nExecutes `GET_SERIALS_FOR_CODE` to find all `Serial` documents whose `code`\nmatches `serial_code`, optionally scoped to a specific product. Serial codes\nare normalized to uppercase before the query.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `serial:read`",
        "operationId": "get_serial_from_code_serial_code_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "serial_code",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Serial Code"
            }
          },
          {
            "name": "product_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Product Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Get Serial From Code Serial Code Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/serial-code/verify-free": {
      "get": {
        "tags": [
          "Serial"
        ],
        "summary": "Verify Serial Code Free",
        "description": "Check whether a serial code is available for use.\n\nExecutes `GET_SERIALS_FOR_SERIAL_CODE` and returns `True` if no other\n`Serial` document already uses the given `serial_code` for the given product\n(excluding `serial_key` itself, used for edit scenarios).\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `serial:read`",
        "operationId": "verify_serial_code_free_serial_code_verify_free_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "serial_code",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Serial Code"
            }
          },
          {
            "name": "product_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Product Key"
            }
          },
          {
            "name": "serial_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Serial Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean",
                  "title": "Response Verify Serial Code Free Serial Code Verify Free Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/serial": {
      "get": {
        "tags": [
          "Serial"
        ],
        "summary": "Search Serials",
        "description": "Search serials with rich filtering and sorting.\n\nExecutes the `FIND_SERIALS` AQL query with the full set of filter parameters.\nWildcard search fields (`serial_search`, `product_code_search`, etc.) accept\nshell-style wildcards (`*`, `?`) which are converted to AQL regex before\nexecution. `advanced_filters` accepts a base64-encoded JSON array of custom\nfield filters.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `serial:read`",
        "operationId": "search_serials_serial_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "serial_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "title": "Serial Key"
            }
          },
          {
            "name": "serial_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Serial Search"
            }
          },
          {
            "name": "is_contained_in",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Is Contained In"
            }
          },
          {
            "name": "contains",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Contains"
            }
          },
          {
            "name": "time_created_from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Time Created From"
            }
          },
          {
            "name": "time_created_to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Time Created To"
            }
          },
          {
            "name": "created_by",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "title": "Created By"
            }
          },
          {
            "name": "advanced_filters",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "title": "Advanced Filters"
            }
          },
          {
            "name": "product_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "title": "Product Key"
            }
          },
          {
            "name": "product_code_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Product Code Search"
            }
          },
          {
            "name": "work_order_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Work Order Search"
            }
          },
          {
            "name": "project_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Project Search"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "default": 200,
              "title": "Limit"
            }
          },
          {
            "name": "include_deleted",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Include Deleted"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Offset"
            }
          },
          {
            "name": "filter_unreleased",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Filter Unreleased"
            }
          },
          {
            "name": "time_released_from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Time Released From"
            }
          },
          {
            "name": "time_released_to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Time Released To"
            }
          },
          {
            "name": "sort_by",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": "created",
              "title": "Sort By"
            }
          },
          {
            "name": "sorting_order",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": "desc",
              "title": "Sorting Order"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Search Serials Serial Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/serial/{serial_key}/dhr": {
      "get": {
        "tags": [
          "Serial"
        ],
        "summary": "Get Device History Record",
        "description": "Generate a device history record for a serial.\n\nRenders a PDF Device History Record (DHR) for the serial identified by\n`serial_key` using WeasyPrint. When `include_children=True`, DHRs for all\ncomplex child serials (those with step data or sub-children) are appended in\norder of product code then serial code. Returns the combined PDF as a binary\ndownload attachment.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `serial:read`",
        "operationId": "get_device_history_record_serial__serial_key__dhr_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "serial_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Serial Key"
            }
          },
          {
            "name": "include_attachments",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Include Attachments"
            }
          },
          {
            "name": "include_children",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Include Children"
            }
          },
          {
            "name": "include_step_data",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Include Step Data"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Serial not found"
          },
          "500": {
            "description": "PDF generation error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/media/create": {
      "post": {
        "tags": [
          "Attachments"
        ],
        "summary": "Create Media",
        "description": "Upload a new media file and create its `Media` record.\n\nGenerates a UUID key, writes the file to `{media_root}/{key}` on disk,\nand inserts a `Media` document into the `Media` collection. The returned\n`detail` contains the new media document. The media record is initially\nunconnected \u2014 link it to an entity via the `media_connection` edge\ncollection after creation.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `attachment:media:upload`",
        "operationId": "create_media_media_create_post",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_create_media_media_create_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "422": {
            "description": "Uploaded file fails Media model validation (e.g. missing filename)"
          },
          "500": {
            "description": "Filesystem error while writing the media file"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/media/{media_key}": {
      "patch": {
        "tags": [
          "Attachments"
        ],
        "summary": "Update Media",
        "description": "Replace the file content for an existing media record.\n\nLooks up the `Media` document by `media_key`, overwrites the file at\n`{media_root}/{media_key}` with the new upload, and updates the `Media`\ndocument fields (name, size, content_type). Returns 404 if no media\nrecord exists for the given key.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `attachment:media:upload`",
        "operationId": "update_media_media__media_key__patch",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "media_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Media Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_update_media_media__media_key__patch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "No Media document exists for the given key"
          },
          "422": {
            "description": "Uploaded file fails Media model validation"
          },
          "500": {
            "description": "Filesystem error while replacing the media file"
          }
        }
      },
      "delete": {
        "tags": [
          "Attachments"
        ],
        "summary": "Delete Media",
        "description": "Delete a media record and its file from disk.\n\nReturns 404 if the media record does not exist. Returns 422 if the media\nis still referenced by one or more `media_connection` edges \u2014 all connections\nmust be removed before the media can be deleted. On success, removes both\nthe `Media` document and the file from the filesystem.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `attachment:media:delete`",
        "operationId": "delete_media_media__media_key__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "media_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Media Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "No Media document exists for the given key"
          },
          "422": {
            "description": "Media still has active connections to other entities \u2014 remove connections first"
          },
          "500": {
            "description": "Unexpected error during media deletion"
          }
        }
      },
      "get": {
        "tags": [
          "Attachments"
        ],
        "summary": "Get Media",
        "description": "Serve a media file as a direct file download.\n\nLooks up the `Media` document by `media_key` to retrieve the original\nfilename and content type, then streams the file from\n`{media_root}/{media_key}` using FastAPI's `FileResponse`. The\n`Content-Disposition` header will include the original filename.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `attachment:media:read`",
        "operationId": "get_media_media__media_key__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "media_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Media Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response"
          },
          "404": {
            "description": "No Media document exists for the given key"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/department": {
      "get": {
        "tags": [
          "Organization"
        ],
        "summary": "Get Department List",
        "description": "Return the list of all departments.\n\nFetches every document from the `Department` collection and returns them\nwrapped in an `APIResponse`. No filtering is applied; results include\nall departments regardless of active status.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `org:department:read`",
        "operationId": "get_department_list_department_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api-token": {
      "get": {
        "tags": [
          "Organization"
        ],
        "summary": "Get Api Token",
        "description": "Issue a long-lived API token for the calling user.\n\nCreates a new JWT with context `API` scoped to the caller's permissions,\nstores the token signature in the `Token` collection, and returns the\nsigned token in an `AuthAPIResponse`. The token's expiry is set to\n`token_expiration`. Useful for server-to-server integrations and automation\nscripts that cannot perform interactive login.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `org:api-token:create`",
        "operationId": "get_api_token_api_token_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "token_description",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Token Description"
            }
          },
          {
            "name": "token_expiration",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "title": "Token Expiration"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthAPIResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing session token"
          },
          "500": {
            "description": "Unexpected error during token issuance or storage"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api-token/{token_key}": {
      "delete": {
        "tags": [
          "Organization"
        ],
        "summary": "Revoke Token",
        "description": "Revoke an API token by key.\n\nMarks the `Token` document identified by `token_key` as revoked so that\nsubsequent requests bearing that JWT are rejected. The token document\nis not deleted \u2014 the revocation state is persisted for audit purposes.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `org:api-token:revoke`",
        "operationId": "revoke_token_api_token__token_key__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "token_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Token Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Error while revoking the token record"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/user": {
      "get": {
        "tags": [
          "Organization"
        ],
        "summary": "Get User List",
        "description": "Return a list of users, optionally filtered to active accounts.\n\nExecutes `Queries.GET_USER_LIST` with the `active_only` flag. Each result\nis a `UserListItem` that includes department details and login state. Pass\n`active_only=false` to include archived/disabled accounts.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `org:user:read`",
        "operationId": "get_user_list_user_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "active_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true,
              "title": "Active Only"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Organization"
        ],
        "summary": "Create User",
        "description": "Create a new platform user with a temporary password.\n\nValidates that the `username` is not already taken, generates a random\n8-character hex temporary password, hashes it, and inserts the `User`\ndocument with `reset_password=True`. The plain-text temporary password\nis returned in `detail.temp_psw` \u2014 it is not stored. The user must\nchange it on first login.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `org:user:create`",
        "operationId": "create_user_user_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserNew"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "409": {
            "description": "A user with the provided username already exists"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/user/{user_key}": {
      "patch": {
        "tags": [
          "Organization"
        ],
        "summary": "Update User",
        "description": "Partially update a user document.\n\nAccepts a flat JSON object. Only keys that exist in the `User` model\nschema are applied; any unrecognised field causes a 422 rejection. The\nupdate is performed as a direct collection update (no transaction).\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `org:user:write`",
        "operationId": "update_user_user__user_key__patch",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "user_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "title": "Update Data"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "422": {
            "description": "Request body contains a field not present in the User model"
          },
          "500": {
            "description": "Database error during user update"
          }
        }
      },
      "delete": {
        "tags": [
          "Organization"
        ],
        "summary": "Archive User",
        "description": "Soft-delete (archive) a user account.\n\nSets `trash=True` on the `User` document identified by `user_key`. The\naccount remains in the database for audit and traceability but is excluded\nfrom active user lists. Does not revoke any outstanding tokens.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `org:user:delete`",
        "operationId": "archive_user_user__user_key__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "user_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error while archiving the user record"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/user/{user_key}/image": {
      "put": {
        "tags": [
          "Organization"
        ],
        "summary": "Update User Image",
        "description": "Upload or replace a user's profile image.\n\nReads the existing `User` document to derive a filename\n(`{name}{surname}.jpg` in lowercase), then writes the image to the\nconfigured file storage path via `FileHandler.user_image`. Replaces any\npreviously stored image for the same user.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `org:user:write`",
        "operationId": "update_user_image_user__user_key__image_put",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "user_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_update_user_image_user__user_key__image_put"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Filesystem error while saving the uploaded image"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/user/{user_key}/password": {
      "delete": {
        "tags": [
          "Organization"
        ],
        "summary": "Delete User Password",
        "description": "Reset a user's password to a new random temporary value.\n\nGenerates a new random 8-character hex password, hashes it, updates the\n`User` document with `reset_password=True`, and returns the plain-text\ntemporary password in `detail.temp_psw`. The user must change it on next\nlogin. Used by admins to unlock accounts when users forget their password.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `org:user:write`",
        "operationId": "delete_user_password_user__user_key__password_delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "user_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error during password hash replacement"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Organization"
        ],
        "summary": "Reset User Password",
        "description": "Set a new password for the calling user (post-reset flow).\n\nValidates that `user_key` matches the JWT's `consumer_key` \u2014 users can\nonly reset their own password via this endpoint. Hashes `new_password`\nand clears the `reset_password` flag. Intended to be called after a\nforced password reset triggered by `POST /auth` returning `action=reset_password`.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `auth:password:reset`",
        "operationId": "reset_user_password_user__user_key__password_put",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "user_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Body_reset_user_password_user__user_key__password_put"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "401": {
            "description": "Token consumer key does not match the user_key path parameter"
          },
          "500": {
            "description": "Database error during password hash update"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/user/api-tokens": {
      "get": {
        "tags": [
          "Organization"
        ],
        "summary": "Get User Api Tokens",
        "description": "Return all non-revoked API tokens belonging to the calling user.\n\nQueries the `Token` collection filtered by `issued_to` (the caller's User\ndocument ID), `revoked=False`, and `context=API`. Returns a list of\n`TokenRecord` objects. SSE tickets and session tokens are excluded.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `org:api-token:read`",
        "operationId": "get_user_api_tokens_user_api_tokens_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TokenRecord"
                  },
                  "type": "array",
                  "title": "Response Get User Api Tokens User Api Tokens Get"
                }
              }
            }
          },
          "401": {
            "description": "Token consumer key validation failed"
          },
          "500": {
            "description": "Database error while fetching token records"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/print-template": {
      "get": {
        "tags": [
          "Quality",
          "Traceability"
        ],
        "summary": "Find Print Templates",
        "description": "List print templates, optionally scoped to a specific entity context.\n\nWhen called without parameters, returns all `PrintTemplate` documents with\ntheir name, description, and `entities` count (number of `can_use_print_template`\nedges pointing to each template), sorted by name.\n\nWhen `context='template'`, returns the matching template by `context_key`.\n\nWhen `context` is any other entity type (`product`, `phase`, `step`,\n`issue_type`, `task_type`, `position`), returns only templates assigned to\nthe entity identified by `context_key` via `can_use_print_template` edges.\n\nNote: full template `basePdf` and `schemas` data are not included in list\nresponses \u2014 use `GET /print-template/{template_key}` for full details.\n\n**Emits:** *(direct query \u2014 no event class)*\n\n**Required scope:** `quality:print-template:read`",
        "operationId": "find_print_templates_print_template_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "context",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/TemplateAssignmentContext"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Context"
            }
          },
          {
            "name": "context_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Context Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Find Print Templates Print Template Get"
                }
              }
            }
          },
          "500": {
            "description": "Database query error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Quality",
          "Traceability"
        ],
        "summary": "Create Print Template",
        "description": "Create a new print template.\n\nInserts a `PrintTemplate` document containing the pdfme template definition\n(basePdf, schemas, sampledata). Returns the new template's `_key` in the\nresponse detail.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `quality:print-template:create`",
        "operationId": "create_print_template_print_template_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrintTemplateRecord-Input"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database insert error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Quality",
          "Traceability"
        ],
        "summary": "Update Print Template",
        "description": "Replace a print template's definition.\n\nPerforms a full document update of the `PrintTemplate` identified by\n`template_data._key`. All fields are replaced with the supplied values.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `quality:print-template:create`",
        "operationId": "update_print_template_print_template_put",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrintTemplateRecord-Input"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database update error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/print-template/{template_key}": {
      "get": {
        "tags": [
          "Quality",
          "Traceability"
        ],
        "summary": "Get Print Template Details",
        "description": "Retrieve full details for a single print template, including basePdf and schemas.\n\nReturns the `PrintTemplate` document preprocessed for client use\n(e.g. base64 encoding of embedded PDF data). Use this endpoint when the\ntemplate editor or print renderer needs the complete template definition.\n\n**Emits:** *(direct query \u2014 no event class)*\n\n**Required scope:** `quality:print-template:read`",
        "operationId": "get_print_template_details_print_template__template_key__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "template_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Template Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Get Print Template Details Print Template  Template Key  Get"
                }
              }
            }
          },
          "404": {
            "description": "Print template not found"
          },
          "500": {
            "description": "Template preprocessing error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Quality",
          "Traceability"
        ],
        "summary": "Delete Print Template",
        "description": "Delete a print template and all its entity assignment edges.\n\nRemoves the `PrintTemplate` document and all `can_use_print_template` edges\nthat reference it, within a single transaction.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `quality:print-template:create`",
        "operationId": "delete_print_template_print_template__template_key__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "template_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Template Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database delete or edge cleanup error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/update-template-assignments": {
      "post": {
        "tags": [
          "Quality",
          "Traceability"
        ],
        "summary": "Update Template Assignments",
        "description": "Batch add or remove print template assignments to/from entities.\n\nApplies a list of `TemplateAssignmentUpdate` operations atomically:\n- `type='add'`: inserts a `can_use_print_template` edge from the entity to the template.\n- `type='remove'`: deletes the matching edge.\n\nUsed by the template assignment UI to wire templates to products, phases,\nsteps, issue types, task types, or positions in a single round-trip.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `quality:print-template:create`",
        "operationId": "update_template_assignments_update_template_assignments_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "items": {
                  "$ref": "#/components/schemas/TemplateAssignmentUpdate"
                },
                "type": "array",
                "title": "Updates"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Transaction error updating assignment edges"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/print-job": {
      "post": {
        "tags": [
          "Quality",
          "Traceability"
        ],
        "summary": "Create Print Job",
        "description": "Dispatch a print job to a printer via NATS request/reply.\n\nPublishes a print job payload to `progress.print.jobs.{printer_key}` and\nwaits for a response from the print service worker. The timeout scales with\n`job.copies` to accommodate multi-copy jobs.\n\nReturns a result dict with `ok: true` on success. On failure, `ok` is false\nand `error` contains one of: `no_service`, `timeout`, or `internal`.\n\nOn successful print, publishes a `PRINT_JOB_COMPLETED` notification on the\n`production` NATS subject.\n\n**Emits:** *(NATS publish \u2014 `progress.print.jobs.{printer_key}`)*\n\n**Required scope:** `quality:print-template:read`",
        "operationId": "create_print_job_print_job_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrintJobRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Print job result \u2014 check 'ok' field; may be false if the print service is unavailable or timed out",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object",
                  "title": "Response Create Print Job Print Job Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/operation": {
      "get": {
        "tags": [
          "Process"
        ],
        "summary": "Get Operation List",
        "description": "List all operation templates with enriched media and print-template data.\n\nReturns every `Operation` document from the database, enriched with:\n- Media files attached to each default phase step.\n- Print template records resolved for each step.\n- A `used_for` list of product codes that reference this operation.\n\nResults are sorted alphabetically by operation name.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `process:template:read`",
        "operationId": "get_operation_list_operation_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {},
                  "type": "array",
                  "title": "Response Get Operation List Operation Get"
                }
              }
            }
          },
          "500": {
            "description": "Database or enrichment error"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "Process"
        ],
        "summary": "Create Operation",
        "description": "Create a new operation template.\n\nInserts an `Operation` document into the database, pre-populating its\n`default_phase_parameters` from the `default_operation_parameters` system\nconfig if one exists.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `process:template:create`",
        "operationId": "create_operation_operation_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Operation"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Could not persist operation to database"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/operation/{operation_key}": {
      "patch": {
        "tags": [
          "Process"
        ],
        "summary": "Update Operation",
        "description": "Partially update an operation template, reconciling step media connections.\n\nDiffs the incoming `default_phase_steps[].media` lists against the existing\nones and updates `media_connection` edges accordingly:\n- New media keys are inserted as edges from the operation to each `Media` doc.\n- Removed media keys are disconnected; orphaned `Media` documents (no remaining\n  connections) are deleted from disk and the database.\n\nAll mutations run inside a single ArangoDB transaction.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `process:template:update`",
        "operationId": "update_operation_operation__operation_key__patch",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "operation_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Operation Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "title": "Operation Update"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Operation not found"
          },
          "500": {
            "description": "Database update or media management error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/operation/{op_key}": {
      "delete": {
        "tags": [
          "Process"
        ],
        "summary": "Delete Operation",
        "description": "Delete an operation template if it is not referenced by any product.\n\nChecks whether any product currently uses this operation before deletion.\nReturns HTTP 403 with the list of product codes if the operation is in use,\npreventing orphaned product process definitions.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `process:template:update`",
        "operationId": "delete_operation_operation__op_key__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "op_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Op Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "403": {
            "description": "Operation is in use by one or more products"
          },
          "500": {
            "description": "Database error during product-usage check"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/operation/{operation_key}/copy": {
      "post": {
        "tags": [
          "Process"
        ],
        "summary": "Copy Operation To Phases",
        "description": "Copy an operation's default steps to all matching phases across target products.\n\nFinds every `Phase` whose `operation_key` matches `operation_key` and whose\n`product_key` is in `target_product_keys`, then replaces that phase's step\nsequence with fresh copies of the operation's `default_phase_steps`:\n- Step records are duplicated with new UUIDs for `form_fields`.\n- Media files are physically copied to the new step's media folder.\n- `can_use_print_template` edges are re-created for each new step.\n\nAll mutations run inside a single ArangoDB transaction.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `process:template:update`",
        "operationId": "copy_operation_to_phases_operation__operation_key__copy_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "operation_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Operation Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Body_copy_operation_to_phases_operation__operation_key__copy_post"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Operation not found"
          },
          "500": {
            "description": "Transaction error copying steps or media to phases"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/product/{product_key}/process/copy": {
      "post": {
        "tags": [
          "Process"
        ],
        "summary": "Copy Process To Products",
        "description": "Copy the full production process of a product to one or more target products.\n\nReads the complete process (phases + steps) of `product_key` and replicates\nit onto each product in `target_product_keys`, replacing their existing\nprocess. The source product must not appear in the target list.\n\nAll mutations run inside a single ArangoDB transaction.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `process:template:update`",
        "operationId": "copy_process_to_products_product__product_key__process_copy_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "product_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Product Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Body_copy_process_to_products_product__product_key__process_copy_post"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "400": {
            "description": "Source product is included in the target list"
          },
          "500": {
            "description": "Transaction error during process copy"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/product/{product_key}/counter/copy": {
      "post": {
        "tags": [
          "Process"
        ],
        "summary": "Copy Process To Products",
        "description": "Copy the serial counter configuration from one product to target products.\n\nReads the `counter_key` of `product_key` and writes it onto each product in\n`target_product_keys`, making them share the same counter sequence. The source\nproduct must not appear in the target list.\n\nAll mutations run inside a single ArangoDB transaction.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `process:template:update`",
        "operationId": "copy_process_to_products_product__product_key__counter_copy_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "product_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Product Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Body_copy_process_to_products_product__product_key__counter_copy_post"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "400": {
            "description": "Source product is included in the target list"
          },
          "500": {
            "description": "Transaction error during counter copy"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/step/{step_key}/media": {
      "get": {
        "tags": [
          "Process"
        ],
        "summary": "Get Step Media",
        "description": "List all media files attached to a process step.\n\nReturns the media records associated with `step_key` by scanning the step\nmedia folder on disk.\n\n**Emits:** *(direct query \u2014 no event class)*\n\n**Required scope:** `process:template:read`",
        "operationId": "get_step_media_step__step_key__media_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "step_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Step Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Get Step Media Step  Step Key  Media Get"
                }
              }
            }
          },
          "500": {
            "description": "Media search error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Process"
        ],
        "summary": "Save Step Media",
        "description": "Upload a media file and attach it to a process step.\n\nSaves the uploaded file to the step's media folder on disk and returns the\nstored filename. The file is associated with `step_key` via the folder\nhierarchy used by `search_step_media`.\n\n**Emits:** *(direct file write \u2014 no event class)*\n\n**Required scope:** `process:template:update`",
        "operationId": "save_step_media_step__step_key__media_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "step_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Step Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_save_step_media_step__step_key__media_post"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string",
                  "title": "Response Save Step Media Step  Step Key  Media Post"
                }
              }
            }
          },
          "400": {
            "description": "File write error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/product/{product_key}/process": {
      "get": {
        "tags": [
          "Process"
        ],
        "summary": "Get Production Process",
        "description": "Retrieve the full production process definition for a product.\n\nReturns an ordered list of `PhaseData` objects (phases with their embedded\nsteps) that constitute the production process for `product_key`. Used by the\nprocess editor and order creation flows.\n\n**Emits:** *(direct query \u2014 no event class)*\n\n**Required scope:** `process:template:read`",
        "operationId": "get_production_process_product__product_key__process_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "product_key",
            "in": "path",
            "required": true,
            "schema": {
              "title": "Product Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Get Production Process Product  Product Key  Process Get"
                }
              }
            }
          },
          "500": {
            "description": "Database fetch or validation error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Process"
        ],
        "summary": "Update Process",
        "description": "Replace the production process definition for a product.\n\nAccepts a full ordered list of `PhaseData` objects and performs an upsert\nof phases and steps within a single ArangoDB transaction:\n- New phases/steps are inserted; existing ones are replaced by `_key`.\n- Removed steps are soft-deleted via a `trashed` timestamp (TTL index picks\n  them up later).\n- Removed phases are checked for BoM components before soft-deletion; a phase\n  with active BoM lines returns HTTP 409.\n- `requires` edges for new `ProductPhase` and `PhaseOperation` relationships\n  are inserted.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `process:phase:configure`",
        "operationId": "update_process_product__product_key__process_put",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "product_key",
            "in": "path",
            "required": true,
            "schema": {
              "title": "Product Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PhaseData-Input"
                },
                "title": "Process"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PhaseData-Output"
                  },
                  "title": "Response Update Process Product  Product Key  Process Put"
                }
              }
            }
          },
          "409": {
            "description": "A phase being removed still has BoM components attached"
          },
          "500": {
            "description": "Transaction error during process update"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/phase": {
      "get": {
        "tags": [
          "Process"
        ],
        "summary": "Get Phase Data",
        "description": "Fetch raw phase records by key list.\n\nAccepts a repeated `phase_key` query parameter and returns the corresponding\n`PhaseRecord` documents from the database. Used by the UI when it needs\nlightweight phase metadata without the full process tree.\n\n**Emits:** *(direct query \u2014 no event class)*\n\n**Required scope:** `process:template:read`",
        "operationId": "get_phase_data_phase_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "phase_key",
            "in": "query",
            "required": true,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "title": "Phase Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Get Phase Data Phase Get"
                }
              }
            }
          },
          "404": {
            "description": "One or more phase keys not found"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/procedure/{phase_key}": {
      "get": {
        "tags": [
          "Process"
        ],
        "summary": "Get Phase Procedure",
        "description": "Retrieve all steps for a phase, including resolved media file metadata.\n\nReturns an ordered list of `StepWithMediaInfo` objects for the given phase,\nwith each step's `media` list populated by scanning the step media folder\non disk.\n\n**Emits:** *(direct query \u2014 no event class)*\n\n**Required scope:** `process:template:read`",
        "operationId": "get_phase_procedure_procedure__phase_key__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "phase_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Phase Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Get Phase Procedure Procedure  Phase Key  Get"
                }
              }
            }
          },
          "500": {
            "description": "Database query or media resolution error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/step/{step_key}/media/{filename}": {
      "delete": {
        "tags": [
          "Process"
        ],
        "summary": "Delete Step Media",
        "description": "Delete a media file from a process step's media folder.\n\nRemoves the file named `filename` from the disk folder associated with\n`step_key`. Returns no body on success.\n\n**Emits:** *(direct file delete \u2014 no event class)*\n\n**Required scope:** `process:template:update`",
        "operationId": "delete_step_media_step__step_key__media__filename__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "step_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Step Key"
            }
          },
          {
            "name": "filename",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Filename"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "description": "File deletion error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/product": {
      "get": {
        "tags": [
          "Product"
        ],
        "summary": "Get Product List",
        "description": "List products with optional filtering and search.\n\nAccepts `ProductSearchParams` as query parameters. When `details=false`\n(default), returns lightweight `ProductBaseData` objects; when `details=true`,\nreturns full `ProductDetails` including cost, process phases, and metadata.\n\nSupports full-text search, tag inclusion/exclusion filters, traceability\nfiltering, and pagination via `limit`/`offset`.\n\n**Emits:** *(direct query \u2014 no event class)*\n\n**Required scope:** `product:catalogue:read`",
        "operationId": "get_product_list_product_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "search_string",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Wildcard search string matched against product code (and description when search_description=true).",
              "examples": [
                "PROD-A-*"
              ],
              "title": "Search String"
            },
            "description": "Wildcard search string matched against product code (and description when search_description=true)."
          },
          {
            "name": "search_description",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "Extend the search_string match to the product description field.",
              "examples": [
                false
              ],
              "default": false,
              "title": "Search Description"
            },
            "description": "Extend the search_string match to the product description field."
          },
          {
            "name": "tag_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter products that have this tag _key attached.",
              "examples": [
                "tag-001"
              ],
              "title": "Tag Key"
            },
            "description": "Filter products that have this tag _key attached."
          },
          {
            "name": "include_text",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Only return products whose code contains this substring.",
              "examples": [
                "BRACKET"
              ],
              "title": "Include Text"
            },
            "description": "Only return products whose code contains this substring."
          },
          {
            "name": "exclude_text",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Exclude products whose code contains this substring.",
              "examples": [
                "OBSOLETE"
              ],
              "title": "Exclude Text"
            },
            "description": "Exclude products whose code contains this substring."
          },
          {
            "name": "include_tags",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "description": "List of tag _keys; only products having these tags are returned.",
              "examples": [
                [
                  "tag-001",
                  "tag-002"
                ]
              ],
              "title": "Include Tags"
            },
            "description": "List of tag _keys; only products having these tags are returned."
          },
          {
            "name": "exclude_tags",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "description": "List of tag _keys; products having any/all of these tags are excluded.",
              "examples": [
                [
                  "tag-archived"
                ]
              ],
              "title": "Exclude Tags"
            },
            "description": "List of tag _keys; products having any/all of these tags are excluded."
          },
          {
            "name": "include_tags_operator",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "ALL",
                "ANY"
              ],
              "type": "string",
              "description": "Whether all or any of include_tags must match.",
              "examples": [
                "ALL"
              ],
              "default": "ALL",
              "title": "Include Tags Operator"
            },
            "description": "Whether all or any of include_tags must match."
          },
          {
            "name": "exclude_tags_operator",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "ALL",
                "ANY"
              ],
              "type": "string",
              "description": "Whether all or any of exclude_tags must match to trigger exclusion.",
              "examples": [
                "ANY"
              ],
              "default": "ANY",
              "title": "Exclude Tags Operator"
            },
            "description": "Whether all or any of exclude_tags must match to trigger exclusion."
          },
          {
            "name": "has_operation_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter products whose process includes a phase with this operation _key.",
              "examples": [
                "op-001"
              ],
              "title": "Has Operation Key"
            },
            "description": "Filter products whose process includes a phase with this operation _key."
          },
          {
            "name": "active_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "When true, only active (non-trashed) products are returned.",
              "examples": [
                true
              ],
              "default": true,
              "title": "Active Only"
            },
            "description": "When true, only active (non-trashed) products are returned."
          },
          {
            "name": "traceability_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "When true, only products with a non-null traceability_level are returned.",
              "examples": [
                false
              ],
              "default": false,
              "title": "Traceability Only"
            },
            "description": "When true, only products with a non-null traceability_level are returned."
          },
          {
            "name": "details",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "Return full ProductDetails instead of lightweight ProductBaseData.",
              "examples": [
                false
              ],
              "default": false,
              "title": "Details"
            },
            "description": "Return full ProductDetails instead of lightweight ProductBaseData."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Maximum number of results to return; null returns all matching products.",
              "examples": [
                100
              ],
              "title": "Limit"
            },
            "description": "Maximum number of results to return; null returns all matching products."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Number of results to skip for pagination.",
              "examples": [
                0
              ],
              "default": 0,
              "title": "Offset"
            },
            "description": "Number of results to skip for pagination."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Get Product List Product Get"
                }
              }
            }
          },
          "500": {
            "description": "Database query error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Product"
        ],
        "summary": "Create Product",
        "description": "Create a new product in the catalogue.\n\nAccepts multipart form data. Validates that no active product already exists\nwith the same `code`. If an image is provided it is written to the product\nmedia folder as `image.jpg` inside a transaction.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `product:catalogue:create`",
        "operationId": "create_product_product_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "serial_code_on_creation",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Serial Code On Creation"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_create_product_product_post"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid form data or duplicate product code"
          },
          "500": {
            "description": "Database write or image save error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/product/copy": {
      "post": {
        "tags": [
          "Product"
        ],
        "summary": "Copy Product",
        "description": "Create a new product as a deep copy of an existing one.\n\nDuplicates the product record, its full production process (phases + steps),\nmedia folder, print-template assignments, and tag connections under `new_code`.\nPass `by_code=true` to look up the original product by `code` instead of\n`_key`. Returns HTTP 409 if a product with `new_code` already exists.\n\nAll mutations run inside a single ArangoDB transaction.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `product:catalogue:create`",
        "operationId": "copy_product_product_copy_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Body_copy_product_product_copy_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Original product not found"
          },
          "409": {
            "description": "A product with the new code already exists"
          },
          "500": {
            "description": "Database or file-copy error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/product/{product_key}": {
      "delete": {
        "tags": [
          "Product"
        ],
        "summary": "Delete Product",
        "description": "Soft-delete a product by moving it to the trash.\n\nSets `trash=true` on the product document rather than removing it, preserving\nhistorical production data. The product will no longer appear in active\nproduct lists.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `product:catalogue:delete`",
        "operationId": "delete_product_product__product_key__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "product_key",
            "in": "path",
            "required": true,
            "schema": {
              "title": "Product Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database update error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Product"
        ],
        "summary": "Udpate Product",
        "description": "Partially update specific fields of a product document.\n\nMerges `updated_fields` into the product document, stamping the `updated`\ntimestamp. Only the supplied keys are changed; other fields are unaffected.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `product:catalogue:update`",
        "operationId": "udpate_product_product__product_key__patch",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "product_key",
            "in": "path",
            "required": true,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Product Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "default": {},
                "title": "Updated Fields"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database update error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Product"
        ],
        "summary": "Replace Product",
        "description": "Fully replace a product document.\n\nPerforms a full document replace (not a merge) \u2014 all fields in the document\nwill reflect `new_product_data`. The `_key` in the payload must match\n`product_key`.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `product:catalogue:update`",
        "operationId": "replace_product_product__product_key__put",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "product_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Product Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductDetails"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Replace Product Product  Product Key  Put"
                }
              }
            }
          },
          "500": {
            "description": "Database replace error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Product"
        ],
        "summary": "Get Product Data",
        "description": "Retrieve full product details including docs and counter.\n\nReturns a `ProductFull` object for `product_key`, enriched with:\n- `docs`: list of document files in the product doc folder.\n- `counter`: the associated `Counter` document if `counter_key` is set.\n\n**Emits:** *(direct query \u2014 no event class)*\n\n**Required scope:** `product:catalogue:read`",
        "operationId": "get_product_data_product__product_key__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "product_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Product Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductFull"
                }
              }
            }
          },
          "404": {
            "description": "Product not found"
          },
          "500": {
            "description": "Database fetch or validation error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/product/{product_key}/doc": {
      "post": {
        "tags": [
          "Product"
        ],
        "summary": "Save Doc",
        "description": "Upload a document file and attach it to a product.\n\nSaves the uploaded file to the product's `doc` subfolder. Returns the stored\nfilename on success.\n\n**Emits:** *(direct file write \u2014 no event class)*\n\n**Required scope:** `product:catalogue:update`",
        "operationId": "save_doc_product__product_key__doc_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "product_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Product Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_save_doc_product__product_key__doc_post"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string",
                  "title": "Response Save Doc Product  Product Key  Doc Post"
                }
              }
            }
          },
          "400": {
            "description": "File write error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/product/{product_key}/doc/{doc_name}": {
      "delete": {
        "tags": [
          "Product"
        ],
        "summary": "Delete Doc",
        "description": "Delete a document file from a product's doc folder.\n\nRemoves the file `doc_name` from the product's document storage.\nReturns no body on success.\n\n**Emits:** *(direct file delete \u2014 no event class)*\n\n**Required scope:** `product:catalogue:update`",
        "operationId": "delete_doc_product__product_key__doc__doc_name__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "product_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Product Key"
            }
          },
          {
            "name": "doc_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Doc Name"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "File deletion error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/product/{product_key}/image": {
      "put": {
        "tags": [
          "Product"
        ],
        "summary": "Replace Product Image",
        "description": "Replace the product's primary image.\n\nWrites the uploaded file to the product media folder as `image.jpg` and sets\n`image=true` in the product document. Any previous image file is overwritten.\n\n**Emits:** *(direct file write \u2014 no event class)*\n\n**Required scope:** `product:catalogue:update`",
        "operationId": "replace_product_image_product__product_key__image_put",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "product_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Product Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_replace_product_image_product__product_key__image_put"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Image write or database update error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Product"
        ],
        "summary": "Replace Product Image",
        "description": "Delete the product's primary image.\n\nRemoves `image.jpg` from the product media folder and sets `image=false` in\nthe product document. Returns no body on success.\n\n**Emits:** *(direct file delete \u2014 no event class)*\n\n**Required scope:** `product:catalogue:update`",
        "operationId": "replace_product_image_product__product_key__image_delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "product_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Product Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Image deletion or database update error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/product/{product_key}/stats": {
      "get": {
        "tags": [
          "Product"
        ],
        "summary": "Get Product Stats",
        "description": "Retrieve KPI statistics for a product.\n\nRuns the `GET_PRODUCT_STATS` query and returns aggregated metrics such as\nthroughput time, yield rate, and production counts within the product's\nconfigured KPI window.\n\n**Emits:** *(direct query \u2014 no event class)*\n\n**Required scope:** `product:catalogue:read`",
        "operationId": "get_product_stats_product__product_key__stats_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "product_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Product Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Get Product Stats Product  Product Key  Stats Get"
                }
              }
            }
          },
          "500": {
            "description": "KPI query error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/work-order": {
      "post": {
        "tags": [
          "Production"
        ],
        "summary": "Create Work Order",
        "description": "Create a new work order with its associated job records.\n\nValidates the product by key or code, generates a work order code via the\nconfigured counter if not provided, and inserts the WorkOrder, Job, and Queue\nrecords in a single ArangoDB transaction.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `production:work-order:create`",
        "operationId": "create_work_order_work_order_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkOrderNew"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "409": {
            "description": "Work order code already exists"
          },
          "500": {
            "description": "Counter misconfigured, product not found, or transaction failure"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Production"
        ],
        "summary": "Search Work Orders",
        "description": "Search and filter work orders with optional date range and status filters.\n\nBy default returns closed orders only. Includes computed performance metrics\n(processing time, processing cost, total cost) and open issue count per work\norder. Results sorted by end date descending, capped by `limit`.\n\n**Emits:** *(read-only \u2014 no event)*\n**Required scope:** `production:work-order:read`",
        "operationId": "search_work_orders_work_order_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Search"
            }
          },
          {
            "name": "open",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Open"
            }
          },
          {
            "name": "closed",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true,
              "title": "Closed"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100,
              "title": "Limit"
            }
          },
          {
            "name": "time_start_from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Time Start From"
            }
          },
          {
            "name": "time_start_to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Time Start To"
            }
          },
          {
            "name": "time_end_from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Time End From"
            }
          },
          {
            "name": "time_end_to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Time End To"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/work-order/{wo_key}": {
      "patch": {
        "tags": [
          "Production"
        ],
        "summary": "Update Work Order",
        "description": "Update editable fields of an existing work order.\n\nAccepts any combination of due date, start date, project code, BOM lines,\noutput position, and notes. Updates matching Job records for fields that\npropagate to jobs (start date, project code). Commits all changes in a\nsingle transaction.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `production:work-order:update`",
        "operationId": "update_work_order_work_order__wo_key__patch",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "wo_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Wo Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Body_update_work_order_work_order__wo_key__patch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Transaction failure while updating the work order"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Production"
        ],
        "summary": "Get Wo Data",
        "description": "Fetch full data for a single work order by key.\n\nExecutes the GET_WORK_ORDER_DATA AQL query and returns the enriched work\norder document including computed fields.\n\n**Emits:** *(read-only \u2014 no event)*\n**Required scope:** `production:work-order:read`",
        "operationId": "get_wo_data_work_order__wo_key__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "wo_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Wo Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Work order not found"
          },
          "500": {
            "description": "Database error while fetching work order data"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Production"
        ],
        "summary": "Delete Work Order",
        "description": "Delete a work order and its associated jobs from the system.\n\nOnly work orders in `created` or `planned` status may be deleted. Removes\nthe work order document, all child Job records, queue entries (site and\noperator), and any issue relationship edges in a single transaction.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `production:work-order:delete`",
        "operationId": "delete_work_order_work_order__wo_key__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "wo_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Wo Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "403": {
            "description": "Work order has been started and cannot be deleted"
          },
          "500": {
            "description": "Transaction failure while deleting the work order"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/work-order/{wo_key}/update-quantities": {
      "patch": {
        "tags": [
          "Production"
        ],
        "summary": "Update Work Order Quantities",
        "description": "Update the planned quantity of a work order and its jobs.\n\nAccepts a new work order quantity and a list of job-level updates (insert,\nupdate, or close). Recalculates progress for affected jobs; closes jobs whose\ncompleted quantity meets or exceeds the new planned quantity. Removes or\nre-adds the work order from the site queue based on resulting status.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `production:work-order:update-quantities`",
        "operationId": "update_work_order_quantities_work_order__wo_key__update_quantities_patch",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "wo_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Wo Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Body_update_work_order_quantities_work_order__wo_key__update_quantities_patch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "422": {
            "description": "Missing or inconsistent quantity/job update payload"
          },
          "500": {
            "description": "Transaction failure while updating quantities"
          }
        }
      }
    },
    "/work-order/{wo_key}/traceability": {
      "get": {
        "tags": [
          "Production"
        ],
        "summary": "Get Wo Traceability Data",
        "description": "Fetch serial traceability data for a work order.\n\nReturns the list of serial records linked to the work order, as produced\nby the GET_WORK_ORDER_TRACEABILITY_DATA AQL query.\n\n**Emits:** *(read-only \u2014 no event)*\n**Required scope:** `production:work-order:read`",
        "operationId": "get_wo_traceability_data_work_order__wo_key__traceability_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "wo_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Wo Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error while fetching traceability data"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/work-order-search-opts": {
      "get": {
        "tags": [
          "Production"
        ],
        "summary": "Search Work Orders",
        "description": "Return distinct work order code/project code options for search filters.\n\nExecutes the GET_WORK_ORDER_SEARCH_OPTIONS AQL query and returns a flat list\nof option objects used to populate search dropdowns in the UI.\n\n**Emits:** *(read-only \u2014 no event)*\n**Required scope:** `production:work-order:read`",
        "operationId": "search_work_orders_work_order_search_opts_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/queue/site/{site_key}": {
      "get": {
        "tags": [
          "Production"
        ],
        "summary": "Get Site Queue",
        "description": "Fetch the work order queue for a given site.\n\nExecutes GET_SITE_WORK_ORDER_DATA and returns the ordered list of work\norders currently in the site-level queue, enriched with job and progress data.\n\n**Emits:** *(read-only \u2014 no event)*\n**Required scope:** `production:queue:read`",
        "operationId": "get_site_queue_queue_site__site_key__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "site_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Site Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error while fetching site queue"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/queue": {
      "put": {
        "tags": [
          "Production"
        ],
        "summary": "Update Queue",
        "description": "Replace the ordered sequence of a site or operator queue.\n\nAccepts a Queue document with the new ordered work_orders or jobs list.\nWhen updating the site-level queue (no subqueue_target_key), also\nre-sorts all subordinate job queues to match the new work order order.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `production:queue:update`",
        "operationId": "update_queue_queue_put",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Queue"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error while updating the queue"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/queue/operator/{operator_key}": {
      "put": {
        "tags": [
          "Production"
        ],
        "summary": "Update Operator Queue",
        "description": "Update the job queue for a specific operator.\n\nReplaces the operator's ordered job list and optionally toggles the\n`independent` flag that controls whether the queue follows the global\nwork order order. When `independent` is set to False, triggers a\nfull reorder of job queues for the target site.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `production:queue:update`",
        "operationId": "update_operator_queue_queue_operator__operator_key__put",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "operator_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Operator Key"
            }
          },
          {
            "name": "site_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Site Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperatorQueueUpdateInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error while updating the operator queue"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/job": {
      "get": {
        "tags": [
          "Production"
        ],
        "summary": "Get Job List",
        "description": "Return a filtered list of jobs with their assigned operator details.\n\nFilters by any combination of job key(s), work order key(s), and phase\nkey(s). Each result is merged with the resolved User document for the\nassignee. Returns an empty list if no jobs match.\n\n**Emits:** *(read-only \u2014 no event)*\n**Required scope:** `production:job:read`",
        "operationId": "get_job_list_job_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "job_key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "title": "Job Key"
            }
          },
          {
            "name": "work_order_key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "title": "Work Order Key"
            }
          },
          {
            "name": "phase_key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "title": "Phase Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/job-assignment": {
      "get": {
        "tags": [
          "Production"
        ],
        "summary": "Get Assignment List",
        "description": "Fetch the current job assignment state grouped by operator.\n\nReturns operators with their assigned jobs and the list of unassigned\njobs, as produced by the GET_ASSIGNMENT_LIST AQL query. Optionally\nfiltered by a specific user key.\n\n**Emits:** *(read-only \u2014 no event)*\n**Required scope:** `production:job:read`",
        "operationId": "get_assignment_list_job_assignment_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "user_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error while fetching assignment list"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/job/{job_key}": {
      "get": {
        "tags": [
          "Production"
        ],
        "summary": "Get Job Data",
        "description": "Fetch full working data for a single job by key.\n\nExecutes GET_WORKING_JOB_DATA which returns the job document enriched\nwith step execution progress, active batch info, and operator details.\n\n**Emits:** *(read-only \u2014 no event)*\n**Required scope:** `production:job:read`",
        "operationId": "get_job_data_job__job_key__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "job_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Job Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error while fetching job data"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/work-session": {
      "get": {
        "tags": [
          "Production"
        ],
        "summary": "Get Active Work Session For Job",
        "description": "Fetch the currently active work session for a job.\n\nExecutes GET_ACTIVE_WORK_SESSION_FOR_JOB and returns the most recent\nunclosed WorkSession record for the given job key.\n\n**Emits:** *(read-only \u2014 no event)*\n**Required scope:** `production:work-session:read`",
        "operationId": "get_active_work_session_for_job_work_session_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "job_key",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Job Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error while fetching active work session"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/job/update": {
      "post": {
        "tags": [
          "Production"
        ],
        "summary": "Update Jobs",
        "description": "Apply a batch of job insert, update, or close operations.\n\nAccepts a list of JobUpdate items each specifying an action (insert,\nupdate, close) and a data dict. For each affected work order, recalculates\nprogress and adjusts queue membership (adds back or removes) based on the\nresulting status. All mutations run in a single ArangoDB transaction.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `production:job:update`",
        "operationId": "update_jobs_job_update_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "items": {
                  "$ref": "#/components/schemas/JobUpdate"
                },
                "type": "array",
                "title": "Job Updates"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Transaction failure while applying job updates"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/job/{job_key}/time": {
      "get": {
        "tags": [
          "Production"
        ],
        "summary": "Get Job Elapsed Time",
        "description": "Fetch elapsed and estimated time metrics for a job.\n\nExecutes GET_JOB_ELAPSED_TIME and returns timing data including elapsed\ntime, estimated remaining time, and on-time status for the given job.\n\n**Emits:** *(read-only \u2014 no event)*\n**Required scope:** `production:job:read`",
        "operationId": "get_job_elapsed_time_job__job_key__time_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "job_key",
            "in": "path",
            "required": true,
            "schema": {
              "title": "Job Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error while fetching elapsed time"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/tag": {
      "get": {
        "tags": [
          "Configuration"
        ],
        "summary": "Get Tags",
        "description": "List tags, optionally scoped to a specific entity.\n\nReturns all tags from the `Tag` collection when no `context` is supplied.\nWhen `context` and `context_key` are both provided, returns only tags\nconnected to the specified entity via `has_tag` edges.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `config:tag:read`",
        "operationId": "get_tags_tag_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "context",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/TagAssignmentContext"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Context"
            }
          },
          {
            "name": "context_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Context Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse_list_Tag__"
                }
              }
            }
          },
          "500": {
            "description": "Database error while fetching tags"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Configuration"
        ],
        "summary": "Create Tag",
        "description": "Create a new tag.\n\nInserts a `Tag` document into the `Tag` collection. Tags can subsequently\nbe connected to entities (e.g. products) via `POST /tag/update-connections`.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `config:tag:write`",
        "operationId": "create_tag_tag_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Tag"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse_Tag_"
                }
              }
            }
          },
          "500": {
            "description": "Database error during tag insertion"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/tag/update-connections": {
      "post": {
        "tags": [
          "Configuration"
        ],
        "summary": "Connect Tags",
        "description": "Add or remove tag connections for one or more entities.\n\nAccepts a list of `TagConnectionUpdate` objects each specifying a `type`\n(`add` or `remove`), a `tag_key`, a `context` (e.g. `product`), and a\n`context_key`. All changes are applied within a single ArangoDB transaction\nagainst the `has_tag` edge collection.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `config:tag:write`",
        "operationId": "connect_tags_tag_update_connections_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "items": {
                  "$ref": "#/components/schemas/TagConnectionUpdate"
                },
                "type": "array",
                "title": "Connection Updates"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse_NoneType_"
                }
              }
            }
          },
          "500": {
            "description": "Transaction error while applying tag connection changes"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/issue-type": {
      "get": {
        "tags": [
          "Collaboration"
        ],
        "summary": "Get Issue Type",
        "description": "List issue types, optionally filtered by key, code, or criticality.\n\nExecutes `Queries.FETCH_ISSUE_TYPES` against ArangoDB with the provided\nfilter parameters. Returns all active types by default; pass `active_only=false`\nto include archived types. Each result includes associated print templates.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `collaboration:issue-type:read`",
        "operationId": "get_issue_type_issue_type_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Key"
            }
          },
          {
            "name": "code",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Code"
            }
          },
          {
            "name": "critical",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Critical"
            }
          },
          {
            "name": "active_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true,
              "title": "Active Only"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/IssueTypeFull"
                  },
                  "title": "Response Get Issue Type Issue Type Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error while fetching issue types"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Collaboration"
        ],
        "summary": "Create Issue Type",
        "description": "Create a new issue type.\n\nInserts an `IssueType` document into the `IssueType` collection. Rejects\nthe request with 409 if a document with the same `code` already exists.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `collaboration:issue-type:write`",
        "operationId": "create_issue_type_issue_type_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueType"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "409": {
            "description": "An issue type with the same code already exists"
          },
          "500": {
            "description": "Database error during insertion"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/issue-type/{issue_type_key}": {
      "patch": {
        "tags": [
          "Collaboration"
        ],
        "summary": "Update Issue Type",
        "description": "Partially update an existing issue type.\n\nApplies the supplied fields to the `IssueType` document identified by\n`issue_type_key`. Unset fields are left unchanged (`keep_none=False`).\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `collaboration:issue-type:write`",
        "operationId": "update_issue_type_issue_type__issue_type_key__patch",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "issue_type_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Issue Type Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueTypeUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error during partial update"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Collaboration"
        ],
        "summary": "Delete Issue Type",
        "description": "Delete an issue type by key.\n\nPermanently removes the `IssueType` document with the given key from\nthe collection. Existing `Issue` documents that reference this type\nare not automatically updated.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `collaboration:issue-type:write`",
        "operationId": "delete_issue_type_issue_type__issue_type_key__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "issue_type_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Issue Type Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error during deletion"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/issue": {
      "get": {
        "tags": [
          "Collaboration"
        ],
        "summary": "Search Issues",
        "description": "Search and filter issues with multi-dimensional query parameters.\n\nExecutes `Queries.FIND_ISSUES` with all supplied filters. Filters are\nANDed together; omitted parameters default to `null` and are ignored by\nthe AQL query. `advanced_filters` accepts a base64-encoded JSON object\n(latin-1 encoding, matching the browser `btoa` API). Results are sorted\nby `sort_by` (default `created`) in `sorting_order` (default `desc`).\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `collaboration:issue:read`",
        "operationId": "search_issues_issue_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "issue_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "title": "Issue Key"
            }
          },
          {
            "name": "issue_key_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Issue Key Search"
            }
          },
          {
            "name": "issue_type_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "title": "Issue Type Key"
            }
          },
          {
            "name": "product_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "title": "Product Key"
            }
          },
          {
            "name": "product_code_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Product Code Search"
            }
          },
          {
            "name": "work_order_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "title": "Work Order Key"
            }
          },
          {
            "name": "work_order_code_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Work Order Code Search"
            }
          },
          {
            "name": "serial_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Serial Search"
            }
          },
          {
            "name": "project_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Project Search"
            }
          },
          {
            "name": "job_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "title": "Job Key"
            }
          },
          {
            "name": "phase_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "title": "Phase Key"
            }
          },
          {
            "name": "phase_alias_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Phase Alias Search"
            }
          },
          {
            "name": "operation_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "title": "Operation Key"
            }
          },
          {
            "name": "created_by",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "title": "Created By"
            }
          },
          {
            "name": "closed_by",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "title": "Closed By"
            }
          },
          {
            "name": "time_created_from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Time Created From"
            }
          },
          {
            "name": "time_created_to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Time Created To"
            }
          },
          {
            "name": "time_closed_from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Time Closed From"
            }
          },
          {
            "name": "time_closed_to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Time Closed To"
            }
          },
          {
            "name": "issue_open",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Issue Open"
            }
          },
          {
            "name": "issue_closed",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Issue Closed"
            }
          },
          {
            "name": "issue_critical",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Issue Critical"
            }
          },
          {
            "name": "issue_non_critical",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Issue Non Critical"
            }
          },
          {
            "name": "advanced_filters",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "title": "Advanced Filters"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Offset"
            }
          },
          {
            "name": "with_links",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "With Links"
            }
          },
          {
            "name": "sort_by",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": "created",
              "title": "Sort By"
            }
          },
          {
            "name": "sorting_order",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": "desc",
              "title": "Sorting Order"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "title": "Response Search Issues Issue Get"
                }
              }
            }
          },
          "500": {
            "description": "AQL error while searching issues"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/message": {
      "get": {
        "tags": [
          "Collaboration"
        ],
        "summary": "Get Messages",
        "description": "Retrieve messages for a given recipient, sorted by creation time.\n\nQueries the `message` edge collection filtering by `_to == recipient_id`.\nThe recipient is typically an `Issue` or `User` document ID\n(e.g. `Issue/abc123`). Results are sorted ascending by `created` timestamp.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `collaboration:message:read`",
        "operationId": "get_messages_message_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "recipient_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Recipient Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Message"
                  },
                  "title": "Response Get Messages Message Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error while fetching messages"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/task": {
      "get": {
        "tags": [
          "Collaboration"
        ],
        "summary": "Search Tasks",
        "description": "Search tasks using multi-dimensional filter parameters.\n\nExecutes `Queries.FIND_TASKS` with the bound `TaskSearchParameters`. Supports\nfiltering by status flags, date ranges, assignees, and linked entities\n(issue, work order, product, serial). `advanced_filters` accepts a\nbase64-encoded JSON object. Default limit is 200 rows.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `collaboration:task:read`",
        "operationId": "search_tasks_task_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Free-text search string matched against task title and description.",
              "examples": [
                "rework"
              ],
              "title": "Search"
            },
            "description": "Free-text search string matched against task title and description."
          },
          {
            "name": "task_type_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to tasks belonging to a specific task type.",
              "examples": [
                "tasktype_001"
              ],
              "title": "Task Type Key"
            },
            "description": "Filter to tasks belonging to a specific task type."
          },
          {
            "name": "status_pending",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Include tasks with status `pending` when `true`.",
              "examples": [
                true
              ],
              "title": "Status Pending"
            },
            "description": "Include tasks with status `pending` when `true`."
          },
          {
            "name": "status_open",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Include tasks with status `open` when `true`.",
              "examples": [
                true
              ],
              "title": "Status Open"
            },
            "description": "Include tasks with status `open` when `true`."
          },
          {
            "name": "status_completed",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Include tasks with status `completed` when `true`.",
              "examples": [
                false
              ],
              "title": "Status Completed"
            },
            "description": "Include tasks with status `completed` when `true`."
          },
          {
            "name": "status_canceled",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Include tasks with status `canceled` when `true`.",
              "examples": [
                false
              ],
              "title": "Status Canceled"
            },
            "description": "Include tasks with status `canceled` when `true`."
          },
          {
            "name": "owner_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to tasks owned by a specific user.",
              "examples": [
                "user42"
              ],
              "title": "Owner Key"
            },
            "description": "Filter to tasks owned by a specific user."
          },
          {
            "name": "assigned_to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to tasks assigned to any of the listed user keys.",
              "examples": [
                [
                  "user42",
                  "user99"
                ]
              ],
              "title": "Assigned To"
            },
            "description": "Filter to tasks assigned to any of the listed user keys."
          },
          {
            "name": "start_from_min",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Lower bound for the `start_from` date filter (inclusive).",
              "examples": [
                "2026-05-01"
              ],
              "title": "Start From Min"
            },
            "description": "Lower bound for the `start_from` date filter (inclusive)."
          },
          {
            "name": "start_from_max",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Upper bound for the `start_from` date filter (inclusive).",
              "examples": [
                "2026-05-31"
              ],
              "title": "Start From Max"
            },
            "description": "Upper bound for the `start_from` date filter (inclusive)."
          },
          {
            "name": "due_by_min",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Lower bound for the `due_by` date filter (inclusive).",
              "examples": [
                "2026-05-01"
              ],
              "title": "Due By Min"
            },
            "description": "Lower bound for the `due_by` date filter (inclusive)."
          },
          {
            "name": "due_by_max",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Upper bound for the `due_by` date filter (inclusive).",
              "examples": [
                "2026-05-31"
              ],
              "title": "Due By Max"
            },
            "description": "Upper bound for the `due_by` date filter (inclusive)."
          },
          {
            "name": "created_min",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Lower bound for the `created` date filter (inclusive).",
              "examples": [
                "2026-05-01"
              ],
              "title": "Created Min"
            },
            "description": "Lower bound for the `created` date filter (inclusive)."
          },
          {
            "name": "created_max",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Upper bound for the `created` date filter (inclusive).",
              "examples": [
                "2026-05-31"
              ],
              "title": "Created Max"
            },
            "description": "Upper bound for the `created` date filter (inclusive)."
          },
          {
            "name": "closed_min",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Lower bound for the `closed` date filter (inclusive).",
              "examples": [
                "2026-05-01"
              ],
              "title": "Closed Min"
            },
            "description": "Lower bound for the `closed` date filter (inclusive)."
          },
          {
            "name": "closed_max",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Upper bound for the `closed` date filter (inclusive).",
              "examples": [
                "2026-05-31"
              ],
              "title": "Closed Max"
            },
            "description": "Upper bound for the `closed` date filter (inclusive)."
          },
          {
            "name": "advanced_filters",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "additionalProperties": true
                },
                {
                  "type": "null"
                }
              ],
              "description": "Additional filter criteria as a JSON object (or base64-encoded JSON string, decoded by validator).",
              "title": "Advanced Filters"
            },
            "description": "Additional filter criteria as a JSON object (or base64-encoded JSON string, decoded by validator)."
          },
          {
            "name": "issue_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to tasks linked to a specific issue.",
              "examples": [
                "issue_001"
              ],
              "title": "Issue Key"
            },
            "description": "Filter to tasks linked to a specific issue."
          },
          {
            "name": "work_order_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to tasks linked to a specific work order.",
              "examples": [
                "wo_2026_001"
              ],
              "title": "Work Order Key"
            },
            "description": "Filter to tasks linked to a specific work order."
          },
          {
            "name": "product_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to tasks linked to a specific product.",
              "examples": [
                "prod_abc"
              ],
              "title": "Product Key"
            },
            "description": "Filter to tasks linked to a specific product."
          },
          {
            "name": "serial_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to tasks linked to a specific serial number record.",
              "examples": [
                "serial_xyz"
              ],
              "title": "Serial Key"
            },
            "description": "Filter to tasks linked to a specific serial number record."
          },
          {
            "name": "linked_task_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to tasks linked to another specific task.",
              "examples": [
                "task_001"
              ],
              "title": "Linked Task Key"
            },
            "description": "Filter to tasks linked to another specific task."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Maximum number of results to return. Defaults to 200.",
              "examples": [
                200
              ],
              "default": 200,
              "title": "Limit"
            },
            "description": "Maximum number of results to return. Defaults to 200."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Number of results to skip for pagination.",
              "examples": [
                0
              ],
              "default": 0,
              "title": "Offset"
            },
            "description": "Number of results to skip for pagination."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TaskSearchResult"
                  },
                  "title": "Response Search Tasks Task Get"
                }
              }
            }
          },
          "500": {
            "description": "AQL error while searching tasks"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/task/{task_key}": {
      "get": {
        "tags": [
          "Collaboration"
        ],
        "summary": "Get Task Data",
        "description": "Return full task data with linked entity references.\n\nExecutes `Queries.GET_TASK_DATA` to fetch the `Task` document identified\nby `task_key` together with its graph links to issues, work orders, products,\nserials, and other tasks. Returns the raw AQL result dict.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `collaboration:task:read`",
        "operationId": "get_task_data_task__task_key__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "task_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Task Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Get Task Data Task  Task Key  Get"
                }
              }
            }
          },
          "500": {
            "description": "AQL error while fetching task data"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/task-type": {
      "get": {
        "tags": [
          "Collaboration"
        ],
        "summary": "Get Task Types",
        "description": "List task types, optionally filtered by active status and name.\n\nReturns `TaskTypeFull` records (includes associated print templates).\nPass `active_only=false` to include archived task types. `name` is a\nsubstring match against the type name field.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `collaboration:task-type:read`",
        "operationId": "get_task_types_task_type_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "active_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true,
              "title": "Active Only"
            }
          },
          {
            "name": "name",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Name"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TaskTypeFull"
                  },
                  "title": "Response Get Task Types Task Type Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error while fetching task types"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Collaboration"
        ],
        "summary": "Create Task Type",
        "description": "Create a new task type.\n\nInserts a `TaskType` document into the `TaskType` collection. The\n`link_settings` field defaults to all entity types disabled; override\nexplicitly to enable issue/work-order/product/serial/task linking for\ntasks of this type.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `collaboration:task-type:write`",
        "operationId": "create_task_type_task_type_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskType"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskType"
                }
              }
            }
          },
          "500": {
            "description": "Database error during task type insertion"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/task-type/{type_key}": {
      "put": {
        "tags": [
          "Collaboration"
        ],
        "summary": "Update Task Type",
        "description": "Replace an existing task type document.\n\nPerforms a full replacement of the `TaskType` document identified by\n`type_key`. Only fields present in the request body are written\n(`exclude_unset=True`), so omitted optional fields retain their current\ndatabase values.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `collaboration:task-type:write`",
        "operationId": "update_task_type_task_type__type_key__put",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "type_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Type Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskType"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error during task type replacement"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Collaboration"
        ],
        "summary": "Delete Task Type",
        "description": "Delete a task type by key.\n\nPermanently removes the `TaskType` document. Existing `Task` documents\nthat reference this type via `task_type_key` are not automatically\nupdated or removed.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `collaboration:task-type:write`",
        "operationId": "delete_task_type_task_type__type_key__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "type_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Type Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error during task type deletion"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/event": {
      "post": {
        "tags": [
          "Traceability"
        ],
        "summary": "Record Event",
        "description": "Record a single domain event.\n\nDispatches an event of the type specified in `event_data.event_type` through\nthe event class registry. The event's `save()` method runs `pre_processing`,\n`apply` (inside an ArangoDB transaction), `store_event`, and\n`post_processing`. Returns the event's `response` payload on success.\n\n**Emits:** *(dynamic \u2014 event class resolved from `event_type` field at runtime)*\n**Required scope:** `traceability:event:create`",
        "operationId": "record_event_event_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventInfoModel"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "422": {
            "description": "Domain precondition failure or invalid event context"
          },
          "500": {
            "description": "Database error during event save"
          }
        }
      },
      "get": {
        "tags": [
          "Traceability"
        ],
        "summary": "Get Events",
        "description": "Search the event log.\n\nQueries the `Event` collection using the supplied entity reference filters\n(serial, job, work order, task, issue) and optional time range and event type\nfilters. `context_type` must be a known value from `EventContextType` or 422\nis returned.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `traceability:event:read`",
        "operationId": "get_events_event_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "issue_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Issue Key"
            }
          },
          {
            "name": "serial_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Serial Key"
            }
          },
          {
            "name": "job_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Job Key"
            }
          },
          {
            "name": "work_order_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Work Order Key"
            }
          },
          {
            "name": "task_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Task Key"
            }
          },
          {
            "name": "time_from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Time From"
            }
          },
          {
            "name": "time_to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Time To"
            }
          },
          {
            "name": "context_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/EventContextType"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Context Type"
            }
          },
          {
            "name": "context_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Context Key"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/EventType"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Type"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Get Events Event Get"
                }
              }
            }
          },
          "422": {
            "description": "Invalid context type"
          }
        }
      }
    },
    "/event/bulk": {
      "post": {
        "tags": [
          "Traceability"
        ],
        "summary": "Record Events Bulk",
        "description": "Record multiple events atomically in a single transaction.\n\nAll events succeed or all fail together. The `shared_data` contains common\nfields (`event_type`, `user_key`, `user_session_key`, `timestamp`). All\nevents must be of the same type (specified in `shared_data.event_type`). The\n`events` list contains event-specific data for each event. When\n`shared_data.context_type` is set, it applies to all events and per-row\noverrides are stripped.\n\n**Emits:** *(dynamic \u2014 event class resolved from `shared_data.event_type` at runtime)*\n**Required scope:** `traceability:event:create`",
        "operationId": "record_events_bulk_event_bulk_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkEventRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "422": {
            "description": "Domain precondition failure, invalid context, or no events provided"
          },
          "500": {
            "description": "Database error during bulk event save"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/batch/{batch_key}": {
      "get": {
        "tags": [
          "Traceability"
        ],
        "summary": "Get Batch Execution Data",
        "description": "Fetch full execution data for a production batch.\n\nExecutes `GET_BATCH_EXECUTION_DATA` to retrieve the `Batch` document together\nwith its linked `StepExecutionData` records and work sessions. Returns an\nempty detail dict when no batch matching `batch_key` is found.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `traceability:batch-execution-record:read`",
        "operationId": "get_batch_execution_data_batch__batch_key__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "batch_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Batch Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/batch/{batch_key}/serials": {
      "get": {
        "tags": [
          "Traceability"
        ],
        "summary": "Get Batch Serials",
        "description": "Return serials associated with a production batch.\n\nQueries `GET_BATCH_SERIALS` in the `Serial` collection for all serials linked\nto `batch_key`. Each result has `active=True` set before returning so the\nfrontend can treat them as currently in-use serials.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `traceability:batch-execution-record:read`",
        "operationId": "get_batch_serials_batch__batch_key__serials_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "batch_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Batch Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SerialSelection"
                  },
                  "title": "Response Get Batch Serials Batch  Batch Key  Serials Get"
                }
              }
            }
          },
          "404": {
            "description": "No serials found for batch"
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/job/{job_key}/heartbeat": {
      "post": {
        "tags": [
          "Traceability"
        ],
        "summary": "Job Heartbeat",
        "description": "Updates the work session `last_online` attribute with current time.\n\nWrites the current timestamp to `Job.last_online` within a transaction on the\n`Job` and `WorkSession` collections. Used by the production UI to signal that\nan operator is still active on a job without recording a full event.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `traceability:batch-execution-record:read`",
        "operationId": "job_heartbeat_job__job_key__heartbeat_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "job_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Job Key"
            }
          },
          {
            "name": "work_session_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Work Session Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/wip": {
      "get": {
        "tags": [
          "Traceability"
        ],
        "summary": "Get Wip Availability For Job",
        "description": "Return WIP quantity availability upstream and downstream of a job.\n\nExecutes `GET_AVAILABLE_WIP_UPSTREAM_AND_DOWNSTREAM_OF_JOB` to calculate the\ntotal free WIP quantities on both sides of the job in the process graph.\nReturns `free_wip_qt_upstream` and `free_wip_qt_downstream` as floats summed\nacross all matching WIP records.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `traceability:batch-execution-record:read`",
        "operationId": "get_wip_availability_for_job_wip_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "job_key",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Job Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Get Wip Availability For Job Wip Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/batch/temp-data": {
      "post": {
        "tags": [
          "Traceability"
        ],
        "summary": "Store Temp Step Data",
        "description": "Creates or updates a step execution data record with the given form data without setting the step as done.\n\nLocates an existing `StepExecutionData` record by `execution_record_key` or\nby `(batch_key, step_key)` pair. Merges the provided `form_data` values into\nthe existing record's fields in-place. If no record exists yet, a new one is\ncreated by reading the step's `form_fields` definition and pre-populating all\nfields. Returns 422 when the step is already marked `done`.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `traceability:batch-execution-record:read`",
        "operationId": "store_temp_step_data_batch_temp_data_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecutionDataUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "422": {
            "description": "Missing context (execution_record_key or batch_key+step_key), empty form data, or step already done"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/batch/{batch_key}/serial-temp-links": {
      "put": {
        "tags": [
          "Traceability"
        ],
        "summary": "Create Temporary Link",
        "description": "Replace batch temporary component serial links with the provided ones.\n\nDeletes all existing temporary `contains` edges for `batch_key` and\nre-inserts the supplied links. All links must be unconfirmed (`confirmed=False`)\nand must reference the given batch. Confirmed links must be created via\n`SerialLinkedEvent` instead.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `traceability:batch-execution-record:read`",
        "operationId": "create_temporary_link_batch__batch_key__serial_temp_links_put",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "batch_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Batch Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SerialLink"
                },
                "title": "Links"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "403": {
            "description": "Confirmed link or link not related to this batch"
          },
          "404": {
            "description": "Batch or serial not found"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/counter": {
      "post": {
        "tags": [
          "Traceability"
        ],
        "summary": "Create Counter",
        "description": "Create a new counter sequence definition.\n\nInserts a `Counter` document into the `Counter` collection. The counter\ntemplate and frequency determine how the sequence string is formatted and\nwhen the tick resets. Returns the new counter's `_key`.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `traceability:counter:write`",
        "operationId": "create_counter_counter_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Counter"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error during counter insertion"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Traceability"
        ],
        "summary": "Fetch Counter",
        "description": "List counters, optionally filtered by name or key.\n\nQueries the `Counter` collection with the provided filters. Returns all\ncounters when no filters are supplied, sorted ascending by name (case-insensitive).\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `traceability:counter:read`",
        "operationId": "fetch_counter_counter_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Name"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Counter"
                  },
                  "title": "Response Fetch Counter Counter Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error while fetching counters"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/counter/{counter_key}": {
      "put": {
        "tags": [
          "Traceability"
        ],
        "summary": "Replace Field Metadata",
        "description": "Replace counter metadata for a given counter key.\n\nPerforms a full document update of the `Counter` record identified by\n`counter_key`. The request body must include `_key` (via the `counter_data`\nmodel). `check_rev=False` means optimistic concurrency is not enforced.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `traceability:counter:write`",
        "operationId": "replace_field_metadata_counter__counter_key__put",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "counter_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Counter Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Counter"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error during counter update"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Traceability"
        ],
        "summary": "Delete Field",
        "description": "Delete a counter sequence definition.\n\nRefuses deletion (409) if the counter is assigned to a system counter slot\n(checked via the `Config/system_counters` document) or if any `Product`\ndocument references it via `counter_key`. Returns 200 on successful deletion.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n\n**Required scope:** `traceability:counter:write`",
        "operationId": "delete_field_counter__counter_key__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "counter_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Counter Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "409": {
            "description": "Counter is assigned as a system counter slot or referenced by one or more Products"
          },
          "500": {
            "description": "Database error during deletion"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/notification/ticket": {
      "post": {
        "tags": [
          "Notification"
        ],
        "summary": "Mint Ticket",
        "description": "Issue a short-lived SSE ticket for the given topic.\n\nThe caller must hold a valid session JWT (Authorization header). The\nreturned ticket is scoped to the requested topic and the calling user,\nand expires in `expires_in` seconds. Pass it as `?ticket=<value>` when\nopening the SSE stream.\n\nFor `user:<key>` topics, the caller's consumer_key must match `<key>` \u2014\na user cannot mint a ticket that lets them eavesdrop on another user's\npersonal notification stream.\n\n**Emits:** *(SSE stream \u2014 emits are downstream NATS subjects)*\n\n**Required scope:** `notification:stream:subscribe`",
        "operationId": "mint_ticket_notification_ticket_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SseTicketRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SseTicketResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid session JWT"
          },
          "403": {
            "description": "Caller's consumer_key does not match the requested user:<key> topic"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/notification/{topic}": {
      "get": {
        "tags": [
          "Notification"
        ],
        "summary": "Message Stream",
        "description": "Server-Sent Events stream for the given notification `topic`.\n\nAuthorization rules:\n  * Auth is REQUIRED. Pass either `?ticket=<short-JWT>` (issued by\n    POST /notification/ticket, preferred for browser EventSource clients)\n    or an `Authorization: Bearer <JWT>` header (for server-to-server).\n  * For `user:<key>` topics, the caller's consumer_key MUST match `<key>`.\n    The owner-match is enforced at ticket issuance; the header path checks\n    it here directly.\n  * Non-user topics (task, inventory, ...) require auth but are not\n    owner-scoped in v1.\n\n**Emits:** *(SSE stream \u2014 emits are downstream NATS subjects)*\n\n**Required scope:** `notification:stream:subscribe`",
        "operationId": "message_stream_notification__topic__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "topic",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Topic"
            }
          },
          {
            "name": "ticket",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Ticket"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "text/event-stream": {
                "itemSchema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "string"
                    },
                    "event": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "retry": {
                      "type": "integer",
                      "minimum": 0
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "No valid ticket or Authorization header provided"
          },
          "403": {
            "description": "Ticket or JWT consumer_key does not match the requested user:<key> topic"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/position": {
      "get": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Get Positions",
        "description": "Search inventory positions.\n\nReturns all positions matching the given search filters. Positions are nodes\nin the warehouse location graph (stored in the `Position` collection); results\nexclude logically deleted positions unless `search` matches their code.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `inventory:position:read`",
        "operationId": "get_positions_position_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Wildcard search against position code.",
              "examples": [
                "WAREHOUSE-A*"
              ],
              "title": "Search"
            },
            "description": "Wildcard search against position code."
          },
          {
            "name": "position_keys",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to positions with these specific keys.",
              "examples": [
                [
                  "12345",
                  "67890"
                ]
              ],
              "title": "Position Keys"
            },
            "description": "Filter to positions with these specific keys."
          },
          {
            "name": "has_product_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "description": "Return only positions that currently contain at least one unit of these products.",
              "examples": [
                [
                  "product/67890"
                ]
              ],
              "title": "Has Product Key"
            },
            "description": "Return only positions that currently contain at least one unit of these products."
          },
          {
            "name": "has_product_code",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "description": "Return only positions containing products whose code matches any of the given values.",
              "examples": [
                [
                  "PROD-001"
                ]
              ],
              "title": "Has Product Code"
            },
            "description": "Return only positions containing products whose code matches any of the given values."
          },
          {
            "name": "is_in_position",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to positions that are children of this position key in the hierarchy.",
              "examples": [
                "IN"
              ],
              "title": "Is In Position"
            },
            "description": "Filter to positions that are children of this position key in the hierarchy."
          },
          {
            "name": "contains_position",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to positions that contain this child position key.",
              "examples": [
                "12345"
              ],
              "title": "Contains Position"
            },
            "description": "Filter to positions that contain this child position key."
          },
          {
            "name": "fixed_only",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "If True, return only fixed (non-mobile) positions.",
              "examples": [
                false
              ],
              "default": false,
              "title": "Fixed Only"
            },
            "description": "If True, return only fixed (non-mobile) positions."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Maximum number of results to return.",
              "examples": [
                200
              ],
              "default": 200,
              "title": "Limit"
            },
            "description": "Maximum number of results to return."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Number of results to skip for pagination.",
              "examples": [
                0
              ],
              "default": 0,
              "title": "Offset"
            },
            "description": "Number of results to skip for pagination."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/models__inventory__position__Position"
                  },
                  "title": "Response Get Positions Position Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Create Position",
        "description": "Create a new warehouse position.\n\nInserts a new `Position` document and links it to its parent via the\n`is_in_position` edge collection within a single ArangoDB transaction.\nAuto-generates a positional code from the system counter if `code` is omitted.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `inventory:position:create`",
        "operationId": "create_position_position_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PositionNew"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/position/{position_key}": {
      "get": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Get Position Details",
        "description": "Fetch detailed data for a single position.\n\nReturns the position document plus its current inventory contents. Raises 404\nif no position with `position_key` exists in the `Position` collection.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `inventory:position:read`",
        "operationId": "get_position_details_position__position_key__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "position_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Position Key"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Search"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Get Position Details Position  Position Key  Get"
                }
              }
            }
          },
          "404": {
            "description": "Position not found"
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Delete Position",
        "description": "Soft-delete a warehouse position.\n\nMarks the position as `deleted=True` in the `Position` collection and removes\nits `is_in_position` edge. Refuses deletion of the reserved `IN` root position\nand any position that still has children or inventory contents.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `inventory:position:delete`",
        "operationId": "delete_position_position__position_key__delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "position_key",
            "in": "path",
            "required": true,
            "schema": {
              "title": "Position Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "400": {
            "description": "Cannot delete default position or position with existing contents"
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/position-hierarchy": {
      "get": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Get Position Hierarchy",
        "description": "Return the full position tree rooted at a given position.\n\nTraverses the `is_in_position` edge collection recursively (up to 15 levels)\nand assembles a nested hierarchy of positions sorted alphabetically by code at\neach level. Pass `position_key=IN` to retrieve the entire warehouse tree.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `inventory:position:read`",
        "operationId": "get_position_hierarchy_position_hierarchy_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "position_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Position Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Get Position Hierarchy Position Hierarchy Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/position/{positions_key}": {
      "patch": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Update Position",
        "description": "Update a position's attributes or reparent it in the hierarchy.\n\nApplies a partial update to the `Position` document identified by\n`position_key`. If `parent_position_key` is provided, the existing\n`is_in_position` edge is updated to point to the new parent, moving the\nposition within the warehouse hierarchy.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `inventory:position:update`",
        "operationId": "update_position_position__positions_key__patch",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "position_key",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Position Key"
            }
          },
          {
            "name": "parent_position_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Parent Position Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "title": "Updated Fields"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/movement": {
      "get": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Search Inventory Journal",
        "description": "Search the inventory movement journal.\n\nQueries the `movement` edge collection using the supplied filters (type,\nstatus, date range, product, serial, position, movement list). Returns\nenriched results including position codes, product codes, and movement list\ncodes resolved from related collections.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `inventory:movement:read`",
        "operationId": "search_inventory_journal_movement_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "movement_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/InventoryMovementType"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by movement type.",
              "examples": [
                "transfer"
              ],
              "title": "Movement Type"
            },
            "description": "Filter by movement type."
          },
          {
            "name": "movement_status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/MovementStatus"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by movement status.",
              "examples": [
                "completed"
              ],
              "title": "Movement Status"
            },
            "description": "Filter by movement status."
          },
          {
            "name": "include_planned",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Include movements in `planned` status.",
              "examples": [
                true
              ],
              "default": true,
              "title": "Include Planned"
            },
            "description": "Include movements in `planned` status."
          },
          {
            "name": "include_completed",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Include movements in `completed` status.",
              "examples": [
                true
              ],
              "default": true,
              "title": "Include Completed"
            },
            "description": "Include movements in `completed` status."
          },
          {
            "name": "start_from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter movements that started on or after this timestamp.",
              "examples": [
                "2026-01-01T00:00:00Z"
              ],
              "title": "Start From"
            },
            "description": "Filter movements that started on or after this timestamp."
          },
          {
            "name": "start_to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter movements that started on or before this timestamp.",
              "examples": [
                "2026-12-31T23:59:59Z"
              ],
              "title": "Start To"
            },
            "description": "Filter movements that started on or before this timestamp."
          },
          {
            "name": "end_from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter movements that ended on or after this timestamp.",
              "examples": [
                "2026-01-01T00:00:00Z"
              ],
              "title": "End From"
            },
            "description": "Filter movements that ended on or after this timestamp."
          },
          {
            "name": "end_to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter movements that ended on or before this timestamp.",
              "examples": [
                "2026-12-31T23:59:59Z"
              ],
              "title": "End To"
            },
            "description": "Filter movements that ended on or before this timestamp."
          },
          {
            "name": "product_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by product key.",
              "examples": [
                "67890"
              ],
              "title": "Product Key"
            },
            "description": "Filter by product key."
          },
          {
            "name": "product_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Wildcard search on product code.",
              "examples": [
                "PROD-*"
              ],
              "title": "Product Search"
            },
            "description": "Wildcard search on product code."
          },
          {
            "name": "serial_keys",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to movements involving any of these serial keys.",
              "examples": [
                [
                  "SN-LR-001234"
                ]
              ],
              "title": "Serial Keys"
            },
            "description": "Filter to movements involving any of these serial keys."
          },
          {
            "name": "serial_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Wildcard search on serial code.",
              "examples": [
                "SN-LR-*"
              ],
              "title": "Serial Search"
            },
            "description": "Wildcard search on serial code."
          },
          {
            "name": "list_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to movements belonging to any of these movement list keys.",
              "examples": [
                [
                  "mvtlist-001"
                ]
              ],
              "title": "List Key"
            },
            "description": "Filter to movements belonging to any of these movement list keys."
          },
          {
            "name": "list_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Text search on movement list code.",
              "examples": [
                "LIST-2026"
              ],
              "title": "List Search"
            },
            "description": "Text search on movement list code."
          },
          {
            "name": "work_order_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Wildcard search on work order code in references.",
              "examples": [
                "WO-2026-*"
              ],
              "title": "Work Order Search"
            },
            "description": "Wildcard search on work order code in references."
          },
          {
            "name": "position_from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by source position key.",
              "examples": [
                "12345"
              ],
              "title": "Position From"
            },
            "description": "Filter by source position key."
          },
          {
            "name": "position_to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by destination position key.",
              "examples": [
                "67890"
              ],
              "title": "Position To"
            },
            "description": "Filter by destination position key."
          },
          {
            "name": "position_filter_operator",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Logical operator for `position_from` / `position_to` filter combination (`AND` or `OR`).",
              "examples": [
                "AND"
              ],
              "default": "AND",
              "title": "Position Filter Operator"
            },
            "description": "Logical operator for `position_from` / `position_to` filter combination (`AND` or `OR`)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Maximum number of results.",
              "examples": [
                500
              ],
              "default": 500,
              "title": "Limit"
            },
            "description": "Maximum number of results."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Pagination offset.",
              "examples": [
                0
              ],
              "default": 0,
              "title": "Offset"
            },
            "description": "Pagination offset."
          },
          {
            "name": "search_graph",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "If True, traverse the position graph when filtering by position.",
              "examples": [
                true
              ],
              "default": true,
              "title": "Search Graph"
            },
            "description": "If True, traverse the position graph when filtering by position."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/InventoryMovementSearchResults"
                  },
                  "title": "Response Search Inventory Journal Movement Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/movement/latest-positions": {
      "get": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Get Recent Movement Positions",
        "description": "Return recently used movement positions for a user.\n\nRetrieves the most recently used source (`from`) or destination (`to`)\npositions from the `movement` collection, optionally scoped to a specific\nuser and movement type. Useful for quick-access position suggestions in the\nwarehouse UI.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `inventory:movement:read`",
        "operationId": "get_recent_movement_positions_movement_latest_positions_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "user_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Key"
            }
          },
          {
            "name": "position_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/PositionType"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Position Type"
            }
          },
          {
            "name": "movement_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/InventoryMovementType"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Movement Type"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "default": 10,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/models__inventory__position__Position"
                  },
                  "title": "Response Get Recent Movement Positions Movement Latest Positions Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/movement/latest-products": {
      "get": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Get Recent Movement Products",
        "description": "Return recently moved products for a user.\n\nQueries the `movement` collection for the most recently moved products,\noptionally filtered by user and movement type. Used to pre-populate product\nselectors in the warehouse receiving and transfer UIs.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `inventory:movement:read`",
        "operationId": "get_recent_movement_products_movement_latest_products_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "user_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Key"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/InventoryMovementType"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Type"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "default": 10,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ProductBaseData"
                  },
                  "title": "Response Get Recent Movement Products Movement Latest Products Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/movement-list": {
      "get": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Search Movement Lists",
        "description": "Search movement lists (warehouse transfer orders).\n\nQueries the `MovementList` collection with optional filters for status, type,\ndate range, and product inclusion. Each result includes aggregated counts of\nmovements per status. `open_only=true` restricts results to lists that still\nhave planned or started movements.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `inventory:movement-list:read`",
        "operationId": "search_movement_lists_movement_list_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Search"
            }
          },
          {
            "name": "includes_product_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Includes Product Key"
            }
          },
          {
            "name": "includes_product_code",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Includes Product Code"
            }
          },
          {
            "name": "due_by_min",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Due By Min"
            }
          },
          {
            "name": "due_by_max",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Due By Max"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/InventoryMovementType"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Type"
            }
          },
          {
            "name": "open_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Open Only"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0,
              "title": "Offset"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Body_search_movement_lists_movement_list_get"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MovementListWithCounts"
                  },
                  "title": "Response Search Movement Lists Movement List Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Create Movement List",
        "description": "Create a movement list with its associated movements.\n\nDispatches a `WarehouseListCreatedEvent` which atomically inserts the\n`MovementList` document and all its child `movement` edges. The payload must\ncontain movement data for all movements to include in the list.\n\n**Emits:** `WarehouseListCreatedEvent`\n**Required scope:** `inventory:movement-list:create`",
        "operationId": "create_movement_list_movement_list_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "title": "New Movement List"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation error in movement list data"
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/inventory": {
      "get": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Get Inventory",
        "description": "Search current inventory across the position graph.\n\nTraverses the `is_in_position` graph starting from `root_position_key` (or\nthe entire warehouse if omitted) and returns all `Inventory` edge records\nmatching the product, serial, and position filters. Includes resolved product\nand position codes in each result.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `inventory:inventory:read`",
        "operationId": "get_inventory_inventory_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "root_position_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Traverse the position graph starting from this position key; omit to search the entire warehouse.",
              "examples": [
                "IN"
              ],
              "title": "Root Position Key"
            },
            "description": "Traverse the position graph starting from this position key; omit to search the entire warehouse."
          },
          {
            "name": "product_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to inventory slots containing this product.",
              "examples": [
                "67890"
              ],
              "title": "Product Key"
            },
            "description": "Filter to inventory slots containing this product."
          },
          {
            "name": "product_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Wildcard search on product code.",
              "examples": [
                "PROD-*"
              ],
              "title": "Product Search"
            },
            "description": "Wildcard search on product code."
          },
          {
            "name": "serials_only",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "If True, return only serialized inventory slots.",
              "examples": [
                false
              ],
              "default": false,
              "title": "Serials Only"
            },
            "description": "If True, return only serialized inventory slots."
          },
          {
            "name": "serial_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Wildcard search on serial code.",
              "examples": [
                "SN-LR-*"
              ],
              "title": "Serial Search"
            },
            "description": "Wildcard search on serial code."
          },
          {
            "name": "serial_keys",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to inventory slots containing any of these serial keys.",
              "examples": [
                [
                  "SN-LR-001234"
                ]
              ],
              "title": "Serial Keys"
            },
            "description": "Filter to inventory slots containing any of these serial keys."
          },
          {
            "name": "position_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Wildcard search on position code.",
              "examples": [
                "LOCATION-A*"
              ],
              "title": "Position Search"
            },
            "description": "Wildcard search on position code."
          },
          {
            "name": "position_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to this specific position.",
              "examples": [
                "12345"
              ],
              "title": "Position Key"
            },
            "description": "Filter to this specific position."
          },
          {
            "name": "owned",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by ownership flag; None returns all.",
              "examples": [
                true
              ],
              "title": "Owned"
            },
            "description": "Filter by ownership flag; None returns all."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Maximum number of results.",
              "examples": [
                200
              ],
              "default": 200,
              "title": "Limit"
            },
            "description": "Maximum number of results."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Pagination offset.",
              "examples": [
                0
              ],
              "default": 0,
              "title": "Offset"
            },
            "description": "Pagination offset."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/InventorySearchResult"
                  },
                  "title": "Response Get Inventory Inventory Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/inventory/count-session": {
      "post": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Create Counting Session",
        "description": "Create a new inventory counting session with assignments.\n\nInserts an `InventoryCountSession` document and all its\n`InventoryCountAssignment` records in a single transaction. Auto-generates a\nsession code from the system counter if `code` is omitted. Each assignment\nmust reference at least one target (position or product key depending on the\nsession type).\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `inventory:count:create`",
        "operationId": "create_counting_session_inventory_count_session_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Body_create_counting_session_inventory_count_session_post"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "400": {
            "description": "Missing assignment targets or validation error"
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Search Counting Sessions",
        "description": "Search counting sessions.\n\nQueries the `InventoryCountSession` collection with optional filters for\nstatus, type, and free-text search on session code. Returns sessions sorted\nby creation date descending up to `limit`.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `inventory:count:read`",
        "operationId": "search_counting_sessions_inventory_count_session_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Wildcard search on session code.",
              "examples": [
                "CNT-2026-*"
              ],
              "title": "Search"
            },
            "description": "Wildcard search on session code."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/InventoryCountSessionStatus"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by session status.",
              "examples": [
                "planned"
              ],
              "title": "Status"
            },
            "description": "Filter by session status."
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/InventoryCountSessionType"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by counting dimension.",
              "examples": [
                "position"
              ],
              "title": "Type"
            },
            "description": "Filter by counting dimension."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Maximum number of results.",
              "examples": [
                500
              ],
              "default": 500,
              "title": "Limit"
            },
            "description": "Maximum number of results."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Pagination offset.",
              "examples": [
                0
              ],
              "default": 0,
              "title": "Offset"
            },
            "description": "Pagination offset."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/InventoryCountSession"
                  },
                  "title": "Response Search Counting Sessions Inventory Count Session Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Delete Counting Session",
        "description": "Delete a planned counting session.\n\nRemoves the `InventoryCountSession` document and all associated\n`InventoryCountAssignment` records within a single transaction. Only sessions\nin `planned` status may be deleted; started or completed sessions return 422.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `inventory:count:delete`",
        "operationId": "delete_counting_session_inventory_count_session_delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "counting_session_key",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Counting Session Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Counting session not found"
          },
          "422": {
            "description": "Session cannot be deleted because it has been started or completed"
          },
          "500": {
            "description": "Database error"
          }
        }
      }
    },
    "/inventory/count-session/{session_key}": {
      "get": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Get Counting Session",
        "description": "Fetch full details for a single counting session.\n\nReturns the `InventoryCountSession` document enriched with assignment details\nand progress statistics. Raises 404 when `session_key` does not match any\nsession in the database.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `inventory:count:read`",
        "operationId": "get_counting_session_inventory_count_session__session_key__get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "session_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Session Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Get Counting Session Inventory Count Session  Session Key  Get"
                }
              }
            }
          },
          "404": {
            "description": "Counting session not found"
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Update Counting Session",
        "description": "Update a counting session's metadata.\n\nApplies the provided partial update to the `InventoryCountSession` document.\nFields such as `code`, `type`, `blind_quantities`, `blind_serials`, and\n`scheduled_start` may only be changed while the session is in `planned`\nstatus; attempts to update them after start return 422.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `inventory:count:update`",
        "operationId": "update_counting_session_inventory_count_session__session_key__put",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "session_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Session Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InventoryCountSessionUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Counting session not found"
          },
          "422": {
            "description": "Cannot update restricted fields after session has been started"
          },
          "500": {
            "description": "Database error"
          }
        }
      }
    },
    "/inventory/count-session/{session_key}/processed-records": {
      "get": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Get Counting Session Processed Records",
        "description": "Count processed count records for a session.\n\nReturns the number of `inventory_count_record` documents associated with\n`session_key` that have `processed=true`. Used to track application progress\nduring `CountSessionAppliedEvent` processing.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `inventory:count:read`",
        "operationId": "get_counting_session_processed_records_inventory_count_session__session_key__processed_records_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "session_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Session Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "integer",
                  "title": "Response Get Counting Session Processed Records Inventory Count Session  Session Key  Processed Records Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/inventory/count-assignment": {
      "get": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Get Counting Assignment",
        "description": "Search counting assignments.\n\nQueries `InventoryCountAssignment` records with filters for session key,\nassignment type, product, position, assigned user, and status. Supports\nsorting by `product` or `position` key.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `inventory:count:read`",
        "operationId": "get_counting_assignment_inventory_count_assignment_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "inventory_count_session_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by parent session key.",
              "examples": [
                "cnt-session-001"
              ],
              "title": "Inventory Count Session Key"
            },
            "description": "Filter by parent session key."
          },
          {
            "name": "assignment_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/InventoryCountSessionType"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by counting dimension.",
              "examples": [
                "position"
              ],
              "title": "Assignment Type"
            },
            "description": "Filter by counting dimension."
          },
          {
            "name": "product_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to assignments targeting this product key.",
              "examples": [
                "67890"
              ],
              "title": "Product Key"
            },
            "description": "Filter to assignments targeting this product key."
          },
          {
            "name": "product_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Wildcard search on product code.",
              "examples": [
                "PROD-*"
              ],
              "title": "Product Search"
            },
            "description": "Wildcard search on product code."
          },
          {
            "name": "position_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to assignments targeting this position key.",
              "examples": [
                "12345"
              ],
              "title": "Position Key"
            },
            "description": "Filter to assignments targeting this position key."
          },
          {
            "name": "position_search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Wildcard search on position code.",
              "examples": [
                "LOCATION-A*"
              ],
              "title": "Position Search"
            },
            "description": "Wildcard search on position code."
          },
          {
            "name": "assigned_to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by the user key the assignment is assigned to.",
              "examples": [
                "user/operator-01"
              ],
              "title": "Assigned To"
            },
            "description": "Filter by the user key the assignment is assigned to."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/InventoryCountAssignmentStatus"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by assignment status.",
              "examples": [
                "planned"
              ],
              "title": "Status"
            },
            "description": "Filter by assignment status."
          },
          {
            "name": "order_by",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "product",
                    "position"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Sort results by `product_key` or `position_key`.",
              "examples": [
                "position"
              ],
              "title": "Order By"
            },
            "description": "Sort results by `product_key` or `position_key`."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Maximum number of results.",
              "examples": [
                500
              ],
              "default": 500,
              "title": "Limit"
            },
            "description": "Maximum number of results."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Pagination offset.",
              "examples": [
                0
              ],
              "default": 0,
              "title": "Offset"
            },
            "description": "Pagination offset."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/InventoryCountAssignment"
                  },
                  "title": "Response Get Counting Assignment Inventory Count Assignment Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Create Counting Assignments",
        "description": "Add counting assignments to an existing session.\n\nInserts one or more `InventoryCountAssignment` records into the given session.\nAll referenced sessions must exist and must not be in `completed`, `applied`,\nor `canceled` status. Sets `created_by` from the authenticated token and\ndefaults `include_children` to `False` if not supplied.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `inventory:count:create`",
        "operationId": "create_counting_assignments_inventory_count_assignment_post",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InventoryCountAssignment"
                },
                "title": "Assignments"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "400": {
            "description": "No assignments provided"
          },
          "404": {
            "description": "Counting session not found"
          },
          "422": {
            "description": "Session is completed, applied, or canceled"
          },
          "500": {
            "description": "Database error"
          }
        }
      },
      "delete": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Delete Counting Assignments",
        "description": "Cancel a set of counting assignments.\n\nExecutes the `CANCEL_INVENTORY_COUNT_ASSIGNMENTS` AQL query within a\ntransaction. If any assignment in `assignment_keys` cannot be canceled\n(because it has been started or completed), the entire operation is aborted\nand 400 is returned.\n\n**Emits:** *(direct transaction \u2014 no event class)*\n**Required scope:** `inventory:count:delete`",
        "operationId": "delete_counting_assignments_inventory_count_assignment_delete",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Body_delete_counting_assignments_inventory_count_assignment_delete"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "400": {
            "description": "Some assignments cannot be canceled (already started or completed)"
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/inventory/count-record": {
      "get": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Get Counting Record",
        "description": "Search inventory count records.\n\nQueries `inventory_count_record` documents with filters for session, user,\nassignment, product, and position keys, plus status inclusion flags. Returns\nthe raw cursor results including `system_qt`, `counted_qt`, and `delta`\nfor each record.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `inventory:count:read`",
        "operationId": "get_counting_record_inventory_count_record_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "count_session_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by counting session key.",
              "examples": [
                "cnt-session-001"
              ],
              "title": "Count Session Key"
            },
            "description": "Filter by counting session key."
          },
          {
            "name": "user_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by the user who created the count record.",
              "examples": [
                "user/operator-01"
              ],
              "title": "User Key"
            },
            "description": "Filter by the user who created the count record."
          },
          {
            "name": "assignment_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by assignment key.",
              "examples": [
                "assign-001"
              ],
              "title": "Assignment Key"
            },
            "description": "Filter by assignment key."
          },
          {
            "name": "product_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to count records for this product.",
              "examples": [
                "67890"
              ],
              "title": "Product Key"
            },
            "description": "Filter to count records for this product."
          },
          {
            "name": "position_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to count records for this position.",
              "examples": [
                "12345"
              ],
              "title": "Position Key"
            },
            "description": "Filter to count records for this position."
          },
          {
            "name": "include_started",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "Include records in `started` status.",
              "examples": [
                true
              ],
              "default": true,
              "title": "Include Started"
            },
            "description": "Include records in `started` status."
          },
          {
            "name": "include_completed",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "Include records in `completed` status.",
              "examples": [
                true
              ],
              "default": true,
              "title": "Include Completed"
            },
            "description": "Include records in `completed` status."
          },
          {
            "name": "include_discarded",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "Include records in `discarded` status.",
              "examples": [
                true
              ],
              "default": true,
              "title": "Include Discarded"
            },
            "description": "Include records in `discarded` status."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Maximum number of results.",
              "examples": [
                500
              ],
              "default": 500,
              "title": "Limit"
            },
            "description": "Maximum number of results."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Pagination offset.",
              "examples": [
                0
              ],
              "default": 0,
              "title": "Offset"
            },
            "description": "Pagination offset."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "title": "Response Get Counting Record Inventory Count Record Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/inventory/count-position-status": {
      "get": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Get Count Position Status",
        "description": "Get counting completion status for positions in a session, given a parent position key.\n\nReturns a mapping of `{position_key: status}` for all direct child positions\nof `parent_key` that have an `inventory_count_position_complete` edge in the\ngiven session. Positions not yet counted are absent from the result.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `inventory:count:read`",
        "operationId": "get_count_position_status_inventory_count_position_status_get",
        "parameters": [
          {
            "name": "session_key",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Session Key"
            }
          },
          {
            "name": "parent_key",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Parent Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Get Count Position Status Inventory Count Position Status Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/inventory/count-session/{session_key}/completed-positions": {
      "get": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Get Session Completed Positions",
        "description": "Get all position keys fully counted in a session.\n\nQueries the `inventory_count_position_complete` edge collection for all\nrecords whose `_from` matches the given session, returning the `_key` of each\ntarget position. Used by the warehouse UI to render per-position tick marks.\n\n**Emits:** *(direct query \u2014 no event class)*\n**Required scope:** `inventory:count:read`",
        "operationId": "get_session_completed_positions_inventory_count_session__session_key__completed_positions_get",
        "parameters": [
          {
            "name": "session_key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Session Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "title": "Response Get Session Completed Positions Inventory Count Session  Session Key  Completed Positions Get"
                }
              }
            }
          },
          "500": {
            "description": "Database error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/inventory/count-record/import": {
      "post": {
        "tags": [
          "Warehouse"
        ],
        "summary": "Import Count Records",
        "description": "Import count records from a CSV/XLSX file.\n\nTwo modes of operation:\n- dry_run=True: Validate file and return summary. Requires 'file' upload.\n- dry_run=False: Execute import using previously validated file. Requires 'file_key'.\n\nReturns:\n- If errors: annotated Excel file with error details\n- If dry_run=True and valid: file_key + summary for subsequent import\n- If dry_run=False and valid: import result from event\n\n**Emits:** `CountImportedEvent` (execute mode only)\n**Required scope:** `inventory:count:apply`",
        "operationId": "import_count_records_inventory_count_record_import_post",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_import_count_records_inventory_count_record_import_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "description": "Invalid import_mode, missing file/file_key, file parse error, or validation errors"
          },
          "403": {
            "description": "File validated for a different session"
          },
          "404": {
            "description": "Counting session or import file not found"
          },
          "422": {
            "description": "Session not in completed status or file not validated"
          },
          "500": {
            "description": "Database error"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "APIResponse": {
        "properties": {
          "status": {
            "type": "integer",
            "title": "Status",
            "default": 200
          },
          "message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Message"
          },
          "detail": {
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "APIResponse"
      },
      "APIResponse_NoneType_": {
        "properties": {
          "status": {
            "type": "integer",
            "title": "Status",
            "default": 200
          },
          "message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Message"
          },
          "detail": {
            "type": "null",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "APIResponse[NoneType]"
      },
      "APIResponse_Tag_": {
        "properties": {
          "status": {
            "type": "integer",
            "title": "Status",
            "default": 200
          },
          "message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Message"
          },
          "detail": {
            "$ref": "#/components/schemas/Tag"
          }
        },
        "type": "object",
        "title": "APIResponse[Tag]"
      },
      "APIResponse_list_Tag__": {
        "properties": {
          "status": {
            "type": "integer",
            "title": "Status",
            "default": 200
          },
          "message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Message"
          },
          "detail": {
            "items": {
              "$ref": "#/components/schemas/Tag"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "APIResponse[list[Tag]]"
      },
      "Alignment": {
        "type": "string",
        "enum": [
          "center",
          "left",
          "right"
        ],
        "title": "Alignment"
      },
      "AuthAPIResponse": {
        "properties": {
          "status": {
            "type": "integer",
            "title": "Status",
            "default": 200
          },
          "message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Message"
          },
          "detail": {
            "title": "Detail"
          },
          "access_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Access Token"
          },
          "token_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Token Type"
          }
        },
        "type": "object",
        "title": "AuthAPIResponse"
      },
      "BlankPdf": {
        "properties": {
          "width": {
            "type": "number",
            "title": "Width",
            "description": "Page width in millimetres.",
            "examples": [
              210.0
            ]
          },
          "height": {
            "type": "number",
            "title": "Height",
            "description": "Page height in millimetres.",
            "examples": [
              297.0
            ]
          },
          "padding": {
            "items": {
              "type": "number"
            },
            "type": "array",
            "title": "Padding",
            "description": "Page padding [top, right, bottom, left] in millimetres.",
            "default": [
              0,
              0,
              0,
              0
            ],
            "examples": [
              [
                0,
                0,
                0,
                0
              ]
            ]
          }
        },
        "type": "object",
        "required": [
          "width",
          "height"
        ],
        "title": "BlankPdf",
        "description": "pdfme BlankPdf format \u2014 blank page with explicit dimensions in mm."
      },
      "Body_authenticate_user_auth_post": {
        "properties": {
          "grant_type": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^password$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Grant Type"
          },
          "username": {
            "type": "string",
            "title": "Username"
          },
          "password": {
            "type": "string",
            "format": "password",
            "title": "Password"
          },
          "scope": {
            "type": "string",
            "title": "Scope",
            "default": ""
          },
          "client_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Id"
          },
          "client_secret": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "format": "password",
            "title": "Client Secret"
          }
        },
        "type": "object",
        "required": [
          "username",
          "password"
        ],
        "title": "Body_authenticate_user_auth_post"
      },
      "Body_copy_operation_to_phases_operation__operation_key__copy_post": {
        "properties": {
          "target_product_keys": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Target Product Keys"
          }
        },
        "type": "object",
        "required": [
          "target_product_keys"
        ],
        "title": "Body_copy_operation_to_phases_operation__operation_key__copy_post"
      },
      "Body_copy_process_to_products_product__product_key__counter_copy_post": {
        "properties": {
          "target_product_keys": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Target Product Keys"
          }
        },
        "type": "object",
        "required": [
          "target_product_keys"
        ],
        "title": "Body_copy_process_to_products_product__product_key__counter_copy_post"
      },
      "Body_copy_process_to_products_product__product_key__process_copy_post": {
        "properties": {
          "target_product_keys": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Target Product Keys"
          }
        },
        "type": "object",
        "required": [
          "target_product_keys"
        ],
        "title": "Body_copy_process_to_products_product__product_key__process_copy_post"
      },
      "Body_copy_product_product_copy_post": {
        "properties": {
          "original_product": {
            "type": "string",
            "title": "Original Product"
          },
          "new_code": {
            "type": "string",
            "title": "New Code"
          },
          "new_description": {
            "type": "string",
            "title": "New Description"
          },
          "by_code": {
            "type": "boolean",
            "title": "By Code",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "original_product",
          "new_code"
        ],
        "title": "Body_copy_product_product_copy_post"
      },
      "Body_create_counting_session_inventory_count_session_post": {
        "properties": {
          "count_session": {
            "$ref": "#/components/schemas/InventoryCountSession"
          },
          "assignments": {
            "items": {
              "$ref": "#/components/schemas/InventoryCountAssignmentNew"
            },
            "type": "array",
            "title": "Assignments"
          }
        },
        "type": "object",
        "required": [
          "count_session",
          "assignments"
        ],
        "title": "Body_create_counting_session_inventory_count_session_post"
      },
      "Body_create_media_media_create_post": {
        "properties": {
          "file": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "File"
          }
        },
        "type": "object",
        "required": [
          "file"
        ],
        "title": "Body_create_media_media_create_post"
      },
      "Body_create_product_product_post": {
        "properties": {
          "code": {
            "type": "string",
            "title": "Code"
          },
          "description": {
            "type": "string",
            "title": "Description",
            "default": ""
          },
          "image": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "Image"
          },
          "traceability_level": {
            "type": "string",
            "title": "Traceability Level",
            "default": ""
          },
          "counter_key": {
            "type": "string",
            "title": "Counter Key",
            "default": ""
          },
          "manage_inventory": {
            "type": "boolean",
            "title": "Manage Inventory",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "code"
        ],
        "title": "Body_create_product_product_post"
      },
      "Body_delete_counting_assignments_inventory_count_assignment_delete": {
        "properties": {
          "assignment_keys": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Assignment Keys"
          }
        },
        "type": "object",
        "required": [
          "assignment_keys"
        ],
        "title": "Body_delete_counting_assignments_inventory_count_assignment_delete"
      },
      "Body_delete_files_files_delete": {
        "properties": {
          "filenames": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Filenames"
          },
          "bucket": {
            "$ref": "#/components/schemas/FileBucket"
          },
          "object_key": {
            "type": "string",
            "title": "Object Key"
          },
          "subfolder": {
            "type": "string",
            "title": "Subfolder"
          }
        },
        "type": "object",
        "required": [
          "filenames",
          "bucket",
          "object_key"
        ],
        "title": "Body_delete_files_files_delete"
      },
      "Body_import_count_records_inventory_count_record_import_post": {
        "properties": {
          "count_session_key": {
            "type": "string",
            "title": "Count Session Key"
          },
          "import_mode": {
            "type": "string",
            "title": "Import Mode"
          },
          "dry_run": {
            "type": "boolean",
            "title": "Dry Run",
            "default": true
          },
          "file": {
            "anyOf": [
              {
                "type": "string",
                "contentMediaType": "application/octet-stream"
              },
              {
                "type": "null"
              }
            ],
            "title": "File"
          },
          "file_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "File Key"
          }
        },
        "type": "object",
        "required": [
          "count_session_key",
          "import_mode"
        ],
        "title": "Body_import_count_records_inventory_count_record_import_post"
      },
      "Body_replace_product_image_product__product_key__image_put": {
        "properties": {
          "new_image": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "New Image"
          }
        },
        "type": "object",
        "required": [
          "new_image"
        ],
        "title": "Body_replace_product_image_product__product_key__image_put"
      },
      "Body_reset_user_password_user__user_key__password_put": {
        "properties": {
          "new_password": {
            "type": "string",
            "title": "New Password"
          }
        },
        "type": "object",
        "required": [
          "new_password"
        ],
        "title": "Body_reset_user_password_user__user_key__password_put"
      },
      "Body_save_doc_product__product_key__doc_post": {
        "properties": {
          "new_doc": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "New Doc"
          }
        },
        "type": "object",
        "required": [
          "new_doc"
        ],
        "title": "Body_save_doc_product__product_key__doc_post"
      },
      "Body_save_step_media_step__step_key__media_post": {
        "properties": {
          "media_file": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "Media File"
          }
        },
        "type": "object",
        "required": [
          "media_file"
        ],
        "title": "Body_save_step_media_step__step_key__media_post"
      },
      "Body_search_movement_lists_movement_list_get": {
        "properties": {
          "list_key": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "List Key"
          },
          "status": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/MovementStatus"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          }
        },
        "type": "object",
        "title": "Body_search_movement_lists_movement_list_get"
      },
      "Body_start_user_session_session_post": {
        "properties": {
          "user_key": {
            "type": "string",
            "title": "User Key"
          }
        },
        "type": "object",
        "required": [
          "user_key"
        ],
        "title": "Body_start_user_session_session_post"
      },
      "Body_update_config_file_config__key__file_put": {
        "properties": {
          "file": {
            "anyOf": [
              {
                "type": "string",
                "contentMediaType": "application/octet-stream"
              },
              {
                "type": "null"
              }
            ],
            "title": "File"
          }
        },
        "type": "object",
        "title": "Body_update_config_file_config__key__file_put"
      },
      "Body_update_media_media__media_key__patch": {
        "properties": {
          "file": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "File"
          }
        },
        "type": "object",
        "required": [
          "file"
        ],
        "title": "Body_update_media_media__media_key__patch"
      },
      "Body_update_user_image_user__user_key__image_put": {
        "properties": {
          "new_image": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "New Image"
          }
        },
        "type": "object",
        "required": [
          "new_image"
        ],
        "title": "Body_update_user_image_user__user_key__image_put"
      },
      "Body_update_work_order_quantities_work_order__wo_key__update_quantities_patch": {
        "properties": {
          "new_quantity": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "New Quantity"
          },
          "job_updates": {
            "items": {
              "$ref": "#/components/schemas/JobUpdate"
            },
            "type": "array",
            "title": "Job Updates"
          }
        },
        "type": "object",
        "title": "Body_update_work_order_quantities_work_order__wo_key__update_quantities_patch"
      },
      "Body_update_work_order_work_order__wo_key__patch": {
        "properties": {
          "new_due_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "New Due Date"
          },
          "new_from_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "New From Date"
          },
          "new_project_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "New Project Code"
          },
          "new_bom": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/WOBomLine"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "New Bom"
          },
          "new_output_position_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "New Output Position Key"
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notes"
          }
        },
        "type": "object",
        "title": "Body_update_work_order_work_order__wo_key__patch"
      },
      "Body_upload_files_files_post": {
        "properties": {
          "contents": {
            "items": {
              "type": "string",
              "contentMediaType": "application/octet-stream"
            },
            "type": "array",
            "title": "Contents"
          },
          "bucket": {
            "$ref": "#/components/schemas/FileBucket"
          },
          "object_key": {
            "type": "string",
            "title": "Object Key"
          },
          "subfolder": {
            "type": "string",
            "title": "Subfolder"
          },
          "reset_folder": {
            "type": "boolean",
            "title": "Reset Folder",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "contents",
          "bucket",
          "object_key"
        ],
        "title": "Body_upload_files_files_post"
      },
      "Body_verify_user_password_user__user_key__verify_post": {
        "properties": {
          "password": {
            "type": "string",
            "title": "Password"
          }
        },
        "type": "object",
        "required": [
          "password"
        ],
        "title": "Body_verify_user_password_user__user_key__verify_post"
      },
      "BomLineConsumptionOptions": {
        "properties": {
          "consumption_position_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Consumption Position Key",
            "description": "ArangoDB _key of the inventory position from which this component is consumed.",
            "examples": [
              "pos-002"
            ]
          },
          "consumption_position_mandatory": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Consumption Position Mandatory",
            "description": "When true, operators must select a consumption position before recording usage.",
            "default": false,
            "examples": [
              false
            ]
          },
          "minimum_quantity_if_negative": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Minimum Quantity If Negative",
            "description": "Allow consuming below zero inventory when the position would go negative.",
            "default": false,
            "examples": [
              false
            ]
          },
          "minimum_quantity": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Minimum Quantity",
            "description": "Minimum quantity that must be consumed per unit; null means no lower bound.",
            "examples": [
              1.0
            ]
          }
        },
        "type": "object",
        "title": "BomLineConsumptionOptions"
      },
      "BomLineWriteIn": {
        "properties": {
          "bom_line_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bom Line Key",
            "description": "Existing BoM line _key; null for new lines.",
            "examples": [
              "bom-line-001"
            ]
          },
          "component_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Component Key",
            "description": "ArangoDB _key of the component product; required when component_code is not provided.",
            "examples": [
              "prod-002"
            ]
          },
          "component_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Component Code",
            "description": "Product code of the component; used when by_code=true on the endpoint.",
            "examples": [
              "PROD-B-001"
            ]
          },
          "qt": {
            "type": "number",
            "title": "Qt",
            "description": "Required quantity of this component per parent unit.",
            "examples": [
              2.0
            ]
          },
          "phase_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Phase Key",
            "description": "ArangoDB _key of the phase this component is assigned to; null assigns to the last phase.",
            "examples": [
              "phase-001"
            ]
          },
          "type": {
            "type": "string",
            "title": "Type",
            "description": "Edge type stored in the 'requires' collection; always 'BomLine' for BoM lines.",
            "default": "BomLine",
            "examples": [
              "BomLine"
            ]
          },
          "traceability_level": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Traceability Level",
            "description": "Traceability level required for this component.",
            "examples": [
              "form_only"
            ]
          },
          "consumption_options": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BomLineConsumptionOptions"
              },
              {
                "type": "null"
              }
            ],
            "description": "Consumption behaviour options for this BoM line."
          },
          "extra": {
            "title": "Extra",
            "description": "Arbitrary additional data for external integrations.",
            "examples": [
              null
            ]
          }
        },
        "type": "object",
        "required": [
          "qt"
        ],
        "title": "BomLineWriteIn"
      },
      "BulkEventRequest": {
        "properties": {
          "shared_data": {
            "$ref": "#/components/schemas/EventInfoModel"
          },
          "events": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Events"
          }
        },
        "type": "object",
        "required": [
          "shared_data",
          "events"
        ],
        "title": "BulkEventRequest",
        "description": "Request model for bulk event creation. All events must be of the same type."
      },
      "Counter": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name",
            "description": "Human-readable name for this counter sequence. Used to identify the counter in the UI and via the `name` query parameter.",
            "default": "",
            "examples": [
              "Work Order Counter"
            ]
          },
          "next_tick": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Tick",
            "description": "The integer value that will be used on the next counter tick. Automatically incremented after each use.",
            "default": 1,
            "examples": [
              1
            ]
          },
          "template": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Template",
            "description": "Ordered list of template tokens that form the counter string. Tokens are strftime-style date codes (e.g. `%Y`, `%m`, `%d`) or literal strings. Example: `['WO-', '%Y', '-', '%m', '-']` yields `WO-2026-05-`.",
            "examples": [
              [
                "WO-",
                "%Y",
                "-",
                "%m",
                "-"
              ]
            ]
          },
          "frequency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Frequency",
            "description": "Reset frequency for the tick counter. Accepted values: `year`, `month`, `week`, `day`, `none` (or `null` for no reset). The template must include tokens that uniquely identify each reset cycle.",
            "examples": [
              "month"
            ]
          },
          "reset_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reset Date",
            "description": "UTC timestamp of the most recent counter reset. `null` if the counter has never been reset.",
            "examples": [
              "2026-05-01T00:00:00Z"
            ]
          }
        },
        "type": "object",
        "title": "Counter"
      },
      "CustomData": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "value": {
            "title": "Value",
            "description": "The stored value for this custom-data entry. Can be any JSON-serialisable type (string, number, boolean, object, array). Interpretation is left to the consuming application.",
            "examples": [
              "https://erp.example.com/api/v2"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Human-readable description of what this custom-data entry represents and how it is used.",
            "examples": [
              "Base URL of the ERP integration endpoint, used by the sync workflow."
            ]
          }
        },
        "type": "object",
        "required": [
          "value"
        ],
        "title": "CustomData"
      },
      "CustomField": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "type": {
            "$ref": "#/components/schemas/FieldType",
            "description": "Data type of this custom field, determining how it is rendered and validated.",
            "examples": [
              "text"
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "title": "Name",
            "description": "Unique human-readable name used to identify this field and compute its slug.",
            "examples": [
              "Surface Colour"
            ]
          },
          "default_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Default Label",
            "description": "Default label shown to the operator when filling a form; can be overridden per-instance.",
            "examples": [
              "Surface Colour"
            ]
          },
          "default_hint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Default Hint",
            "description": "Default hint text shown below the field input; can be overridden per-instance.",
            "examples": [
              "Select the RAL colour code applied to this part"
            ]
          }
        },
        "type": "object",
        "required": [
          "type",
          "name"
        ],
        "title": "CustomField"
      },
      "CustomListValue": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "field_key": {
            "type": "string",
            "title": "Field Key",
            "description": "ArangoDB _key of the CustomField this list value belongs to.",
            "examples": [
              "cf-001"
            ]
          },
          "ext_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ext Key",
            "description": "Optional external identifier (e.g. ERP code) for this list value.",
            "examples": [
              "ERP-COL-9005"
            ]
          },
          "value": {
            "type": "string",
            "title": "Value",
            "description": "Display value shown to the operator when filling the form.",
            "examples": [
              "RAL 9005 Jet Black"
            ]
          }
        },
        "type": "object",
        "required": [
          "field_key",
          "value"
        ],
        "title": "CustomListValue"
      },
      "DisplayFont": {
        "type": "string",
        "enum": [
          "orbitron",
          "red-hat-display"
        ],
        "title": "DisplayFont"
      },
      "DynamicFontSize": {
        "properties": {
          "fit": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fit",
            "description": "Fit mode for dynamic font sizing (e.g. 'shrink').",
            "examples": [
              "shrink"
            ]
          },
          "max": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max",
            "description": "Maximum font size in points.",
            "examples": [
              12.0
            ]
          },
          "min": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Min",
            "description": "Minimum font size in points.",
            "examples": [
              6.0
            ]
          }
        },
        "type": "object",
        "title": "DynamicFontSize"
      },
      "EventContextType": {
        "type": "string",
        "enum": [
          "task"
        ],
        "title": "EventContextType"
      },
      "EventInfoModel": {
        "properties": {
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "event_type": {
            "$ref": "#/components/schemas/EventType"
          },
          "event_group": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Event Group"
          },
          "primary": {
            "type": "boolean",
            "title": "Primary",
            "default": true
          },
          "context_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Context Type"
          },
          "context_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Context Key"
          },
          "user_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Key"
          },
          "user_session_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Session Key"
          },
          "timestamp": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Timestamp"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          }
        },
        "additionalProperties": true,
        "type": "object",
        "required": [
          "event_type"
        ],
        "title": "EventInfoModel",
        "description": "Event info model to be extended by the event class"
      },
      "EventType": {
        "type": "string",
        "enum": [
          "ACTIVE_BATCH_CHANGED",
          "BATCH_COMPLETED",
          "BATCH_RELEASED",
          "STEP_COMPLETED",
          "STEP_EDITED",
          "JOB_STARTED",
          "JOB_PAUSED",
          "JOB_PAUSE_FORCED",
          "JOB_RESUMED",
          "JOB_CLOSED",
          "ISSUE_CREATED",
          "ISSUE_UPDATED",
          "ISSUE_CLOSED",
          "ISSUE_REOPENED",
          "ISSUE_DELETED",
          "MESSAGE_POSTED",
          "MESSAGE_UPDATED",
          "MESSAGE_DELETED",
          "TASK_CREATED",
          "TASK_UPDATED",
          "TASK_COMPLETED",
          "TASK_CANCELED",
          "TASK_REOPENED",
          "TASK_SUSPENDED",
          "TASK_LINKED",
          "TASK_UNLINKED",
          "BATCH_CREATED",
          "BATCH_CANCELED",
          "JOB_RESET",
          "JOB_PAUSED_OFFLINE",
          "JOB_BACK_ONLINE",
          "PROGRESS_OVERRIDE_REQUESTED",
          "TIME_OVERRIDE_REQUESTED",
          "EXTRA_UPDATE_REQUESTED",
          "SERIAL_BOOKED",
          "SERIAL_CREATED",
          "SERIAL_DELETED",
          "SERIAL_LINKED",
          "SERIAL_UNLINKED",
          "SERIAL_UPDATED",
          "SERIAL_BATCH_CONFIRMED",
          "SERIAL_RELEASED",
          "MOVEMENT_COMPLETED",
          "MOVEMENT_DELETED",
          "INVENTORY_PRODUCED",
          "INVENTORY_CONSUMED",
          "MOVEMENT_CREATED",
          "MOVEMENT_PLANNED",
          "MOVEMENT_UPDATED",
          "MOVEMENT_REVERSED",
          "MOVEMENT_CANCELED",
          "INVENTORY_CHANGED",
          "WAREHOUSE_LIST_CLOSED",
          "WAREHOUSE_LIST_CREATED",
          "ASSIGNMENT_STARTED",
          "ASSIGNMENT_COMPLETED",
          "COUNT_STARTED",
          "COUNT_COMPLETED",
          "COUNT_CANCELED",
          "COUNT_DISCARDED",
          "COUNT_IMPORTED",
          "COUNT_APPLIED",
          "COUNT_SESSION_STARTED",
          "COUNT_SESSION_COMPLETED",
          "COUNT_SESSION_RESUMED",
          "COUNT_SESSION_APPLIED",
          "COUNT_SESSION_CONFIRMED",
          "POSITION_CONFIRMED_EMPTY",
          "WORK_ORDER_CREATED",
          "WORK_ORDER_CLOSED",
          "WORK_ORDER_STARTED",
          "WORK_ORDER_UPDATED",
          "WORK_ORDER_CANCELED",
          "WORK_SESSION_STARTED",
          "WORK_SESSION_CLOSED",
          "WORK_SESSION_CREATED",
          "WORK_SESSION_CANCELED",
          "WIP_BOOKED",
          "WIP_UNBOOKED",
          "WIP_REMOVED",
          "WIP_DECLARED",
          "QUEUE_UPDATED"
        ],
        "title": "EventType"
      },
      "ExecutionDataUpdate": {
        "properties": {
          "step_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Step Key",
            "description": "Key of the step to update. Required when `execution_record_key` is not provided.",
            "examples": [
              "step/quality-check-01"
            ]
          },
          "batch_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Batch Key",
            "description": "Key of the batch. Required when `execution_record_key` is not provided.",
            "examples": [
              "BATCH-A-042"
            ]
          },
          "execution_record_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Execution Record Key",
            "description": "Key of an existing `StepExecutionData` record to update directly.",
            "examples": [
              "exec-record-001"
            ]
          },
          "form_data": {
            "items": {
              "$ref": "#/components/schemas/FormFieldValue"
            },
            "type": "array",
            "title": "Form Data",
            "description": "Form field values to merge into the existing or new execution record.",
            "default": [],
            "examples": [
              []
            ]
          }
        },
        "type": "object",
        "title": "ExecutionDataUpdate"
      },
      "FieldType": {
        "type": "string",
        "enum": [
          "text",
          "number",
          "boolean",
          "ternary",
          "choice",
          "date",
          "time",
          "files",
          "separator"
        ],
        "title": "FieldType"
      },
      "FileBucket": {
        "type": "string",
        "enum": [
          "issue",
          "product",
          "step",
          "traceability",
          "user",
          "serial",
          "task"
        ],
        "title": "FileBucket"
      },
      "FormFieldDefinition": {
        "properties": {
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key",
            "description": "ArangoDB _key of this form field definition instance.",
            "examples": [
              "ffd-001"
            ]
          },
          "custom_field_key": {
            "type": "string",
            "title": "Custom Field Key",
            "description": "ArangoDB _key of the CustomField definition this instance is linked to.",
            "examples": [
              "cf-001"
            ]
          },
          "multiple": {
            "type": "boolean",
            "title": "Multiple",
            "description": "When true, the operator can select or enter multiple values for this field.",
            "default": false,
            "examples": [
              false
            ]
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label",
            "description": "Label override for this form field instance; falls back to CustomField.default_label.",
            "examples": [
              "Colour Code"
            ]
          },
          "hint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hint",
            "description": "Hint text override for this instance; falls back to CustomField.default_hint.",
            "examples": [
              "Verify against approved colour chart"
            ]
          },
          "default": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Default",
            "description": "Default value pre-populated in the field; must be parseable to the field type. Required when hidden=true.",
            "examples": [
              "pass"
            ]
          },
          "mandatory": {
            "type": "boolean",
            "title": "Mandatory",
            "description": "When true, the operator must fill this field before completing the step.",
            "default": false,
            "examples": [
              false
            ]
          },
          "hidden": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hidden",
            "description": "When true, the field is hidden from the operator and filled automatically from default.",
            "examples": [
              false
            ]
          }
        },
        "type": "object",
        "required": [
          "custom_field_key"
        ],
        "title": "FormFieldDefinition"
      },
      "FormFieldValue": {
        "properties": {
          "form_field_key": {
            "type": "string",
            "title": "Form Field Key",
            "description": "ArangoDB _key of the FormFieldDefinition this value corresponds to.",
            "examples": [
              "ffd-001"
            ]
          },
          "custom_field_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Custom Field Key",
            "description": "ArangoDB _key of the CustomField definition; duplicated from FormFieldDefinition for read performance.",
            "examples": [
              "cf-001"
            ]
          },
          "value": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "title": "Value",
            "description": "Recorded value for this field instance; type depends on the associated FieldType.",
            "examples": [
              "RAL 9005"
            ]
          }
        },
        "type": "object",
        "required": [
          "form_field_key"
        ],
        "title": "FormFieldValue"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "HomePageOptions": {
        "type": "string",
        "enum": [
          "adminPanel",
          "libraryRoot",
          "productionRoot",
          "operatorRoot",
          "qualityRoot",
          "taskRoot",
          "reportRoot",
          "warehouseRoot"
        ],
        "title": "HomePageOptions"
      },
      "InventoryCountAssignment": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "inventory_count_session_key": {
            "type": "string",
            "title": "Inventory Count Session Key",
            "description": "Key of the parent counting session.",
            "examples": [
              "cnt-session-001"
            ]
          },
          "target_type": {
            "$ref": "#/components/schemas/InventoryCountSessionType",
            "description": "Whether this assignment targets a position or product.",
            "examples": [
              "position"
            ]
          },
          "target_key": {
            "type": "string",
            "title": "Target Key",
            "description": "Key of the target position or product.",
            "examples": [
              "12345"
            ]
          },
          "assigned_to": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Assigned To",
            "description": "User key of the operator responsible for this assignment.",
            "examples": [
              "user/operator-01"
            ]
          },
          "status": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/InventoryCountAssignmentStatus"
              },
              {
                "type": "null"
              }
            ],
            "description": "Current status of the assignment.",
            "default": "planned",
            "examples": [
              "planned"
            ]
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "title": "Created",
            "description": "Timestamp when the assignment was created.",
            "examples": [
              "2026-05-15T10:00:00Z"
            ]
          },
          "created_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By",
            "description": "User key of the operator who created the assignment.",
            "examples": [
              "user/manager-01"
            ]
          },
          "started": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started",
            "description": "Timestamp when the operator started counting.",
            "examples": [
              "2026-05-20T08:10:00Z"
            ]
          },
          "completed": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed",
            "description": "Timestamp when the assignment was marked complete.",
            "examples": [
              "2026-05-20T09:30:00Z"
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notes",
            "description": "Free-text notes for this assignment.",
            "examples": [
              "Double-check rack 3"
            ]
          },
          "extra": {
            "title": "Extra",
            "description": "Arbitrary extra metadata.",
            "examples": [
              null
            ]
          }
        },
        "type": "object",
        "required": [
          "inventory_count_session_key",
          "target_type",
          "target_key"
        ],
        "title": "InventoryCountAssignment"
      },
      "InventoryCountAssignmentNew": {
        "properties": {
          "user_key": {
            "type": "string",
            "title": "User Key",
            "description": "Key of the user to assign this counting task to.",
            "examples": [
              "user/operator-01"
            ]
          },
          "target_keys": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Target Keys",
            "description": "List of position or product keys to assign, depending on the session type.",
            "examples": [
              [
                "12345",
                "67890"
              ]
            ]
          }
        },
        "type": "object",
        "required": [
          "user_key",
          "target_keys"
        ],
        "title": "InventoryCountAssignmentNew"
      },
      "InventoryCountAssignmentStatus": {
        "type": "string",
        "enum": [
          "planned",
          "started",
          "completed",
          "canceled"
        ],
        "title": "InventoryCountAssignmentStatus"
      },
      "InventoryCountSession": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Code",
            "description": "Auto-generated session code (e.g. from a counter) if not provided by the user.",
            "examples": [
              "CNT-2026-001"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Human-readable description of the counting session scope.",
            "examples": [
              "Annual full-warehouse count Q2 2026"
            ]
          },
          "type": {
            "$ref": "#/components/schemas/InventoryCountSessionType",
            "description": "Counting dimension: `position` (count by storage location) or `product` (count by product).",
            "examples": [
              "position"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/InventoryCountSessionStatus",
            "description": "Current lifecycle status of the session.",
            "default": "planned",
            "examples": [
              "planned"
            ]
          },
          "blind_quantities": {
            "type": "boolean",
            "title": "Blind Quantities",
            "description": "If True, expected quantities are hidden from operators during counting.",
            "default": true,
            "examples": [
              true
            ]
          },
          "blind_serials": {
            "type": "boolean",
            "title": "Blind Serials",
            "description": "If True, expected serial numbers are hidden from operators during counting.",
            "default": true,
            "examples": [
              true
            ]
          },
          "coverage_percentage": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Coverage Percentage",
            "description": "Calculated field: percentage of inventory items covered by this session's assignments.",
            "examples": [
              100.0
            ]
          },
          "scheduled_start": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Scheduled Start",
            "description": "Planned start datetime for the counting session.",
            "examples": [
              "2026-05-20T08:00:00Z"
            ]
          },
          "scheduled_end": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Scheduled End",
            "description": "Planned end datetime for the counting session.",
            "examples": [
              "2026-05-20T18:00:00Z"
            ]
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "title": "Created",
            "description": "Timestamp when the session was created.",
            "examples": [
              "2026-05-15T10:00:00Z"
            ]
          },
          "created_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By",
            "description": "User key of the operator who created the session.",
            "examples": [
              "user/operator-01"
            ]
          },
          "started": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started",
            "description": "Timestamp when the first assignment was started.",
            "examples": [
              "2026-05-20T08:05:00Z"
            ]
          },
          "completed": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed",
            "description": "Timestamp when the session was marked as completed (all assignments done).",
            "examples": [
              "2026-05-20T17:45:00Z"
            ]
          },
          "baseline_snapshot_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Baseline Snapshot Key",
            "description": "Key of the `InventorySnapshot` capturing the pre-count inventory state.",
            "examples": [
              "snap-001"
            ]
          },
          "post_count_snapshot_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Post Count Snapshot Key",
            "description": "Key of the `InventorySnapshot` capturing the post-count inventory state.",
            "examples": [
              "snap-002"
            ]
          },
          "post_adjustment_snapshot_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Post Adjustment Snapshot Key",
            "description": "Key of the `InventorySnapshot` capturing inventory state after adjustments were applied.",
            "examples": [
              "snap-003"
            ]
          },
          "adjustment_list_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Adjustment List Key",
            "description": "Key of the `MovementList` generated by the count application to reconcile discrepancies.",
            "examples": [
              "mvtlist-001"
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notes",
            "description": "Free-text notes for the counting session.",
            "examples": [
              "Verify all rows in zone A before zone B"
            ]
          },
          "extra": {
            "title": "Extra",
            "description": "Arbitrary extra metadata.",
            "examples": [
              null
            ]
          }
        },
        "type": "object",
        "required": [
          "type"
        ],
        "title": "InventoryCountSession"
      },
      "InventoryCountSessionStatus": {
        "type": "string",
        "enum": [
          "planned",
          "started",
          "completed",
          "processing",
          "applied",
          "canceled"
        ],
        "title": "InventoryCountSessionStatus"
      },
      "InventoryCountSessionType": {
        "type": "string",
        "enum": [
          "position",
          "product"
        ],
        "title": "InventoryCountSessionType"
      },
      "InventoryCountSessionUpdate": {
        "properties": {
          "code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Code",
            "description": "New session code (only editable while in `planned` status).",
            "examples": [
              "CNT-2026-002"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Updated description.",
            "examples": [
              "Updated scope: zones A and B only"
            ]
          },
          "type": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/InventoryCountSessionType"
              },
              {
                "type": "null"
              }
            ],
            "description": "Counting dimension (only editable while in `planned` status).",
            "examples": [
              "position"
            ]
          },
          "blind_quantities": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Blind Quantities",
            "description": "Updated blind quantities setting (only editable while in `planned` status).",
            "examples": [
              false
            ]
          },
          "blind_serials": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Blind Serials",
            "description": "Updated blind serials setting (only editable while in `planned` status).",
            "examples": [
              false
            ]
          },
          "scheduled_start": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Scheduled Start",
            "description": "Updated scheduled start (only editable while in `planned` status).",
            "examples": [
              "2026-05-21T08:00:00Z"
            ]
          },
          "scheduled_end": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Scheduled End",
            "description": "Updated scheduled end.",
            "examples": [
              "2026-05-21T18:00:00Z"
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notes",
            "description": "Updated notes.",
            "examples": [
              "Prioritise zone A"
            ]
          }
        },
        "type": "object",
        "title": "InventoryCountSessionUpdate"
      },
      "InventoryMovementReferences": {
        "properties": {
          "work_order_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Work Order Key",
            "description": "Key of the work order that triggered this movement.",
            "examples": [
              "WO-2026-001"
            ]
          },
          "job_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Job Key",
            "description": "Key of the job that triggered this movement.",
            "examples": [
              "job/job-2026-001"
            ]
          },
          "batch_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Batch Key",
            "description": "Key of the production batch associated with this movement.",
            "examples": [
              "BATCH-A-042"
            ]
          },
          "origin_movement_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Origin Movement Key",
            "description": "Key of the original movement that this record reverses or splits.",
            "examples": [
              "mvt-001"
            ]
          },
          "transfer_doc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Transfer Doc",
            "description": "External transfer document reference.",
            "examples": [
              "TRF-2026-0042"
            ]
          },
          "sales_doc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sales Doc",
            "description": "External sales document reference (e.g. delivery note).",
            "examples": [
              "DN-2026-0042"
            ]
          },
          "purchase_doc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Purchase Doc",
            "description": "External purchase document reference (e.g. goods receipt).",
            "examples": [
              "GR-2026-0042"
            ]
          },
          "partner_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Partner Name",
            "description": "Name of the supplier or customer involved.",
            "examples": [
              "Acme Supplies Ltd"
            ]
          },
          "partner_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Partner Code",
            "description": "Code of the supplier or customer involved.",
            "examples": [
              "ACME-001"
            ]
          },
          "inventory_count_session_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Inventory Count Session Key",
            "description": "Key of the count session that generated this adjustment movement.",
            "examples": [
              "cnt-session-001"
            ]
          }
        },
        "type": "object",
        "title": "InventoryMovementReferences"
      },
      "InventoryMovementSearchResults": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "_from": {
            "type": "string",
            "title": "From",
            "description": "ArangoDB document ID of the source position (`Position/<key>`).",
            "examples": [
              "Position/12345"
            ]
          },
          "_to": {
            "type": "string",
            "title": "To",
            "description": "ArangoDB document ID of the destination position (`Position/<key>`).",
            "examples": [
              "Position/67890"
            ]
          },
          "type": {
            "$ref": "#/components/schemas/InventoryMovementType",
            "description": "Type of inventory movement.",
            "examples": [
              "transfer"
            ]
          },
          "product_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Product Key",
            "description": "Key of the product.",
            "examples": [
              "67890"
            ]
          },
          "serial_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Serial Key",
            "description": "Key of the serial number.",
            "examples": [
              "SN-LR-001234"
            ]
          },
          "qt_planned": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Qt Planned",
            "description": "Planned quantity.",
            "examples": [
              100.0
            ]
          },
          "qt_confirmed": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Qt Confirmed",
            "description": "Confirmed quantity.",
            "examples": [
              100.0
            ]
          },
          "status": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MovementStatus"
              },
              {
                "type": "null"
              }
            ],
            "description": "Current status of the movement.",
            "default": "planned",
            "examples": [
              "completed"
            ]
          },
          "created": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created",
            "description": "Timestamp when the movement was created.",
            "examples": [
              "2026-05-15T10:00:00Z"
            ]
          },
          "start": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start",
            "description": "Timestamp when the movement was started.",
            "examples": [
              "2026-05-15T10:00:00Z"
            ]
          },
          "end": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "End",
            "description": "Timestamp when the movement was completed.",
            "examples": [
              "2026-05-15T10:05:00Z"
            ]
          },
          "inverse_movement_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Inverse Movement Key",
            "description": "Key of the reversal movement that cancels this movement.",
            "examples": [
              "mvt-reversal-001"
            ]
          },
          "movement_list_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Movement List Key",
            "description": "Key of the `MovementList` this movement belongs to.",
            "examples": [
              "mvtlist-001"
            ]
          },
          "movement_list_item": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Movement List Item",
            "description": "Row number within the movement list.",
            "examples": [
              1.0
            ]
          },
          "references": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/InventoryMovementReferences"
              },
              {
                "type": "null"
              }
            ],
            "description": "External document references.",
            "examples": [
              null
            ]
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason",
            "description": "Free-text reason for the movement.",
            "examples": [
              "Annual stock adjustment"
            ]
          },
          "user_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Key",
            "description": "Key of the user who performed the movement.",
            "examples": [
              "user/operator-01"
            ]
          },
          "extra": {
            "title": "Extra",
            "description": "Arbitrary extra metadata.",
            "examples": [
              null
            ]
          },
          "position_from_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Position From Key",
            "description": "Key of the source position.",
            "examples": [
              "12345"
            ]
          },
          "position_from_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Position From Code",
            "description": "Code of the source position.",
            "examples": [
              "WAREHOUSE-A"
            ]
          },
          "position_to_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Position To Key",
            "description": "Key of the destination position.",
            "examples": [
              "67890"
            ]
          },
          "position_to_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Position To Code",
            "description": "Code of the destination position.",
            "examples": [
              "LOCATION-B2-03"
            ]
          },
          "movement_list_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Movement List Code",
            "description": "Code of the movement list this movement belongs to.",
            "examples": [
              "LIST-2026-001"
            ]
          },
          "product_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Product Code",
            "description": "Code of the product.",
            "examples": [
              "PROD-001"
            ]
          },
          "product_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Product Description",
            "description": "Description of the product.",
            "examples": [
              "Steel bracket M6"
            ]
          },
          "serial_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Serial Code",
            "description": "Code of the serial number.",
            "examples": [
              "SN-LR-001234"
            ]
          }
        },
        "type": "object",
        "required": [
          "_from",
          "_to",
          "type"
        ],
        "title": "InventoryMovementSearchResults"
      },
      "InventoryMovementType": {
        "type": "string",
        "enum": [
          "transfer",
          "receipt",
          "shipment",
          "production",
          "consumption",
          "adjustment",
          "reversal"
        ],
        "title": "InventoryMovementType"
      },
      "InventoryPathItem": {
        "properties": {
          "position_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Position Key",
            "description": "Key of a position in the path from root to the current position.",
            "examples": [
              "12345"
            ]
          },
          "position_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Position Code",
            "description": "Human-readable code of the position in the path.",
            "examples": [
              "WAREHOUSE-A"
            ]
          }
        },
        "type": "object",
        "title": "InventoryPathItem"
      },
      "InventorySearchResult": {
        "properties": {
          "_key": {
            "type": "string",
            "title": "Key",
            "description": "Key of the `is_in_position` edge (inventory record).",
            "examples": [
              "inv-edge-001"
            ]
          },
          "product_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Product Code",
            "description": "Code of the product at this inventory slot.",
            "examples": [
              "PROD-001"
            ]
          },
          "product_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Product Description",
            "description": "Description of the product.",
            "examples": [
              "Steel bracket M6"
            ]
          },
          "position_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Position Code",
            "description": "Code of the storage position.",
            "examples": [
              "LOCATION-A1-01"
            ]
          },
          "path": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/InventoryPathItem"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Path",
            "description": "Path of positions from the warehouse root to this position.",
            "default": [],
            "examples": [
              []
            ]
          },
          "serial_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Serial Code",
            "description": "Serial number code if this is a serialized inventory slot.",
            "examples": [
              "SN-LR-001234"
            ]
          },
          "serial_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Serial Key",
            "description": "Key of the serial document.",
            "examples": [
              "SN-LR-001234"
            ]
          },
          "product_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Product Key",
            "description": "Key of the product document.",
            "examples": [
              "67890"
            ]
          },
          "position_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Position Key",
            "description": "Key of the position document.",
            "examples": [
              "12345"
            ]
          },
          "quantity": {
            "type": "number",
            "title": "Quantity",
            "description": "Quantity held at this position.",
            "examples": [
              42.5
            ]
          },
          "owned": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owned",
            "description": "False if this is consignment stock.",
            "default": true,
            "examples": [
              true
            ]
          },
          "value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Value",
            "description": "Monetary value of this inventory slot.",
            "examples": [
              1062.5
            ]
          },
          "reference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reference",
            "description": "External reference associated with this inventory slot.",
            "examples": [
              "WO-2026-001"
            ]
          },
          "extra": {
            "title": "Extra",
            "description": "Arbitrary extra metadata.",
            "examples": [
              null
            ]
          }
        },
        "type": "object",
        "required": [
          "_key",
          "quantity"
        ],
        "title": "InventorySearchResult"
      },
      "IssueType": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Human-readable name for this issue type, shown in the UI.",
            "examples": [
              "Inspection Failure"
            ]
          },
          "code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Code",
            "description": "Short alphanumeric code used to identify the issue type in reports and forms.",
            "examples": [
              "INSP-FAIL"
            ]
          },
          "active": {
            "type": "boolean",
            "title": "Active",
            "description": "Whether this issue type is available for selection when creating new issues.",
            "default": true,
            "examples": [
              true
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Extended description of the issue type, explaining when it should be used.",
            "examples": [
              "Used when an inspection step fails due to dimensional non-conformance."
            ]
          },
          "icon": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Icon",
            "description": "Icon identifier string used by the frontend to render a visual cue for this type.",
            "examples": [
              "warning"
            ]
          },
          "form_template": {
            "items": {
              "$ref": "#/components/schemas/FormFieldDefinition"
            },
            "type": "array",
            "title": "Form Template",
            "description": "Ordered list of form field definitions that must be filled when creating an issue of this type."
          },
          "critical": {
            "type": "boolean",
            "title": "Critical",
            "description": "Whether issues of this type are automatically flagged as critical on creation.",
            "default": false,
            "examples": [
              false
            ]
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "IssueType"
      },
      "IssueTypeFull": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Human-readable name for this issue type, shown in the UI.",
            "examples": [
              "Inspection Failure"
            ]
          },
          "code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Code",
            "description": "Short alphanumeric code used to identify the issue type in reports and forms.",
            "examples": [
              "INSP-FAIL"
            ]
          },
          "active": {
            "type": "boolean",
            "title": "Active",
            "description": "Whether this issue type is available for selection when creating new issues.",
            "default": true,
            "examples": [
              true
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Extended description of the issue type, explaining when it should be used.",
            "examples": [
              "Used when an inspection step fails due to dimensional non-conformance."
            ]
          },
          "icon": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Icon",
            "description": "Icon identifier string used by the frontend to render a visual cue for this type.",
            "examples": [
              "warning"
            ]
          },
          "form_template": {
            "items": {
              "$ref": "#/components/schemas/FormFieldDefinition"
            },
            "type": "array",
            "title": "Form Template",
            "description": "Ordered list of form field definitions that must be filled when creating an issue of this type."
          },
          "critical": {
            "type": "boolean",
            "title": "Critical",
            "description": "Whether issues of this type are automatically flagged as critical on creation.",
            "default": false,
            "examples": [
              false
            ]
          },
          "print_templates": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/PrintTemplateRecord-Output"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Print Templates",
            "description": "Print templates associated with this issue type."
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "IssueTypeFull"
      },
      "IssueTypeUpdate": {
        "properties": {
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key",
            "description": "ArangoDB document key of the issue type to update.",
            "examples": [
              "issuetype_001"
            ]
          },
          "code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Code",
            "description": "Updated short code for the issue type.",
            "examples": [
              "INSP-FAIL"
            ]
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name",
            "description": "Updated display name for the issue type.",
            "examples": [
              "Inspection Failure"
            ]
          },
          "active": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Active",
            "description": "Set to `false` to archive the issue type without deleting it.",
            "examples": [
              true
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Updated description for the issue type.",
            "examples": [
              "Used when an inspection step fails due to dimensional non-conformance."
            ]
          },
          "icon": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Icon",
            "description": "Updated icon identifier.",
            "examples": [
              "warning"
            ]
          },
          "form_template": {
            "items": {
              "$ref": "#/components/schemas/FormFieldDefinition"
            },
            "type": "array",
            "title": "Form Template",
            "description": "Replacement form template for this issue type. Replaces the existing template entirely."
          },
          "critical": {
            "type": "boolean",
            "title": "Critical",
            "description": "Whether issues of this type are automatically flagged as critical.",
            "default": false,
            "examples": [
              false
            ]
          }
        },
        "type": "object",
        "title": "IssueTypeUpdate"
      },
      "JobSelectionLayout": {
        "type": "string",
        "enum": [
          "card",
          "list"
        ],
        "title": "JobSelectionLayout"
      },
      "JobUpdate": {
        "properties": {
          "action": {
            "$ref": "#/components/schemas/JobUpdateType",
            "description": "The operation to perform on the job: insert, update, or close.",
            "examples": [
              "update"
            ]
          },
          "data": {
            "additionalProperties": true,
            "type": "object",
            "title": "Data",
            "description": "Payload dict for the action. Must contain '_key' for update/close; must contain 'phase_key' and 'qt_planned' for insert."
          }
        },
        "type": "object",
        "required": [
          "action",
          "data"
        ],
        "title": "JobUpdate"
      },
      "JobUpdateType": {
        "type": "string",
        "enum": [
          "insert",
          "update",
          "close"
        ],
        "title": "JobUpdateType"
      },
      "KPIWindowType": {
        "type": "string",
        "enum": [
          "time",
          "count"
        ],
        "title": "KPIWindowType"
      },
      "LinkType": {
        "type": "string",
        "enum": [
          "none",
          "preset",
          "custom_field",
          "template_expression",
          "computed"
        ],
        "title": "LinkType"
      },
      "Media": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Original filename of the uploaded media file.",
            "examples": [
              "weld-diagram.png"
            ]
          },
          "size": {
            "type": "integer",
            "title": "Size",
            "description": "File size in bytes.",
            "examples": [
              204800
            ]
          },
          "content_type": {
            "type": "string",
            "title": "Content Type",
            "description": "MIME type of the media file.",
            "examples": [
              "image/png"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At",
            "description": "UTC timestamp when the media record was created.",
            "examples": [
              "2026-01-15T08:30:00"
            ]
          }
        },
        "type": "object",
        "required": [
          "name",
          "size",
          "content_type"
        ],
        "title": "Media"
      },
      "Message": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "_from": {
            "type": "string",
            "title": "From",
            "description": "Document ID of the entity that sent this message (e.g. `User/user42`).",
            "examples": [
              "User/user42"
            ]
          },
          "_to": {
            "type": "string",
            "title": "To",
            "description": "Document ID of the recipient entity \u2014 typically an `Issue` or `User` document ID.",
            "examples": [
              "Issue/issue_001"
            ]
          },
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Content",
            "description": "Plain-text or markdown body of the message.",
            "examples": [
              "Inspection failed at step 3 \u2014 dimensional check out of tolerance."
            ]
          },
          "created": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created",
            "description": "UTC timestamp at which the message was posted.",
            "examples": [
              "2026-05-04T10:00:00Z"
            ]
          },
          "updated": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated",
            "description": "UTC timestamp of the most recent edit, or `null` if never edited.",
            "examples": [
              "2026-05-04T10:05:00Z"
            ]
          },
          "deleted": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deleted",
            "description": "UTC timestamp at which the message was soft-deleted, or `null` if still active.",
            "examples": [
              null
            ]
          }
        },
        "type": "object",
        "required": [
          "_from",
          "_to"
        ],
        "title": "Message"
      },
      "MovementListWithCounts": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "code": {
            "type": "string",
            "title": "Code",
            "description": "Unique movement list code (uppercase enforced).",
            "examples": [
              "LIST-2026-001"
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notes",
            "description": "Free-text notes for the movement list.",
            "examples": [
              "Replenishment from supplier WH"
            ]
          },
          "due_by": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Due By",
            "description": "Target completion date for the list.",
            "examples": [
              "2026-05-20"
            ]
          },
          "created": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created",
            "description": "Timestamp when the list was created.",
            "examples": [
              "2026-05-15T10:00:00Z"
            ]
          },
          "start": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start",
            "description": "Timestamp when the first movement in the list was started.",
            "examples": [
              "2026-05-15T10:00:00Z"
            ]
          },
          "end": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "End",
            "description": "Timestamp when the last movement in the list was completed.",
            "examples": [
              "2026-05-15T12:00:00Z"
            ]
          },
          "status": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MovementStatus"
              },
              {
                "type": "null"
              }
            ],
            "description": "Aggregate status of the movement list.",
            "default": "planned",
            "examples": [
              "planned"
            ]
          },
          "extra": {
            "title": "Extra",
            "description": "Arbitrary extra metadata.",
            "examples": [
              null
            ]
          },
          "references": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/InventoryMovementReferences"
              },
              {
                "type": "null"
              }
            ],
            "description": "External references shared by all movements in the list.",
            "examples": [
              null
            ]
          },
          "type": {
            "$ref": "#/components/schemas/InventoryMovementType",
            "description": "Type of movements in this list (all movements must match).",
            "examples": [
              "transfer"
            ]
          },
          "counts": {
            "additionalProperties": {
              "type": "integer"
            },
            "propertyNames": {
              "$ref": "#/components/schemas/MovementStatus"
            },
            "type": "object",
            "title": "Counts",
            "description": "Aggregated count of movements per status.",
            "examples": [
              {
                "completed": 7,
                "planned": 3
              }
            ]
          }
        },
        "type": "object",
        "required": [
          "code",
          "type",
          "counts"
        ],
        "title": "MovementListWithCounts"
      },
      "MovementStatus": {
        "type": "string",
        "enum": [
          "planned",
          "started",
          "completed",
          "canceled"
        ],
        "title": "MovementStatus"
      },
      "Operation": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Human-readable name for this operation template.",
            "examples": [
              "Surface Inspection"
            ]
          },
          "code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Code",
            "description": "Optional short code identifying this operation.",
            "examples": [
              "OP-INSPECT-01"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Detailed description of the operation purpose and scope.",
            "examples": [
              "Visual and dimensional inspection of machined surfaces."
            ]
          },
          "default_phase_parameters": {
            "$ref": "#/components/schemas/PhaseParameters",
            "description": "Default phase execution parameters applied when this operation is assigned to a product phase."
          },
          "default_phase_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Default Phase Notes",
            "description": "Default production notes pre-populated on phases using this operation.",
            "examples": [
              "Refer to drawing REV-C for tolerance callouts."
            ]
          },
          "default_phase_steps": {
            "items": {
              "$ref": "#/components/schemas/StepWithMediaInfo"
            },
            "type": "array",
            "title": "Default Phase Steps",
            "description": "Default step sequence copied to product phases when this operation is applied.",
            "default": [],
            "examples": [
              []
            ]
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "Operation"
      },
      "OperatorQueueUpdateInput": {
        "properties": {
          "jobs": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Jobs",
            "description": "New ordered list of job keys for the operator's queue.",
            "examples": [
              [
                "job-00123",
                "job-00456"
              ]
            ]
          },
          "independent": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Independent",
            "description": "When False, the operator queue will be reordered to match the global work order sequence.",
            "examples": [
              false
            ]
          }
        },
        "type": "object",
        "title": "OperatorQueueUpdateInput"
      },
      "PhaseData-Input": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "alias": {
            "type": "string",
            "title": "Alias",
            "description": "Human-readable name for this phase in the context of its product.",
            "examples": [
              "Assembly"
            ]
          },
          "product_key": {
            "type": "string",
            "title": "Product Key",
            "description": "ArangoDB _key of the product this phase belongs to.",
            "examples": [
              "prod-001"
            ]
          },
          "operation_key": {
            "type": "string",
            "title": "Operation Key",
            "description": "ArangoDB _key of the Operation template this phase is based on.",
            "examples": [
              "op-001"
            ]
          },
          "params": {
            "$ref": "#/components/schemas/PhaseParameters",
            "description": "Phase execution parameters that override the operation defaults for this specific product."
          },
          "step_sequence": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": "array",
            "title": "Step Sequence",
            "description": "Ordered list of Step _keys defining the step execution order for this phase.",
            "default": [],
            "examples": [
              [
                "step-001",
                "step-002"
              ]
            ]
          },
          "production_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Production Notes",
            "description": "Free-text production notes displayed to operators during this phase.",
            "examples": [
              "Verify torque values before proceeding to next phase."
            ]
          },
          "steps": {
            "items": {
              "$ref": "#/components/schemas/Step-Input"
            },
            "type": "array",
            "title": "Steps",
            "description": "Fully resolved Step objects for this phase, ordered by step_sequence.",
            "default": [],
            "examples": [
              []
            ]
          },
          "print_templates": {
            "items": {
              "$ref": "#/components/schemas/PrintTemplateRecord-Input"
            },
            "type": "array",
            "title": "Print Templates",
            "description": "Print templates available at the phase level.",
            "default": [],
            "examples": [
              []
            ]
          }
        },
        "type": "object",
        "required": [
          "alias",
          "product_key",
          "operation_key"
        ],
        "title": "PhaseData"
      },
      "PhaseData-Output": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "alias": {
            "type": "string",
            "title": "Alias",
            "description": "Human-readable name for this phase in the context of its product.",
            "examples": [
              "Assembly"
            ]
          },
          "product_key": {
            "type": "string",
            "title": "Product Key",
            "description": "ArangoDB _key of the product this phase belongs to.",
            "examples": [
              "prod-001"
            ]
          },
          "operation_key": {
            "type": "string",
            "title": "Operation Key",
            "description": "ArangoDB _key of the Operation template this phase is based on.",
            "examples": [
              "op-001"
            ]
          },
          "params": {
            "$ref": "#/components/schemas/PhaseParameters",
            "description": "Phase execution parameters that override the operation defaults for this specific product."
          },
          "step_sequence": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": "array",
            "title": "Step Sequence",
            "description": "Ordered list of Step _keys defining the step execution order for this phase.",
            "default": [],
            "examples": [
              [
                "step-001",
                "step-002"
              ]
            ]
          },
          "production_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Production Notes",
            "description": "Free-text production notes displayed to operators during this phase.",
            "examples": [
              "Verify torque values before proceeding to next phase."
            ]
          },
          "steps": {
            "items": {
              "$ref": "#/components/schemas/Step-Output"
            },
            "type": "array",
            "title": "Steps",
            "description": "Fully resolved Step objects for this phase, ordered by step_sequence.",
            "default": [],
            "examples": [
              []
            ]
          },
          "print_templates": {
            "items": {
              "$ref": "#/components/schemas/PrintTemplateRecord-Output"
            },
            "type": "array",
            "title": "Print Templates",
            "description": "Print templates available at the phase level.",
            "default": [],
            "examples": [
              []
            ]
          }
        },
        "type": "object",
        "required": [
          "alias",
          "product_key",
          "operation_key"
        ],
        "title": "PhaseData"
      },
      "PhaseParameters": {
        "properties": {
          "parallel_job_allowed": {
            "type": "boolean",
            "title": "Parallel Job Allowed",
            "description": "Allow multiple jobs to run simultaneously on this phase.",
            "default": true,
            "examples": [
              true
            ]
          },
          "step_check": {
            "type": "boolean",
            "title": "Step Check",
            "description": "Require operators to complete all steps before closing a batch.",
            "default": false,
            "examples": [
              false
            ]
          },
          "step_check_force_order": {
            "type": "boolean",
            "title": "Step Check Force Order",
            "description": "When step_check is enabled, force steps to be completed in sequence.",
            "default": false,
            "examples": [
              false
            ]
          },
          "production_batch_qt": {
            "type": "integer",
            "title": "Production Batch Qt",
            "description": "Number of units per production batch. 0 means the whole job at once.",
            "default": 1,
            "examples": [
              1
            ]
          },
          "max_offline": {
            "type": "integer",
            "title": "Max Offline",
            "description": "Maximum seconds a workstation can be offline before the session is flagged.",
            "default": 60,
            "examples": [
              60
            ]
          },
          "auto_new_batch": {
            "type": "boolean",
            "title": "Auto New Batch",
            "description": "Automatically open a new batch when the previous one is completed.",
            "default": true,
            "examples": [
              true
            ]
          },
          "std_processing_time": {
            "type": "integer",
            "title": "Std Processing Time",
            "description": "Standard processing time per unit in seconds, used for KPI target calculations.",
            "default": 60,
            "examples": [
              60
            ]
          },
          "unsupervised_work_allowed": {
            "type": "boolean",
            "title": "Unsupervised Work Allowed",
            "description": "Allow production work to proceed without a supervisor logged in.",
            "default": false,
            "examples": [
              false
            ]
          },
          "display_job_timer": {
            "type": "boolean",
            "title": "Display Job Timer",
            "description": "Show a running timer on the operator UI for the current job.",
            "default": false,
            "examples": [
              false
            ]
          }
        },
        "type": "object",
        "title": "PhaseParameters"
      },
      "Position-Input": {
        "properties": {
          "x": {
            "type": "number",
            "title": "X",
            "description": "Horizontal position of the field in millimetres from the left edge.",
            "examples": [
              10.0
            ]
          },
          "y": {
            "type": "number",
            "title": "Y",
            "description": "Vertical position of the field in millimetres from the top edge.",
            "examples": [
              20.0
            ]
          }
        },
        "type": "object",
        "required": [
          "x",
          "y"
        ],
        "title": "Position"
      },
      "PositionNew": {
        "properties": {
          "parent_position_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Parent Position Key",
            "description": "Key of the parent position in the warehouse hierarchy. Defaults to the root `IN` position.",
            "default": "IN",
            "examples": [
              "IN",
              "12345"
            ]
          },
          "code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Code",
            "description": "Position code; auto-generated from the system counter if omitted.",
            "examples": [
              "LOCATION-A1-01"
            ]
          },
          "owned": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owned",
            "description": "True if this position is owned by the company.",
            "default": true,
            "examples": [
              true
            ]
          },
          "available": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Available",
            "description": "True if the position accepts movements on creation.",
            "default": true,
            "examples": [
              true
            ]
          },
          "fixed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fixed",
            "description": "True for fixed locations; False for mobile carriers.",
            "default": true,
            "examples": [
              true
            ]
          },
          "disposable": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Disposable",
            "description": "If True, the position is auto-deleted when emptied.",
            "default": false,
            "examples": [
              false
            ]
          },
          "allow_consumption": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allow Consumption",
            "description": "Override consumption policy for this position.",
            "examples": [
              null
            ]
          },
          "extra": {
            "title": "Extra",
            "description": "Arbitrary extra metadata.",
            "examples": [
              null
            ]
          }
        },
        "type": "object",
        "title": "PositionNew"
      },
      "PositionType": {
        "type": "string",
        "enum": [
          "from",
          "to"
        ],
        "title": "PositionType"
      },
      "PrintFormat": {
        "type": "string",
        "enum": [
          "zpl",
          "pdf"
        ],
        "title": "PrintFormat"
      },
      "PrintJobRequest": {
        "properties": {
          "printer_host": {
            "type": "string",
            "title": "Printer Host"
          },
          "printer_port": {
            "type": "integer",
            "title": "Printer Port",
            "default": 9100
          },
          "format": {
            "$ref": "#/components/schemas/PrintFormat"
          },
          "data": {
            "type": "string",
            "title": "Data"
          },
          "copies": {
            "type": "integer",
            "title": "Copies",
            "default": 1
          },
          "timeout_seconds": {
            "type": "number",
            "title": "Timeout Seconds",
            "default": 5.0
          },
          "printer_key": {
            "type": "string",
            "title": "Printer Key"
          }
        },
        "type": "object",
        "required": [
          "printer_host",
          "format",
          "data",
          "printer_key"
        ],
        "title": "PrintJobRequest"
      },
      "PrintTemplate-Input": {
        "properties": {
          "basePdf": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/BlankPdf"
              },
              {
                "type": "null"
              }
            ],
            "title": "Basepdf",
            "description": "Base PDF as a base64-encoded string, or a BlankPdf dimension spec for blank-page templates.",
            "examples": [
              null
            ]
          },
          "sampledata": {
            "items": {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            },
            "type": "array",
            "title": "Sampledata",
            "description": "Sample data rows used in the template editor preview; each dict maps field names to example strings.",
            "default": [],
            "examples": [
              []
            ]
          },
          "schemas": {
            "items": {
              "items": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/TextFieldSpec-Input"
                  },
                  {
                    "$ref": "#/components/schemas/VisualFieldSpec-Input"
                  }
                ]
              },
              "type": "array"
            },
            "type": "array",
            "title": "Schemas",
            "description": "Ordered list of page schemas; each page schema is an array of FieldSpec objects defining the template layout.",
            "examples": [
              []
            ]
          },
          "pdfmeVersion": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pdfmeversion",
            "description": "pdfme library version string that generated this template.",
            "examples": [
              "5.5.0"
            ]
          }
        },
        "type": "object",
        "required": [
          "schemas"
        ],
        "title": "PrintTemplate"
      },
      "PrintTemplate-Output": {
        "properties": {
          "basePdf": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/BlankPdf"
              },
              {
                "type": "null"
              }
            ],
            "title": "Basepdf",
            "description": "Base PDF as a base64-encoded string, or a BlankPdf dimension spec for blank-page templates.",
            "examples": [
              null
            ]
          },
          "sampledata": {
            "items": {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            },
            "type": "array",
            "title": "Sampledata",
            "description": "Sample data rows used in the template editor preview; each dict maps field names to example strings.",
            "default": [],
            "examples": [
              []
            ]
          },
          "schemas": {
            "items": {
              "items": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/TextFieldSpec-Output"
                  },
                  {
                    "$ref": "#/components/schemas/VisualFieldSpec-Output"
                  }
                ]
              },
              "type": "array"
            },
            "type": "array",
            "title": "Schemas",
            "description": "Ordered list of page schemas; each page schema is an array of FieldSpec objects defining the template layout.",
            "examples": [
              []
            ]
          },
          "pdfmeVersion": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pdfmeversion",
            "description": "pdfme library version string that generated this template.",
            "examples": [
              "5.5.0"
            ]
          }
        },
        "type": "object",
        "required": [
          "schemas"
        ],
        "title": "PrintTemplate"
      },
      "PrintTemplateRecord-Input": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Human-readable name for this print template.",
            "examples": [
              "Serial Label A6"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Optional description of the template's purpose and usage context.",
            "examples": [
              "A6 label for finished goods with QR code and serial number"
            ]
          },
          "template": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PrintTemplate-Input"
              },
              {
                "type": "null"
              }
            ],
            "description": "Full pdfme template definition; null in list responses, populated in detail responses."
          },
          "entities": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Entities",
            "description": "Number of entities (products, phases, steps, etc.) this template is assigned to via can_use_print_template edges.",
            "default": 0,
            "examples": [
              3
            ]
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "PrintTemplateRecord"
      },
      "PrintTemplateRecord-Output": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Human-readable name for this print template.",
            "examples": [
              "Serial Label A6"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Optional description of the template's purpose and usage context.",
            "examples": [
              "A6 label for finished goods with QR code and serial number"
            ]
          },
          "template": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PrintTemplate-Output"
              },
              {
                "type": "null"
              }
            ],
            "description": "Full pdfme template definition; null in list responses, populated in detail responses."
          },
          "entities": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Entities",
            "description": "Number of entities (products, phases, steps, etc.) this template is assigned to via can_use_print_template edges.",
            "default": 0,
            "examples": [
              3
            ]
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "PrintTemplateRecord"
      },
      "ProductBaseData": {
        "properties": {
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key",
            "description": "ArangoDB document key.",
            "examples": [
              "prod-001"
            ]
          },
          "code": {
            "type": "string",
            "title": "Code",
            "description": "Unique product code used across the manufacturing system.",
            "examples": [
              "PROD-A-001"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Human-readable description of the product.",
            "examples": [
              "Aluminium bracket, anodised black, 50x30mm"
            ]
          },
          "active": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Active",
            "description": "Whether this product is active in the catalogue.",
            "default": true,
            "examples": [
              true
            ]
          },
          "image": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Image",
            "description": "True if a product image file (image.jpg) exists in the product media folder.",
            "default": false,
            "examples": [
              false
            ]
          },
          "tags": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/Tag"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tags",
            "description": "Tags attached to this product for filtering and categorisation.",
            "default": []
          },
          "counter_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Counter Key",
            "description": "ArangoDB _key of the Counter used to generate serial numbers for this product.",
            "examples": [
              "counter-001"
            ]
          },
          "traceability_level": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TraceabilityLevel"
              },
              {
                "type": "null"
              }
            ],
            "description": "Traceability tracking level: 'form_only' captures form data only; 'complete' enables full serial traceability.",
            "examples": [
              "form_only"
            ]
          },
          "manage_inventory": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Manage Inventory",
            "description": "Whether inventory movements are tracked for this product.",
            "default": false,
            "examples": [
              false
            ]
          },
          "allow_negative_inventory": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allow Negative Inventory",
            "description": "Allow inventory to go negative (e.g. for consumption before replenishment).",
            "default": false,
            "examples": [
              false
            ]
          },
          "serial_code_on_creation": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Serial Code On Creation",
            "description": "Automatically generate a serial code when a work order for this product is created.",
            "default": false,
            "examples": [
              false
            ]
          }
        },
        "type": "object",
        "required": [
          "code"
        ],
        "title": "ProductBaseData"
      },
      "ProductDetails": {
        "properties": {
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key",
            "description": "ArangoDB document key.",
            "examples": [
              "prod-001"
            ]
          },
          "code": {
            "type": "string",
            "title": "Code",
            "description": "Unique product code used across the manufacturing system.",
            "examples": [
              "PROD-A-001"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Human-readable description of the product.",
            "examples": [
              "Aluminium bracket, anodised black, 50x30mm"
            ]
          },
          "active": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Active",
            "description": "Whether this product is active in the catalogue.",
            "default": true,
            "examples": [
              true
            ]
          },
          "image": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Image",
            "description": "True if a product image file (image.jpg) exists in the product media folder.",
            "default": false,
            "examples": [
              false
            ]
          },
          "tags": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/Tag"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tags",
            "description": "Tags attached to this product for filtering and categorisation.",
            "default": []
          },
          "counter_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Counter Key",
            "description": "ArangoDB _key of the Counter used to generate serial numbers for this product.",
            "examples": [
              "counter-001"
            ]
          },
          "traceability_level": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TraceabilityLevel"
              },
              {
                "type": "null"
              }
            ],
            "description": "Traceability tracking level: 'form_only' captures form data only; 'complete' enables full serial traceability.",
            "examples": [
              "form_only"
            ]
          },
          "manage_inventory": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Manage Inventory",
            "description": "Whether inventory movements are tracked for this product.",
            "default": false,
            "examples": [
              false
            ]
          },
          "allow_negative_inventory": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allow Negative Inventory",
            "description": "Allow inventory to go negative (e.g. for consumption before replenishment).",
            "default": false,
            "examples": [
              false
            ]
          },
          "serial_code_on_creation": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Serial Code On Creation",
            "description": "Automatically generate a serial code when a work order for this product is created.",
            "default": false,
            "examples": [
              false
            ]
          },
          "trash": {
            "type": "boolean",
            "title": "Trash",
            "description": "Soft-delete flag; true means the product is in the trash and excluded from active listings.",
            "default": false,
            "examples": [
              false
            ]
          },
          "created": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created",
            "description": "UTC timestamp when this product was created.",
            "examples": [
              "2026-01-10T09:00:00"
            ]
          },
          "updated": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated",
            "description": "UTC timestamp of the last update to this product.",
            "examples": [
              "2026-03-22T14:30:00"
            ]
          },
          "cost": {
            "$ref": "#/components/schemas/TargetAverageCost",
            "description": "Target and rolling-average cost figures for this product."
          },
          "technical_batch_qt": {
            "type": "integer",
            "title": "Technical Batch Qt",
            "description": "Technical batch quantity \u2014 the standard lot size for manufacturing planning.",
            "default": 0,
            "examples": [
              10
            ]
          },
          "minimum_order_qt": {
            "type": "integer",
            "title": "Minimum Order Qt",
            "description": "Minimum order quantity enforced when creating work orders for this product.",
            "default": 0,
            "examples": [
              1
            ]
          },
          "process_phases": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Process Phases",
            "description": "Ordered list of Phase _keys constituting this product's production process.",
            "default": [],
            "examples": [
              [
                "phase-001",
                "phase-002"
              ]
            ]
          },
          "production_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Production Notes",
            "description": "Free-text notes displayed to operators during production for this product.",
            "examples": [
              "Use calibrated torque wrench \u2014 see WI-042."
            ]
          },
          "throughput_time_target": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Throughput Time Target",
            "description": "Target throughput time in seconds from order release to completion.",
            "examples": [
              86400.0
            ]
          },
          "processing_time_target": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Processing Time Target",
            "description": "Target net processing time per unit in seconds.",
            "examples": [
              3600.0
            ]
          },
          "kpi_window_size": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Kpi Window Size",
            "description": "KPI rolling window size: number of days if kpi_window_type='time', number of work orders if 'count'.",
            "examples": [
              30
            ]
          },
          "kpi_window_type": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/KPIWindowType"
              },
              {
                "type": "null"
              }
            ],
            "description": "Unit for the KPI rolling window: 'time' (days) or 'count' (work orders).",
            "default": "count",
            "examples": [
              "count"
            ]
          },
          "metadata": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/ProductMetadataField"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata",
            "description": "List of custom metadata fields and their values for this product."
          },
          "default_production_position_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Default Production Position Key",
            "description": "ArangoDB _key of the default inventory position where finished goods are deposited.",
            "examples": [
              "pos-001"
            ]
          },
          "default_consumption_position_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Default Consumption Position Key",
            "description": "ArangoDB _key of the default inventory position from which components are consumed.",
            "examples": [
              "pos-002"
            ]
          }
        },
        "type": "object",
        "required": [
          "code"
        ],
        "title": "ProductDetails"
      },
      "ProductDoc": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Filename of the document in the product doc folder.",
            "examples": [
              "assembly-drawing-rev-c.pdf"
            ]
          },
          "size": {
            "type": "integer",
            "minimum": 0.0,
            "title": "Size",
            "description": "File size.",
            "examples": [
              204800
            ]
          }
        },
        "type": "object",
        "required": [
          "name",
          "size"
        ],
        "title": "ProductDoc"
      },
      "ProductFull": {
        "properties": {
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key",
            "description": "ArangoDB document key.",
            "examples": [
              "prod-001"
            ]
          },
          "code": {
            "type": "string",
            "title": "Code",
            "description": "Unique product code used across the manufacturing system.",
            "examples": [
              "PROD-A-001"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Human-readable description of the product.",
            "examples": [
              "Aluminium bracket, anodised black, 50x30mm"
            ]
          },
          "active": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Active",
            "description": "Whether this product is active in the catalogue.",
            "default": true,
            "examples": [
              true
            ]
          },
          "image": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Image",
            "description": "True if a product image file (image.jpg) exists in the product media folder.",
            "default": false,
            "examples": [
              false
            ]
          },
          "tags": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/Tag"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tags",
            "description": "Tags attached to this product for filtering and categorisation.",
            "default": []
          },
          "counter_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Counter Key",
            "description": "ArangoDB _key of the Counter used to generate serial numbers for this product.",
            "examples": [
              "counter-001"
            ]
          },
          "traceability_level": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TraceabilityLevel"
              },
              {
                "type": "null"
              }
            ],
            "description": "Traceability tracking level: 'form_only' captures form data only; 'complete' enables full serial traceability.",
            "examples": [
              "form_only"
            ]
          },
          "manage_inventory": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Manage Inventory",
            "description": "Whether inventory movements are tracked for this product.",
            "default": false,
            "examples": [
              false
            ]
          },
          "allow_negative_inventory": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allow Negative Inventory",
            "description": "Allow inventory to go negative (e.g. for consumption before replenishment).",
            "default": false,
            "examples": [
              false
            ]
          },
          "serial_code_on_creation": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Serial Code On Creation",
            "description": "Automatically generate a serial code when a work order for this product is created.",
            "default": false,
            "examples": [
              false
            ]
          },
          "trash": {
            "type": "boolean",
            "title": "Trash",
            "description": "Soft-delete flag; true means the product is in the trash and excluded from active listings.",
            "default": false,
            "examples": [
              false
            ]
          },
          "created": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created",
            "description": "UTC timestamp when this product was created.",
            "examples": [
              "2026-01-10T09:00:00"
            ]
          },
          "updated": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated",
            "description": "UTC timestamp of the last update to this product.",
            "examples": [
              "2026-03-22T14:30:00"
            ]
          },
          "cost": {
            "$ref": "#/components/schemas/TargetAverageCost",
            "description": "Target and rolling-average cost figures for this product."
          },
          "technical_batch_qt": {
            "type": "integer",
            "title": "Technical Batch Qt",
            "description": "Technical batch quantity \u2014 the standard lot size for manufacturing planning.",
            "default": 0,
            "examples": [
              10
            ]
          },
          "minimum_order_qt": {
            "type": "integer",
            "title": "Minimum Order Qt",
            "description": "Minimum order quantity enforced when creating work orders for this product.",
            "default": 0,
            "examples": [
              1
            ]
          },
          "process_phases": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Process Phases",
            "description": "Ordered list of Phase _keys constituting this product's production process.",
            "default": [],
            "examples": [
              [
                "phase-001",
                "phase-002"
              ]
            ]
          },
          "production_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Production Notes",
            "description": "Free-text notes displayed to operators during production for this product.",
            "examples": [
              "Use calibrated torque wrench \u2014 see WI-042."
            ]
          },
          "throughput_time_target": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Throughput Time Target",
            "description": "Target throughput time in seconds from order release to completion.",
            "examples": [
              86400.0
            ]
          },
          "processing_time_target": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Processing Time Target",
            "description": "Target net processing time per unit in seconds.",
            "examples": [
              3600.0
            ]
          },
          "kpi_window_size": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Kpi Window Size",
            "description": "KPI rolling window size: number of days if kpi_window_type='time', number of work orders if 'count'.",
            "examples": [
              30
            ]
          },
          "kpi_window_type": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/KPIWindowType"
              },
              {
                "type": "null"
              }
            ],
            "description": "Unit for the KPI rolling window: 'time' (days) or 'count' (work orders).",
            "default": "count",
            "examples": [
              "count"
            ]
          },
          "metadata": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/ProductMetadataField"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata",
            "description": "List of custom metadata fields and their values for this product."
          },
          "default_production_position_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Default Production Position Key",
            "description": "ArangoDB _key of the default inventory position where finished goods are deposited.",
            "examples": [
              "pos-001"
            ]
          },
          "default_consumption_position_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Default Consumption Position Key",
            "description": "ArangoDB _key of the default inventory position from which components are consumed.",
            "examples": [
              "pos-002"
            ]
          },
          "docs": {
            "items": {
              "$ref": "#/components/schemas/ProductDoc"
            },
            "type": "array",
            "title": "Docs",
            "description": "List of document files attached to this product.",
            "default": []
          },
          "img_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Img Name",
            "description": "Filename of the product image if one exists.",
            "examples": [
              "image.jpg"
            ]
          },
          "counter": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Counter"
              },
              {
                "type": "null"
              }
            ],
            "description": "Resolved Counter document if counter_key is set."
          }
        },
        "type": "object",
        "required": [
          "code"
        ],
        "title": "ProductFull"
      },
      "ProductMetadataField": {
        "properties": {
          "custom_field_key": {
            "type": "string",
            "title": "Custom Field Key",
            "description": "ArangoDB _key of the CustomField definition this metadata entry maps to.",
            "examples": [
              "cf-001"
            ]
          },
          "value": {
            "title": "Value",
            "description": "Value for this custom field instance on the product.",
            "examples": [
              "RAL 9005"
            ]
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label",
            "description": "Display label override for this field on this product; falls back to custom field default_label.",
            "examples": [
              "Surface Colour"
            ]
          },
          "hint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hint",
            "description": "Hint text override for this field on this product; falls back to custom field default_hint.",
            "examples": [
              "Select the RAL colour code"
            ]
          }
        },
        "type": "object",
        "required": [
          "custom_field_key"
        ],
        "title": "ProductMetadataField"
      },
      "Queue": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "type": {
            "$ref": "#/components/schemas/QueueType",
            "description": "Queue type: 'o' for operator, 'e' for equipment, 's' for site.",
            "examples": [
              "s"
            ]
          },
          "site_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Site Key",
            "description": "Key of the site this queue belongs to.",
            "examples": [
              "site-main"
            ]
          },
          "subqueue_target_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Subqueue Target Key",
            "description": "Key of the operator or equipment this queue is for (null for site queues).",
            "examples": [
              "usr-0042"
            ]
          },
          "work_orders": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Work Orders",
            "description": "Ordered list of work order keys by priority (site queues only).",
            "examples": [
              [
                "wo-2026-001",
                "wo-2026-002"
              ]
            ]
          },
          "jobs": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Jobs",
            "description": "Ordered list of job keys by priority (operator/equipment queues only).",
            "examples": [
              [
                "job-00123",
                "job-00456"
              ]
            ]
          },
          "independent": {
            "type": "boolean",
            "title": "Independent",
            "description": "When True, this queue's ordering is independent of the parent site work order sequence.",
            "default": false,
            "examples": [
              false
            ]
          }
        },
        "type": "object",
        "required": [
          "type"
        ],
        "title": "Queue"
      },
      "QueueType": {
        "type": "string",
        "enum": [
          "o",
          "e",
          "s"
        ],
        "title": "QueueType"
      },
      "SerialLink": {
        "properties": {
          "_from": {
            "type": "string",
            "title": "From",
            "description": "Key of the parent serial in the `contains` edge. Use `components` or `None` to link directly to a batch.",
            "examples": [
              "SN-LR-001234"
            ]
          },
          "_to": {
            "type": "string",
            "title": "To",
            "description": "Key of the child (component) serial.",
            "examples": [
              "SN-LR-005678"
            ]
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key",
            "description": "ArangoDB document key of the `contains` edge.",
            "examples": [
              "link-001"
            ]
          },
          "wo_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Wo Key",
            "description": "Work order key associated with this link.",
            "examples": [
              "WO-2026-001"
            ]
          },
          "phase_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Phase Key",
            "description": "Phase key associated with this link.",
            "examples": [
              "phase/ph-01"
            ]
          },
          "component_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Component Key",
            "description": "BOM component key that this link satisfies.",
            "examples": [
              "comp/bom-01"
            ]
          },
          "job_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Job Key",
            "description": "Job key associated with this link.",
            "examples": [
              "job/job-2026-001"
            ]
          },
          "batch_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Batch Key",
            "description": "Batch key associated with this link.",
            "examples": [
              "BATCH-A-042"
            ]
          },
          "confirmed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Confirmed",
            "description": "True if this link was confirmed via `SerialLinkedEvent`; False for temporary links.",
            "default": false,
            "examples": [
              false
            ]
          },
          "replaced": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Replaced",
            "description": "True if this link has been superseded by a replacement.",
            "default": false,
            "examples": [
              false
            ]
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason",
            "description": "Free-text reason for creating or replacing this link.",
            "examples": [
              "Component replaced due to defect"
            ]
          }
        },
        "type": "object",
        "required": [
          "_from",
          "_to"
        ],
        "title": "SerialLink"
      },
      "SerialSelection": {
        "properties": {
          "serial_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Serial Key",
            "description": "ArangoDB document key of the serial.",
            "examples": [
              "SN-LR-001234"
            ]
          },
          "serial_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Serial Code",
            "description": "Human-readable serial code.",
            "examples": [
              "SN-LR-001234"
            ]
          },
          "counter_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Counter Key",
            "description": "Counter key used to generate this serial's code.",
            "examples": [
              "counter/sn-lr"
            ]
          },
          "active": {
            "type": "boolean",
            "title": "Active",
            "description": "True when the serial is currently assigned to an active batch.",
            "default": false,
            "examples": [
              false
            ]
          }
        },
        "type": "object",
        "title": "SerialSelection"
      },
      "SerialTreeNode": {
        "properties": {
          "serial_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Serial Key",
            "description": "Key of this serial in the `Serial` collection.",
            "examples": [
              "SN-LR-001234"
            ]
          },
          "product_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Product Key",
            "description": "Key of the product this serial represents.",
            "examples": [
              "67890"
            ]
          },
          "serial_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Serial Code",
            "description": "Human-readable serial code.",
            "examples": [
              "SN-LR-001234"
            ]
          },
          "product_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Product Code",
            "description": "Code of the product.",
            "examples": [
              "PROD-001"
            ]
          },
          "replaced": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Replaced",
            "description": "True if this serial has been replaced by another in its parent's BOM.",
            "default": false,
            "examples": [
              false
            ]
          },
          "confirmed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Confirmed",
            "description": "True if the link from parent to this serial is confirmed.",
            "default": true,
            "examples": [
              true
            ]
          },
          "extra_bom": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Extra Bom",
            "description": "True if this serial is an extra BOM component not in the original BOM.",
            "default": false,
            "examples": [
              false
            ]
          },
          "product_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Product Description",
            "description": "Description of the product.",
            "examples": [
              "Steel bracket M6"
            ]
          },
          "children": {
            "items": {
              "$ref": "#/components/schemas/SerialTreeNode"
            },
            "type": "array",
            "title": "Children",
            "description": "Recursive list of child serial nodes.",
            "default": [],
            "examples": [
              []
            ]
          }
        },
        "type": "object",
        "title": "SerialTreeNode"
      },
      "SseTicketRequest": {
        "properties": {
          "topic": {
            "type": "string",
            "title": "Topic",
            "description": "NATS / SSE topic the caller wants to subscribe to (e.g. `user:user42`, `task`, `inventory`).",
            "examples": [
              "user:user42"
            ]
          }
        },
        "type": "object",
        "required": [
          "topic"
        ],
        "title": "SseTicketRequest"
      },
      "SseTicketResponse": {
        "properties": {
          "ticket": {
            "type": "string",
            "title": "Ticket",
            "description": "Short-lived signed JWT scoped to the requested topic. Pass as `?ticket=<value>` when opening the SSE stream.",
            "examples": [
              "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyNDIiLCJ0b3BpYyI6InVzZXI6dXNlcjQyIn0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
            ]
          },
          "expires_in": {
            "type": "integer",
            "title": "Expires In",
            "description": "Number of seconds until the ticket expires.",
            "examples": [
              60
            ]
          }
        },
        "type": "object",
        "required": [
          "ticket",
          "expires_in"
        ],
        "title": "SseTicketResponse"
      },
      "Step-Input": {
        "properties": {
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key",
            "description": "ArangoDB document key.",
            "examples": [
              "step-001"
            ]
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title",
            "description": "Short display title for the step.",
            "examples": [
              "Inspect weld joints"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Full markdown-formatted step instructions.",
            "examples": [
              "Check all weld joints for porosity defects per IPC-A-610."
            ]
          },
          "type": {
            "$ref": "#/components/schemas/StepType",
            "description": "Step category: 'instruction' for informational steps, 'form' for data-capture steps.",
            "default": "instruction",
            "examples": [
              "instruction"
            ]
          },
          "form_fields": {
            "items": {
              "$ref": "#/components/schemas/FormFieldDefinition"
            },
            "type": "array",
            "title": "Form Fields",
            "description": "Ordered list of form field definitions rendered when type='form'.",
            "default": [],
            "examples": [
              []
            ]
          },
          "print_templates": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "$ref": "#/components/schemas/PrintTemplateRecord-Input"
                }
              ]
            },
            "type": "array",
            "title": "Print Templates",
            "description": "Print templates available at this step, either as _key strings or resolved PrintTemplateRecord objects.",
            "default": [],
            "examples": [
              []
            ]
          }
        },
        "type": "object",
        "title": "Step"
      },
      "Step-Output": {
        "properties": {
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key",
            "description": "ArangoDB document key.",
            "examples": [
              "step-001"
            ]
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title",
            "description": "Short display title for the step.",
            "examples": [
              "Inspect weld joints"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Full markdown-formatted step instructions.",
            "examples": [
              "Check all weld joints for porosity defects per IPC-A-610."
            ]
          },
          "type": {
            "$ref": "#/components/schemas/StepType",
            "description": "Step category: 'instruction' for informational steps, 'form' for data-capture steps.",
            "default": "instruction",
            "examples": [
              "instruction"
            ]
          },
          "form_fields": {
            "items": {
              "$ref": "#/components/schemas/FormFieldDefinition"
            },
            "type": "array",
            "title": "Form Fields",
            "description": "Ordered list of form field definitions rendered when type='form'.",
            "default": [],
            "examples": [
              []
            ]
          },
          "print_templates": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "$ref": "#/components/schemas/PrintTemplateRecord-Output"
                }
              ]
            },
            "type": "array",
            "title": "Print Templates",
            "description": "Print templates available at this step, either as _key strings or resolved PrintTemplateRecord objects.",
            "default": [],
            "examples": [
              []
            ]
          }
        },
        "type": "object",
        "title": "Step"
      },
      "StepType": {
        "type": "string",
        "enum": [
          "instruction",
          "form"
        ],
        "title": "StepType"
      },
      "StepWithMediaInfo": {
        "properties": {
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key",
            "description": "ArangoDB document key.",
            "examples": [
              "step-001"
            ]
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title",
            "description": "Short display title for the step.",
            "examples": [
              "Inspect weld joints"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Full markdown-formatted step instructions.",
            "examples": [
              "Check all weld joints for porosity defects per IPC-A-610."
            ]
          },
          "type": {
            "$ref": "#/components/schemas/StepType",
            "description": "Step category: 'instruction' for informational steps, 'form' for data-capture steps.",
            "default": "instruction",
            "examples": [
              "instruction"
            ]
          },
          "form_fields": {
            "items": {
              "$ref": "#/components/schemas/FormFieldDefinition"
            },
            "type": "array",
            "title": "Form Fields",
            "description": "Ordered list of form field definitions rendered when type='form'.",
            "default": [],
            "examples": [
              []
            ]
          },
          "print_templates": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "$ref": "#/components/schemas/PrintTemplateRecord-Input"
                }
              ]
            },
            "type": "array",
            "title": "Print Templates",
            "description": "Print templates available at this step, either as _key strings or resolved PrintTemplateRecord objects.",
            "default": [],
            "examples": [
              []
            ]
          },
          "media": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "$ref": "#/components/schemas/Media"
                }
              ]
            },
            "type": "array",
            "title": "Media",
            "description": "Media files attached to this step, either as _key strings or resolved Media objects.",
            "default": [],
            "examples": [
              []
            ]
          }
        },
        "type": "object",
        "title": "StepWithMediaInfo"
      },
      "Tag": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Display name of the tag, shown in the UI.",
            "examples": [
              "Urgent"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Optional description of what this tag represents or when it should be used.",
            "examples": [
              "Flag items that require immediate attention."
            ]
          },
          "color": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Color",
            "description": "CSS colour value used to visually distinguish this tag in the UI (e.g. hex or named colour).",
            "examples": [
              "#E53935"
            ]
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "Tag",
        "description": "collection: Tag"
      },
      "TagAssignmentContext": {
        "type": "string",
        "enum": [
          "product"
        ],
        "title": "TagAssignmentContext"
      },
      "TagAssignmentUpdateType": {
        "type": "string",
        "enum": [
          "add",
          "remove"
        ],
        "title": "TagAssignmentUpdateType"
      },
      "TagConnectionUpdate": {
        "properties": {
          "type": {
            "$ref": "#/components/schemas/TagAssignmentUpdateType",
            "description": "Whether to add or remove this tag connection.",
            "examples": [
              "add"
            ]
          },
          "tag_key": {
            "type": "string",
            "title": "Tag Key",
            "description": "ArangoDB `_key` of the `Tag` document to connect or disconnect.",
            "examples": [
              "tag_urgent"
            ]
          },
          "context": {
            "$ref": "#/components/schemas/TagAssignmentContext",
            "description": "Entity type that the tag is being connected to or disconnected from.",
            "examples": [
              "product"
            ]
          },
          "context_key": {
            "type": "string",
            "title": "Context Key",
            "description": "ArangoDB `_key` of the entity instance (e.g. a specific Product) being tagged.",
            "examples": [
              "prod_abc"
            ]
          }
        },
        "type": "object",
        "required": [
          "type",
          "tag_key",
          "context",
          "context_key"
        ],
        "title": "TagConnectionUpdate"
      },
      "TargetAverageCost": {
        "properties": {
          "target": {
            "type": "number",
            "title": "Target",
            "default": 72900
          },
          "average": {
            "type": "number",
            "title": "Average",
            "default": 69471.44737498405
          }
        },
        "type": "object",
        "title": "TargetAverageCost"
      },
      "TaskAssignment": {
        "properties": {
          "user_key": {
            "type": "string",
            "title": "User Key",
            "description": "ArangoDB `_key` of the User assigned to this task.",
            "examples": [
              "user42"
            ]
          },
          "role": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskAssignmentRole"
              },
              {
                "type": "null"
              }
            ],
            "description": "Role of this user in the task: `owner` (exactly one required) or `participant`.",
            "default": "participant",
            "examples": [
              "participant"
            ]
          }
        },
        "type": "object",
        "required": [
          "user_key"
        ],
        "title": "TaskAssignment"
      },
      "TaskAssignmentRole": {
        "type": "string",
        "enum": [
          "owner",
          "participant"
        ],
        "title": "TaskAssignmentRole"
      },
      "TaskFormFieldValue": {
        "properties": {
          "form_field_key": {
            "type": "string",
            "title": "Form Field Key",
            "description": "ArangoDB _key of the FormFieldDefinition.",
            "examples": [
              "ffd-001"
            ]
          },
          "custom_field_key": {
            "type": "string",
            "title": "Custom Field Key",
            "description": "ArangoDB _key of the associated CustomField.",
            "examples": [
              "cf-001"
            ]
          },
          "label": {
            "type": "string",
            "title": "Label",
            "description": "Resolved label for display in the task UI.",
            "examples": [
              "Surface Colour"
            ]
          },
          "hint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hint",
            "description": "Resolved hint text for display in the task UI.",
            "examples": [
              "Verify against approved colour chart"
            ]
          },
          "mandatory": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mandatory",
            "description": "Whether this field must be completed before the task can close.",
            "default": false,
            "examples": [
              false
            ]
          },
          "value": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "title": "Value",
            "description": "Current recorded value for this field on this task.",
            "examples": [
              null
            ]
          },
          "last_updated": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Updated",
            "description": "ISO 8601 timestamp of the last time this field value was updated.",
            "examples": [
              "2026-03-22T14:30:00Z"
            ]
          }
        },
        "type": "object",
        "required": [
          "form_field_key",
          "custom_field_key",
          "label"
        ],
        "title": "TaskFormFieldValue"
      },
      "TaskLinkType": {
        "type": "string",
        "enum": [
          "issue",
          "work_order",
          "product",
          "serial",
          "task"
        ],
        "title": "TaskLinkType"
      },
      "TaskLinkedEntitySettings": {
        "properties": {
          "type": {
            "$ref": "#/components/schemas/TaskLinkType",
            "description": "Category of entity that can be linked to tasks of this type.",
            "examples": [
              "issue"
            ]
          },
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enabled",
            "description": "Whether linking to this entity type is enabled for the parent task type.",
            "default": false,
            "examples": [
              true
            ]
          },
          "allow_multiple": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allow Multiple",
            "description": "Whether a task can be linked to multiple entities of this type simultaneously.",
            "default": false,
            "examples": [
              false
            ]
          },
          "required": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Required",
            "description": "Whether at least one link to this entity type is required before the task can be completed.",
            "default": false,
            "examples": [
              false
            ]
          }
        },
        "type": "object",
        "required": [
          "type"
        ],
        "title": "TaskLinkedEntitySettings"
      },
      "TaskSearchResult": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "task_type_key": {
            "type": "string",
            "title": "Task Type Key",
            "description": "ArangoDB `_key` of the `TaskType` this task belongs to.",
            "examples": [
              "tasktype_001"
            ]
          },
          "code": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Code",
            "description": "Optional short alphanumeric code for this task, stored in uppercase.",
            "examples": [
              "TASK-2026-001"
            ]
          },
          "status": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskStatus"
              },
              {
                "type": "null"
              }
            ],
            "description": "Current lifecycle status of the task.",
            "default": "open",
            "examples": [
              "open"
            ]
          },
          "owner_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owner Key",
            "description": "ArangoDB `_key` of the user who owns this task. Derived from `assigned_to` on save.",
            "examples": [
              "user42"
            ]
          },
          "assigned_to": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/TaskAssignment"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Assigned To",
            "description": "List of user assignments. Must include exactly one `owner` role when non-empty."
          },
          "start_from": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start From",
            "description": "Earliest date/time from which work on this task can begin.",
            "examples": [
              "2026-05-05T08:00:00Z"
            ]
          },
          "due_by": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Due By",
            "description": "Deadline by which this task must be completed.",
            "examples": [
              "2026-05-10T17:00:00Z"
            ]
          },
          "created": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created",
            "description": "UTC timestamp at which this task was created.",
            "examples": [
              "2026-05-04T09:00:00Z"
            ]
          },
          "created_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By",
            "description": "ArangoDB `_key` of the User who created this task.",
            "examples": [
              "user42"
            ]
          },
          "closed": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Closed",
            "description": "UTC timestamp at which this task was completed or canceled.",
            "examples": [
              "2026-05-08T14:00:00Z"
            ]
          },
          "closed_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Closed By",
            "description": "ArangoDB `_key` of the User who closed this task.",
            "examples": [
              "user42"
            ]
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title",
            "description": "Short title describing what needs to be done.",
            "examples": [
              "Verify dimensional tolerance after rework"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Detailed description of the task, including acceptance criteria or instructions.",
            "examples": [
              "Check all 6 key dimensions against drawing rev. B. All must be within \u00b10.1 mm."
            ]
          },
          "form_fields": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/TaskFormFieldValue"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Form Fields",
            "description": "Form field values collected during task execution."
          },
          "icon": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Icon",
            "description": "Icon identifier from the task's `TaskType`, denormalised for display.",
            "examples": [
              "check_circle"
            ]
          },
          "task_type_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Task Type Name",
            "description": "Display name of the task's `TaskType`, denormalised for display.",
            "examples": [
              "Quality Inspection"
            ]
          }
        },
        "type": "object",
        "required": [
          "task_type_key"
        ],
        "title": "TaskSearchResult"
      },
      "TaskStatus": {
        "type": "string",
        "enum": [
          "pending",
          "open",
          "completed",
          "canceled"
        ],
        "title": "TaskStatus"
      },
      "TaskType": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Display name of this task type, shown in the UI when creating or filtering tasks.",
            "examples": [
              "Quality Inspection"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Optional extended description of the task type and its intended use.",
            "examples": [
              "Covers all quality checks mandated by the production process."
            ]
          },
          "active": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Active",
            "description": "Whether this task type is available for selection when creating new tasks.",
            "default": true,
            "examples": [
              true
            ]
          },
          "icon": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Icon",
            "description": "Icon identifier used by the frontend to render a visual indicator for tasks of this type.",
            "examples": [
              "check_circle"
            ]
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "title": "Created",
            "description": "UTC timestamp at which this task type was created.",
            "examples": [
              "2026-05-01T08:00:00Z"
            ]
          },
          "form_fields": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/FormFieldDefinition"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Form Fields",
            "description": "Form field definitions that operators must fill when working on a task of this type."
          },
          "link_settings": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/TaskLinkedEntitySettings"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Link Settings",
            "description": "Per-entity-type linking rules. Controls which entity types can or must be linked."
          },
          "require_time_entry": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Require Time Entry",
            "description": "Whether a time entry is required before the task can be marked complete.",
            "default": false,
            "examples": [
              false
            ]
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "TaskType"
      },
      "TaskTypeFull": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Display name of this task type, shown in the UI when creating or filtering tasks.",
            "examples": [
              "Quality Inspection"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Optional extended description of the task type and its intended use.",
            "examples": [
              "Covers all quality checks mandated by the production process."
            ]
          },
          "active": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Active",
            "description": "Whether this task type is available for selection when creating new tasks.",
            "default": true,
            "examples": [
              true
            ]
          },
          "icon": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Icon",
            "description": "Icon identifier used by the frontend to render a visual indicator for tasks of this type.",
            "examples": [
              "check_circle"
            ]
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "title": "Created",
            "description": "UTC timestamp at which this task type was created.",
            "examples": [
              "2026-05-01T08:00:00Z"
            ]
          },
          "form_fields": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/FormFieldDefinition"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Form Fields",
            "description": "Form field definitions that operators must fill when working on a task of this type."
          },
          "link_settings": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/TaskLinkedEntitySettings"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Link Settings",
            "description": "Per-entity-type linking rules. Controls which entity types can or must be linked."
          },
          "require_time_entry": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Require Time Entry",
            "description": "Whether a time entry is required before the task can be marked complete.",
            "default": false,
            "examples": [
              false
            ]
          },
          "print_templates": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/PrintTemplateRecord-Output"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Print Templates",
            "description": "Print templates associated with this task type."
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "TaskTypeFull"
      },
      "TemplateAssignmentContext": {
        "type": "string",
        "enum": [
          "product",
          "phase",
          "step",
          "issue_type",
          "task_type",
          "template",
          "position"
        ],
        "title": "TemplateAssignmentContext"
      },
      "TemplateAssignmentUpdate": {
        "properties": {
          "type": {
            "$ref": "#/components/schemas/TemplateAssignmentUpdateType",
            "description": "Whether to add or remove this template assignment.",
            "examples": [
              "add"
            ]
          },
          "template_key": {
            "type": "string",
            "title": "Template Key",
            "description": "ArangoDB _key of the PrintTemplate to assign or unassign.",
            "examples": [
              "tmpl-001"
            ]
          },
          "context": {
            "$ref": "#/components/schemas/TemplateAssignmentContext",
            "description": "Entity type this assignment links to.",
            "examples": [
              "product"
            ]
          },
          "context_key": {
            "type": "string",
            "title": "Context Key",
            "description": "ArangoDB _key of the entity (product, phase, step, etc.) being linked.",
            "examples": [
              "prod-001"
            ]
          }
        },
        "type": "object",
        "required": [
          "type",
          "template_key",
          "context",
          "context_key"
        ],
        "title": "TemplateAssignmentUpdate"
      },
      "TemplateAssignmentUpdateType": {
        "type": "string",
        "enum": [
          "add",
          "remove"
        ],
        "title": "TemplateAssignmentUpdateType"
      },
      "TextFieldSpec-Input": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Unique field name within the page schema, used to bind data values.",
            "examples": [
              "serial_number"
            ]
          },
          "type": {
            "type": "string",
            "const": "text",
            "title": "Type",
            "description": "pdfme field type discriminator; always 'text' for text fields.",
            "default": "text",
            "examples": [
              "text"
            ]
          },
          "position": {
            "$ref": "#/components/schemas/Position-Input",
            "description": "Position of the text field on the page in millimetres."
          },
          "height": {
            "type": "number",
            "title": "Height",
            "description": "Height of the text field in millimetres.",
            "examples": [
              8.0
            ]
          },
          "width": {
            "type": "number",
            "title": "Width",
            "description": "Width of the text field in millimetres.",
            "examples": [
              60.0
            ]
          },
          "alignment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Alignment"
              },
              {
                "type": "null"
              }
            ],
            "description": "Horizontal text alignment within the field.",
            "examples": [
              "left"
            ]
          },
          "backgroundColor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Backgroundcolor",
            "description": "Background colour as a CSS hex string.",
            "examples": [
              "#ffffff"
            ]
          },
          "characterSpacing": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Characterspacing",
            "description": "Letter spacing in points.",
            "examples": [
              0.0
            ]
          },
          "dynamicFontSize": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DynamicFontSize"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dynamic font size configuration; null uses a fixed fontSize."
          },
          "fontColor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fontcolor",
            "description": "Font colour as a CSS hex string.",
            "examples": [
              "#000000"
            ]
          },
          "fontName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fontname",
            "description": "Font name registered with pdfme.",
            "examples": [
              "NotoSerifJP-Regular"
            ]
          },
          "fontSize": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fontsize",
            "description": "Fixed font size in points.",
            "examples": [
              10.0
            ]
          },
          "lineHeight": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Lineheight",
            "description": "Line height multiplier.",
            "examples": [
              1.0
            ]
          },
          "rotate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rotate",
            "description": "Rotation angle in degrees.",
            "examples": [
              0.0
            ]
          },
          "verticalAlignment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VerticalAlignment"
              },
              {
                "type": "null"
              }
            ],
            "description": "Vertical text alignment within the field.",
            "examples": [
              "top"
            ]
          },
          "linkType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LinkType"
              },
              {
                "type": "null"
              }
            ],
            "description": "How this field's value is bound at render time.",
            "examples": [
              "preset"
            ]
          },
          "linkValue": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Linkvalue",
            "description": "Preset key or expression used when linkType is 'preset' or 'template_expression'.",
            "examples": [
              "serial_number"
            ]
          },
          "customFieldKey": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Customfieldkey",
            "description": "ArangoDB _key of the CustomField used when linkType='custom_field'.",
            "examples": [
              "cf-001"
            ]
          },
          "extraPath": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Extrapath",
            "description": "JSONPath expression for extracting a nested value from the linked data source.",
            "examples": [
              "batch.code"
            ]
          },
          "templateExpression": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Templateexpression",
            "description": "Jinja-style expression evaluated against render context when linkType='template_expression'.",
            "examples": [
              "{{ serial.code }}"
            ]
          },
          "readOnly": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Readonly",
            "description": "When true, the field is read-only in pdfme form mode.",
            "examples": [
              true
            ]
          },
          "required": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Required",
            "description": "When true, the field is required in pdfme form mode.",
            "examples": [
              false
            ]
          }
        },
        "additionalProperties": true,
        "type": "object",
        "required": [
          "name",
          "position",
          "height",
          "width"
        ],
        "title": "TextFieldSpec"
      },
      "TextFieldSpec-Output": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Unique field name within the page schema, used to bind data values.",
            "examples": [
              "serial_number"
            ]
          },
          "type": {
            "type": "string",
            "const": "text",
            "title": "Type",
            "description": "pdfme field type discriminator; always 'text' for text fields.",
            "default": "text",
            "examples": [
              "text"
            ]
          },
          "position": {
            "$ref": "#/components/schemas/models__print__Position",
            "description": "Position of the text field on the page in millimetres."
          },
          "height": {
            "type": "number",
            "title": "Height",
            "description": "Height of the text field in millimetres.",
            "examples": [
              8.0
            ]
          },
          "width": {
            "type": "number",
            "title": "Width",
            "description": "Width of the text field in millimetres.",
            "examples": [
              60.0
            ]
          },
          "alignment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Alignment"
              },
              {
                "type": "null"
              }
            ],
            "description": "Horizontal text alignment within the field.",
            "examples": [
              "left"
            ]
          },
          "backgroundColor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Backgroundcolor",
            "description": "Background colour as a CSS hex string.",
            "examples": [
              "#ffffff"
            ]
          },
          "characterSpacing": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Characterspacing",
            "description": "Letter spacing in points.",
            "examples": [
              0.0
            ]
          },
          "dynamicFontSize": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DynamicFontSize"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dynamic font size configuration; null uses a fixed fontSize."
          },
          "fontColor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fontcolor",
            "description": "Font colour as a CSS hex string.",
            "examples": [
              "#000000"
            ]
          },
          "fontName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fontname",
            "description": "Font name registered with pdfme.",
            "examples": [
              "NotoSerifJP-Regular"
            ]
          },
          "fontSize": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fontsize",
            "description": "Fixed font size in points.",
            "examples": [
              10.0
            ]
          },
          "lineHeight": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Lineheight",
            "description": "Line height multiplier.",
            "examples": [
              1.0
            ]
          },
          "rotate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rotate",
            "description": "Rotation angle in degrees.",
            "examples": [
              0.0
            ]
          },
          "verticalAlignment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VerticalAlignment"
              },
              {
                "type": "null"
              }
            ],
            "description": "Vertical text alignment within the field.",
            "examples": [
              "top"
            ]
          },
          "linkType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LinkType"
              },
              {
                "type": "null"
              }
            ],
            "description": "How this field's value is bound at render time.",
            "examples": [
              "preset"
            ]
          },
          "linkValue": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Linkvalue",
            "description": "Preset key or expression used when linkType is 'preset' or 'template_expression'.",
            "examples": [
              "serial_number"
            ]
          },
          "customFieldKey": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Customfieldkey",
            "description": "ArangoDB _key of the CustomField used when linkType='custom_field'.",
            "examples": [
              "cf-001"
            ]
          },
          "extraPath": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Extrapath",
            "description": "JSONPath expression for extracting a nested value from the linked data source.",
            "examples": [
              "batch.code"
            ]
          },
          "templateExpression": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Templateexpression",
            "description": "Jinja-style expression evaluated against render context when linkType='template_expression'.",
            "examples": [
              "{{ serial.code }}"
            ]
          },
          "readOnly": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Readonly",
            "description": "When true, the field is read-only in pdfme form mode.",
            "examples": [
              true
            ]
          },
          "required": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Required",
            "description": "When true, the field is required in pdfme form mode.",
            "examples": [
              false
            ]
          }
        },
        "additionalProperties": true,
        "type": "object",
        "required": [
          "name",
          "position",
          "height",
          "width"
        ],
        "title": "TextFieldSpec"
      },
      "Theme": {
        "type": "string",
        "enum": [
          "dark",
          "light"
        ],
        "title": "Theme"
      },
      "TokenRecord": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "signature": {
            "type": "string",
            "title": "Signature",
            "description": "The base64-url-encoded signature segment of the JWT (third `.`-delimited part).",
            "examples": [
              "SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
            ]
          },
          "revoked": {
            "type": "boolean",
            "title": "Revoked",
            "description": "Whether this token has been explicitly revoked. Revoked tokens are rejected on verification.",
            "default": false,
            "examples": [
              false
            ]
          },
          "issued_to": {
            "type": "string",
            "title": "Issued To",
            "description": "ArangoDB document ID (`User/<_key>`) of the entity this token was issued to.",
            "examples": [
              "User/user42"
            ]
          },
          "issued_at": {
            "type": "string",
            "format": "date-time",
            "title": "Issued At",
            "description": "UTC timestamp at which the token was issued.",
            "examples": [
              "2026-05-04T08:00:00Z"
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "title": "Expires At",
            "description": "UTC timestamp at which the token expires and will be rejected.",
            "examples": [
              "2026-05-05T08:00:00Z"
            ]
          },
          "context": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Context",
            "description": "Token context string (e.g. `session`, `api`, `pwd_reset`, `sse_ticket`).",
            "examples": [
              "session"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Human-readable label for long-lived API tokens, set at issuance time.",
            "examples": [
              "CI pipeline token"
            ]
          }
        },
        "type": "object",
        "required": [
          "signature",
          "issued_to",
          "issued_at",
          "expires_at"
        ],
        "title": "TokenRecord"
      },
      "TraceabilityLevel": {
        "type": "string",
        "enum": [
          "form_only",
          "complete"
        ],
        "title": "TraceabilityLevel"
      },
      "UserNew": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name",
            "description": "User's given name.",
            "examples": [
              "Alice"
            ]
          },
          "surname": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Surname",
            "description": "User's family name.",
            "examples": [
              "Smith"
            ]
          },
          "username": {
            "type": "string",
            "title": "Username",
            "description": "Unique login username. Must be unique across all users.",
            "examples": [
              "alice.smith"
            ]
          },
          "site_key": {
            "type": "string",
            "title": "Site Key",
            "description": "ArangoDB `_key` of the site this user is assigned to. Defaults to `'0'` (main site).",
            "default": "0",
            "examples": [
              "0"
            ]
          },
          "department_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Department Key",
            "description": "ArangoDB `_key` of the department this user belongs to.",
            "examples": [
              "dept_qa"
            ]
          },
          "hourly_cost": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hourly Cost",
            "description": "Hourly labour cost used in production cost tracking.",
            "examples": [
              32.5
            ]
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email",
            "description": "User's email address for notifications and identification.",
            "examples": [
              "alice.smith@progresslab.it"
            ]
          },
          "scope": {
            "type": "string",
            "title": "Scope",
            "description": "Space-separated permission scope string granted to this user.",
            "examples": [
              "production lib:r lib:w"
            ]
          },
          "preferences": {
            "$ref": "#/components/schemas/UserPreferences",
            "description": "Initial UI preferences for this user. Defaults to system defaults."
          }
        },
        "type": "object",
        "required": [
          "username",
          "scope"
        ],
        "title": "UserNew"
      },
      "UserPreferences": {
        "properties": {
          "theme": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Theme"
              },
              {
                "type": "null"
              }
            ],
            "description": "UI colour theme. `dark` or `light`.",
            "default": "dark",
            "examples": [
              "dark"
            ]
          },
          "locale": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Locale",
            "description": "BCP 47 locale tag for the UI language (e.g. `en-US`, `it-IT`).",
            "examples": [
              "en-US"
            ]
          },
          "display_font": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DisplayFont"
              },
              {
                "type": "null"
              }
            ],
            "description": "Font family used in the operator display.",
            "default": "orbitron",
            "examples": [
              "orbitron"
            ]
          },
          "home_page": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/HomePageOptions"
              },
              {
                "type": "null"
              }
            ],
            "description": "Route the user lands on after login.",
            "examples": [
              "productionRoot"
            ]
          },
          "job_selection_layout": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/JobSelectionLayout"
              },
              {
                "type": "null"
              }
            ],
            "description": "Layout style for the job selection screen: `card` or `list`.",
            "default": "card",
            "examples": [
              "card"
            ]
          },
          "work_session_tabs_order": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/WorkSessionTabs"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Work Session Tabs Order",
            "description": "Ordered list of tab identifiers shown in the work session view.",
            "default": [
              "jobSteps",
              "jobDocs",
              "jobBom",
              "jobIssues",
              "jobNotes",
              "jobMessages",
              "jobProcessView"
            ],
            "examples": [
              [
                "jobSteps",
                "jobDocs",
                "jobBom",
                "jobIssues",
                "jobNotes",
                "jobMessages",
                "jobProcessView"
              ]
            ]
          },
          "printer": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Printer",
            "description": "Default printer identifier used for label printing in the operator UI.",
            "examples": [
              "ZEBRA-ZT230-01"
            ]
          }
        },
        "type": "object",
        "title": "UserPreferences"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "VerticalAlignment": {
        "type": "string",
        "enum": [
          "top",
          "middle",
          "bottom"
        ],
        "title": "VerticalAlignment"
      },
      "VisualFieldSpec-Input": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Unique field name within the page schema.",
            "examples": [
              "product_qr"
            ]
          },
          "type": {
            "$ref": "#/components/schemas/VisualFieldType",
            "description": "pdfme visual field type: 'image', 'qrcode', 'ean13', 'code128', etc.",
            "examples": [
              "qrcode"
            ]
          },
          "position": {
            "$ref": "#/components/schemas/Position-Input",
            "description": "Position of the visual field on the page in millimetres."
          },
          "height": {
            "type": "number",
            "title": "Height",
            "description": "Height of the visual field in millimetres.",
            "examples": [
              20.0
            ]
          },
          "width": {
            "type": "number",
            "title": "Width",
            "description": "Width of the visual field in millimetres.",
            "examples": [
              20.0
            ]
          },
          "rotate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rotate",
            "description": "Rotation angle in degrees.",
            "examples": [
              0.0
            ]
          },
          "linkType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LinkType"
              },
              {
                "type": "null"
              }
            ],
            "description": "How this field's value is bound at render time.",
            "examples": [
              "preset"
            ]
          },
          "linkValue": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Linkvalue",
            "description": "Preset key or expression for the linked value.",
            "examples": [
              "serial_number"
            ]
          },
          "customFieldKey": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Customfieldkey",
            "description": "ArangoDB _key of the CustomField used when linkType='custom_field'.",
            "examples": [
              "cf-001"
            ]
          },
          "extraPath": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Extrapath",
            "description": "JSONPath expression for extracting a nested value.",
            "examples": [
              "batch.code"
            ]
          },
          "templateExpression": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Templateexpression",
            "description": "Jinja-style expression evaluated against render context.",
            "examples": [
              "{{ serial.code }}"
            ]
          },
          "readOnly": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Readonly",
            "description": "When true, the field is read-only in pdfme form mode.",
            "examples": [
              true
            ]
          },
          "required": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Required",
            "description": "When true, the field is required in pdfme form mode.",
            "examples": [
              false
            ]
          }
        },
        "additionalProperties": true,
        "type": "object",
        "required": [
          "name",
          "type",
          "position",
          "height",
          "width"
        ],
        "title": "VisualFieldSpec",
        "description": "Image or linear/2D codes"
      },
      "VisualFieldSpec-Output": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Unique field name within the page schema.",
            "examples": [
              "product_qr"
            ]
          },
          "type": {
            "$ref": "#/components/schemas/VisualFieldType",
            "description": "pdfme visual field type: 'image', 'qrcode', 'ean13', 'code128', etc.",
            "examples": [
              "qrcode"
            ]
          },
          "position": {
            "$ref": "#/components/schemas/models__print__Position",
            "description": "Position of the visual field on the page in millimetres."
          },
          "height": {
            "type": "number",
            "title": "Height",
            "description": "Height of the visual field in millimetres.",
            "examples": [
              20.0
            ]
          },
          "width": {
            "type": "number",
            "title": "Width",
            "description": "Width of the visual field in millimetres.",
            "examples": [
              20.0
            ]
          },
          "rotate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rotate",
            "description": "Rotation angle in degrees.",
            "examples": [
              0.0
            ]
          },
          "linkType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LinkType"
              },
              {
                "type": "null"
              }
            ],
            "description": "How this field's value is bound at render time.",
            "examples": [
              "preset"
            ]
          },
          "linkValue": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Linkvalue",
            "description": "Preset key or expression for the linked value.",
            "examples": [
              "serial_number"
            ]
          },
          "customFieldKey": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Customfieldkey",
            "description": "ArangoDB _key of the CustomField used when linkType='custom_field'.",
            "examples": [
              "cf-001"
            ]
          },
          "extraPath": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Extrapath",
            "description": "JSONPath expression for extracting a nested value.",
            "examples": [
              "batch.code"
            ]
          },
          "templateExpression": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Templateexpression",
            "description": "Jinja-style expression evaluated against render context.",
            "examples": [
              "{{ serial.code }}"
            ]
          },
          "readOnly": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Readonly",
            "description": "When true, the field is read-only in pdfme form mode.",
            "examples": [
              true
            ]
          },
          "required": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Required",
            "description": "When true, the field is required in pdfme form mode.",
            "examples": [
              false
            ]
          }
        },
        "additionalProperties": true,
        "type": "object",
        "required": [
          "name",
          "type",
          "position",
          "height",
          "width"
        ],
        "title": "VisualFieldSpec",
        "description": "Image or linear/2D codes"
      },
      "VisualFieldType": {
        "type": "string",
        "enum": [
          "image",
          "qrcode",
          "ean13",
          "code39",
          "code128",
          "gs1datamatrix",
          "datamatrix",
          "japanpost",
          "nw7",
          "itf14",
          "upca",
          "upce"
        ],
        "title": "VisualFieldType"
      },
      "WOBomLine": {
        "properties": {
          "component_key": {
            "type": "string",
            "title": "Component Key",
            "description": "ArangoDB _key of the component product.",
            "examples": [
              "prod-002"
            ]
          },
          "component_code": {
            "type": "string",
            "title": "Component Code",
            "description": "Product code of the component.",
            "examples": [
              "PROD-B-001"
            ]
          },
          "component_description": {
            "type": "string",
            "title": "Component Description",
            "description": "Description of the component product.",
            "examples": [
              "M5 hex bolt, stainless steel"
            ]
          },
          "qt": {
            "type": "number",
            "title": "Qt",
            "description": "Required quantity of this component per parent unit.",
            "examples": [
              4.0
            ]
          },
          "phase_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Phase Key",
            "description": "ArangoDB _key of the consumption phase.",
            "examples": [
              "phase-001"
            ]
          },
          "phase_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Phase Name",
            "description": "Human-readable name of the consumption phase.",
            "examples": [
              "Assembly"
            ]
          },
          "consumption_options": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BomLineConsumptionOptions"
              },
              {
                "type": "null"
              }
            ],
            "description": "Consumption behaviour options for this work order BoM line."
          },
          "traceability_level": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Traceability Level",
            "description": "Traceability level required for this component.",
            "examples": [
              "form_only"
            ]
          },
          "extra": {
            "title": "Extra",
            "description": "Arbitrary additional data.",
            "examples": [
              null
            ]
          }
        },
        "type": "object",
        "required": [
          "component_key",
          "component_code",
          "component_description",
          "qt"
        ],
        "title": "WOBomLine"
      },
      "WOBomLineInput": {
        "properties": {
          "component_key": {
            "type": "string",
            "title": "Component Key",
            "description": "ArangoDB _key of the component product to consume.",
            "examples": [
              "prod-002"
            ]
          },
          "qt": {
            "type": "number",
            "title": "Qt",
            "description": "Quantity to consume for this work order line.",
            "examples": [
              4.0
            ]
          },
          "phase_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Phase Key",
            "description": "ArangoDB _key of the phase at which this component is consumed.",
            "examples": [
              "phase-001"
            ]
          },
          "consumption_options": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BomLineConsumptionOptions"
              },
              {
                "type": "null"
              }
            ],
            "description": "Consumption behaviour options for this work order BoM line."
          },
          "extra": {
            "title": "Extra",
            "description": "Arbitrary additional data for external integrations.",
            "examples": [
              null
            ]
          }
        },
        "type": "object",
        "required": [
          "component_key",
          "qt"
        ],
        "title": "WOBomLineInput"
      },
      "WorkOrderNew": {
        "properties": {
          "wo_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Wo Code",
            "description": "Work order code. Auto-generated from counter if not provided.",
            "examples": [
              "WO-2026-001"
            ]
          },
          "product_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Product Key",
            "description": "ArangoDB key of the product to manufacture.",
            "examples": [
              "Product/12345"
            ]
          },
          "product_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Product Code",
            "description": "Human-readable product code. Used to look up product_key if key is absent.",
            "examples": [
              "PRD-GEAR-42"
            ]
          },
          "product_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Product Description",
            "description": "Product display description, copied from the Product record.",
            "examples": [
              "Planetary gear assembly 42mm"
            ]
          },
          "phase_sequence": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Phase Sequence",
            "description": "Ordered list of phase keys defining the production routing.",
            "examples": [
              [
                "default"
              ],
              [
                "assembly",
                "qc"
              ]
            ]
          },
          "qt_planned": {
            "type": "number",
            "exclusiveMinimum": 0.0,
            "title": "Qt Planned",
            "description": "Planned production quantity (must be positive).",
            "examples": [
              100.0
            ]
          },
          "priority": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Priority",
            "description": "Whether the work order is flagged as high priority.",
            "default": false,
            "examples": [
              false
            ]
          },
          "project_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Project Code",
            "description": "Optional project code to group related work orders.",
            "examples": [
              "PROJ-2026-Q1"
            ]
          },
          "start_from": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start From",
            "description": "Earliest date/time the work order may begin.",
            "examples": [
              "2026-05-01T06:00:00Z"
            ]
          },
          "due_by": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Due By",
            "description": "Deadline date/time for completing the work order.",
            "examples": [
              "2026-05-15T17:00:00Z"
            ]
          },
          "wo_bom": {
            "items": {
              "$ref": "#/components/schemas/WOBomLineInput"
            },
            "type": "array",
            "title": "Wo Bom",
            "description": "Bill-of-materials lines overriding the product BOM for this work order."
          },
          "output_position_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Output Position Key",
            "description": "Inventory position key where completed output should be placed.",
            "examples": [
              "Position/67890"
            ]
          },
          "traceability_level": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TraceabilityLevel"
              },
              {
                "type": "null"
              }
            ],
            "description": "Traceability mode for the work order (e.g. serial, batch, or none).",
            "examples": [
              "serial"
            ]
          },
          "serial_code_on_creation": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Serial Code On Creation",
            "description": "When True, serial codes are generated at work order creation rather than at batch start.",
            "default": false,
            "examples": [
              false
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notes",
            "description": "Free-text notes visible to operators.",
            "examples": [
              "Urgent \u2014 customer delivery 2026-05-16"
            ]
          },
          "extra": {
            "title": "Extra",
            "description": "Arbitrary extra data stored alongside the work order."
          }
        },
        "type": "object",
        "required": [
          "qt_planned"
        ],
        "title": "WorkOrderNew"
      },
      "WorkSessionTabs": {
        "type": "string",
        "enum": [
          "jobSteps",
          "jobDocs",
          "jobBom",
          "jobIssues",
          "jobNotes",
          "jobMessages",
          "jobProcessView"
        ],
        "title": "WorkSessionTabs"
      },
      "models__inventory__position__Position": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "_rev": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rev"
          },
          "code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Code",
            "description": "Human-readable position code shown in the warehouse UI.",
            "examples": [
              "WAREHOUSE-A",
              "LOCATION-A1-01"
            ]
          },
          "owned": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owned",
            "description": "True if this position belongs to the company (not a customer or supplier).",
            "default": true,
            "examples": [
              true
            ]
          },
          "available": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Available",
            "description": "True if the position is available for movements.",
            "default": true,
            "examples": [
              true
            ]
          },
          "disposable": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Disposable",
            "description": "If True, the position is automatically deleted when emptied or shipped.",
            "default": false,
            "examples": [
              false
            ]
          },
          "fixed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fixed",
            "description": "True for fixed warehouse locations; False for mobile carriers (e.g. trolleys).",
            "default": true,
            "examples": [
              true
            ]
          },
          "deleted": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deleted",
            "description": "Soft-delete flag; True means the position has been logically removed.",
            "default": false,
            "examples": [
              false
            ]
          },
          "created": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created",
            "description": "Timestamp when the position was created.",
            "examples": [
              "2026-05-15T10:00:00Z"
            ]
          },
          "allow_consumption": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allow Consumption",
            "description": "Override flag: if set, enables or disables consumption movements from this position regardless of global policy.",
            "examples": [
              null
            ]
          },
          "extra": {
            "title": "Extra",
            "description": "Arbitrary extra metadata stored alongside the position document.",
            "examples": [
              null
            ]
          }
        },
        "type": "object",
        "title": "Position"
      },
      "models__print__Position": {
        "properties": {
          "x": {
            "type": "number",
            "title": "X",
            "description": "Horizontal position of the field in millimetres from the left edge.",
            "examples": [
              10.0
            ]
          },
          "y": {
            "type": "number",
            "title": "Y",
            "description": "Vertical position of the field in millimetres from the top edge.",
            "examples": [
              20.0
            ]
          }
        },
        "type": "object",
        "required": [
          "x",
          "y"
        ],
        "title": "Position"
      }
    },
    "securitySchemes": {
      "OAuth2PasswordBearer": {
        "type": "oauth2",
        "flows": {
          "password": {
            "scopes": {
              "admin": "User can access and edit users and system settings",
              "library": "User can access and edit products",
              "production": "User can access and edit production plans",
              "operator": "User can access the operator panel and make production declarations"
            },
            "tokenUrl": "/api/auth"
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Production",
      "description": "Work orders, jobs, batches, steps.",
      "externalDocs": {
        "description": "Events reference",
        "url": "https://progresslabit.github.io/progress-platform/events/production/"
      }
    },
    {
      "name": "Warehouse",
      "description": "Inventory positions, movements, counting sessions.",
      "externalDocs": {
        "description": "Events reference",
        "url": "https://progresslabit.github.io/progress-platform/events/inventory/"
      }
    },
    {
      "name": "Serial",
      "description": "Serial traceability lifecycle.",
      "externalDocs": {
        "description": "Events reference",
        "url": "https://progresslabit.github.io/progress-platform/events/serial/"
      }
    },
    {
      "name": "Collaboration",
      "description": "Issues, tasks, messages.",
      "externalDocs": {
        "description": "Events reference",
        "url": "https://progresslabit.github.io/progress-platform/events/collaboration/"
      }
    },
    {
      "name": "Security",
      "description": "Authentication, session management, password reset."
    },
    {
      "name": "Administration",
      "description": "System configuration, overrides, admin operations."
    },
    {
      "name": "Organization",
      "description": "Users, roles, org structure."
    },
    {
      "name": "Quality",
      "description": "Forms, print templates, DHR generation."
    },
    {
      "name": "Traceability",
      "description": "Batch execution records, counters, serial search.",
      "externalDocs": {
        "description": "Events reference",
        "url": "https://progresslabit.github.io/progress-platform/events/serial/"
      }
    },
    {
      "name": "Process",
      "description": "Process templates and phase configuration."
    },
    {
      "name": "Product",
      "description": "Product catalogue and BOM management."
    },
    {
      "name": "Attachments",
      "description": "File and media attachment management."
    },
    {
      "name": "Notification",
      "description": "SSE notification stream."
    },
    {
      "name": "Configuration",
      "description": "System-level tag, custom field, and configuration utilities."
    }
  ]
}