{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Bito 2.0 Integration API",
    "description": "API guide for developers. API Key is taken from the integration section on the Bito platform.",
    "contact": {
      "name": "Bito Support",
      "email": "bito-support@unical.uz",
      "url": "https://bito.uz/support"
    }
  },
  "servers": [
    {
      "url": "https://api.systematicdev.uz/integration-api/integration/api/v2/",
      "description": "Dev"
    },
    {
      "url": "https://api.bito.uz/integration-api/integration/api/v2/",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Product"
    },
    {
      "name": "Category"
    },
    {
      "name": "Customer"
    },
    {
      "name": "Customer-category"
    },
    {
      "name": "Currency"
    },
    {
      "name": "Price"
    },
    {
      "name": "Discount"
    },
    {
      "name": "Product-stock"
    },
    {
      "name": "Product-warehouse"
    },
    {
      "name": "Warehouse"
    },
    {
      "name": "Sale-order"
    },
    {
      "name": "Attribute"
    },
    {
      "name": "Booking-table"
    },
    {
      "name": "Box-types"
    },
    {
      "name": "Cashback-settings"
    },
    {
      "name": "Cashbox"
    },
    {
      "name": "Cashbox-session"
    },
    {
      "name": "Open-ticket"
    },
    {
      "name": "Role"
    },
    {
      "name": "Section"
    },
    {
      "name": "Position"
    },
    {
      "name": "Person"
    },
    {
      "name": "Supplier"
    },
    {
      "name": "Employee"
    },
    {
      "name": "Organization"
    },
    {
      "name": "Sale-settings"
    },
    {
      "name": "Warehouse-settings"
    },
    {
      "name": "Finance-settings"
    },
    {
      "name": "Units-of-measure"
    },
    {
      "name": "Payment-method"
    },
    {
      "name": "Payment-type"
    },
    {
      "name": "Extra-cost"
    },
    {
      "name": "Purchase"
    },
    {
      "name": "Purchase-order"
    },
    {
      "name": "Purchase-return"
    },
    {
      "name": "Income"
    },
    {
      "name": "Invoice"
    },
    {
      "name": "Production-operation"
    },
    {
      "name": "Production-route-sheet"
    },
    {
      "name": "Profile"
    },
    {
      "name": "Tax"
    },
    {
      "name": "States"
    },
    {
      "name": "Trade"
    },
    {
      "name": "Transaction"
    },
    {
      "name": "Task"
    },
    {
      "name": "Task-type"
    },
    {
      "name": "Balance"
    },
    {
      "name": "Cashback"
    },
    {
      "name": "Custom-field"
    },
    {
      "name": "Recon-act"
    },
    {
      "name": "Report"
    },
    {
      "name": "Report-sales"
    },
    {
      "name": "Report-finance"
    },
    {
      "name": "Report-production"
    },
    {
      "name": "Report-distribution"
    },
    {
      "name": "Report-dashboard"
    },
    {
      "name": "Report-pos"
    },
    {
      "name": "Report-analysis"
    },
    {
      "name": "Report-warehouse"
    },
    {
      "name": "File",
      "description": "Upload files (base64) and attach/detach them to records"
    },
    {
      "name": "Customer Bulk",
      "description": "Bulk customer create/update operations"
    },
    {
      "name": "Device",
      "description": "POS devices registered on the account"
    },
    {
      "name": "Export-records",
      "description": "Asynchronous export jobs and their status"
    },
    {
      "name": "Internal-transfer",
      "description": "Stock transfers between warehouses of one organization"
    },
    {
      "name": "Kpi-settings",
      "description": "Employee KPI configuration"
    },
    {
      "name": "Marketing-settings",
      "description": "Marketing module settings"
    },
    {
      "name": "Message-settings",
      "description": "Outbound messaging settings"
    },
    {
      "name": "Organizational-transfer",
      "description": "Stock transfers between organizations"
    },
    {
      "name": "Pipeline-action",
      "description": "Automated pipeline actions"
    },
    {
      "name": "Production-group",
      "description": "Production groupings"
    },
    {
      "name": "Production-order",
      "description": "Production orders"
    },
    {
      "name": "Production-plan",
      "description": "Production planning"
    },
    {
      "name": "Production-step",
      "description": "Production process steps"
    },
    {
      "name": "Production-task",
      "description": "Production tasks assigned to workers"
    },
    {
      "name": "Production-tech-map",
      "description": "Technological maps — the step graph that turns route sheets into a finished product"
    },
    {
      "name": "Public-lead-form",
      "description": "Public lead capture forms"
    },
    {
      "name": "Reason",
      "description": "Configurable reasons used across business flows"
    },
    {
      "name": "Reminder-settings",
      "description": "Reminder/notification settings"
    },
    {
      "name": "Revision",
      "description": "Stock revisions (inventory counts)"
    },
    {
      "name": "Sale Order Bulk",
      "description": "Bulk sale order operations"
    },
    {
      "name": "Sms-template",
      "description": "SMS message templates"
    },
    {
      "name": "Source",
      "description": "Lead/trade acquisition sources"
    },
    {
      "name": "States-settings",
      "description": "Kanban board column configuration"
    },
    {
      "name": "Tag",
      "description": "Tags attachable to business entities"
    },
    {
      "name": "Write-off",
      "description": "Stock write-offs"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/product/create": {
      "post": {
        "tags": [
          "Product"
        ],
        "description": "This method allows adding product into the account.",
        "operationId": "product-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1product~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "type": "string",
                    "default": "",
                    "x-readme-id": "0.0",
                    "minLength": 3
                  },
                  "note": {
                    "type": "string",
                    "default": "",
                    "x-readme-id": "0.0"
                  },
                  "measure_id": {
                    "type": "string",
                    "default": "",
                    "description": "id of measure unit",
                    "x-readme-id": "0.1",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "category_id": {
                    "type": "string",
                    "default": "",
                    "description": "id of product categories",
                    "x-readme-id": "0.1",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "box_type_id": {
                    "type": "string",
                    "default": "",
                    "description": "id of Box type",
                    "x-readme-id": "0.2",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "box_item": {
                    "type": "number",
                    "default": 0,
                    "description": "number of items that exist in one box"
                  },
                  "box_item_barcode": {
                    "type": "string",
                    "default": "",
                    "description": "id of box item's barcode"
                  },
                  "sku": {
                    "type": "string",
                    "default": "",
                    "description": "local unique id of product"
                  },
                  "barcode": {
                    "type": "string",
                    "default": "",
                    "description": "barcode of product"
                  },
                  "supplier_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "list of supplier ids"
                  },
                  "warehouse_number": {
                    "type": "string",
                    "default": "",
                    "description": "Product's location in the warehouse (aisle/shelf/bin label). Optional, free-form."
                  },
                  "image": {
                    "type": "string",
                    "default": "",
                    "description": "image path of product that uploaded to the server"
                  },
                  "is_compound": {
                    "type": "boolean",
                    "default": false,
                    "description": "is compound product or not"
                  },
                  "materials": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "material_id": {
                          "type": "string",
                          "example": {
                            "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                          }
                        },
                        "amount": {
                          "type": "number"
                        },
                        "box_count": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "material_id",
                        "amount"
                      ]
                    },
                    "description": "list of materials of product. required if is_compound is true"
                  },
                  "barcodes": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "is_active": {
                          "type": "boolean"
                        },
                        "barcode": {
                          "type": "string"
                        }
                      }
                    },
                    "description": "list of barcodes of product"
                  },
                  "is_semi_product": {
                    "type": "boolean",
                    "default": false,
                    "description": "is semi product or not"
                  },
                  "is_product": {
                    "type": "boolean",
                    "default": false,
                    "description": "is product or not"
                  },
                  "is_material": {
                    "type": "boolean",
                    "default": false,
                    "description": "is material or not"
                  },
                  "is_marked": {
                    "type": "boolean",
                    "default": false,
                    "description": "is marked or not"
                  },
                  "dimension": {
                    "type": "object",
                    "properties": {
                      "shape": {
                        "type": "string",
                        "enum": [
                          "circular",
                          "rectangular",
                          "other"
                        ]
                      },
                      "netto_weight": {
                        "type": "number"
                      },
                      "gross_weight": {
                        "type": "number"
                      },
                      "height": {
                        "type": "number"
                      },
                      "volume": {
                        "type": "number"
                      },
                      "diameter": {
                        "type": "number"
                      },
                      "width": {
                        "type": "number"
                      },
                      "length": {
                        "type": "number"
                      }
                    },
                    "description": "dimension of product"
                  },
                  "is_variant": {
                    "type": "boolean",
                    "default": false,
                    "description": "is variant or not"
                  },
                  "variants": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "sku": {
                          "type": "string"
                        },
                        "barcode": {
                          "type": "string"
                        },
                        "image": {
                          "type": "boolean"
                        },
                        "organizations": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "organization_id": {
                                "type": "string",
                                "example": {
                                  "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                }
                              },
                              "is_available": {
                                "type": "boolean"
                              },
                              "max_stock": {
                                "type": "number"
                              },
                              "yellow_line": {
                                "type": "number"
                              },
                              "red_line": {
                                "type": "number"
                              },
                              "standard": {
                                "type": "number"
                              },
                              "is_available_for_sale": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "organization_id",
                              "is_available"
                            ]
                          }
                        },
                        "attributes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "attribute_id": {
                                "type": "string",
                                "example": {
                                  "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                }
                              },
                              "attribute_item_id": {
                                "type": "string",
                                "example": {
                                  "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                }
                              }
                            },
                            "required": [
                              "attribute_id",
                              "attribute_item_id"
                            ]
                          }
                        }
                      },
                      "required": [
                        "sku",
                        "organizations",
                        "attributes"
                      ]
                    }
                  },
                  "organizations": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "organization_id": {
                          "type": "string",
                          "example": {
                            "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                          }
                        },
                        "is_available": {
                          "type": "boolean"
                        },
                        "max_stock": {
                          "type": "number"
                        },
                        "yellow_line": {
                          "type": "number"
                        },
                        "red_line": {
                          "type": "number"
                        },
                        "standard": {
                          "type": "number"
                        },
                        "is_available_for_sale": {
                          "type": "boolean"
                        },
                        "prices": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "price_id": {
                                "type": "string",
                                "example": {
                                  "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                }
                              },
                              "amount": {
                                "type": "number"
                              },
                              "uom_prices": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "measure_id": {
                                      "type": "string",
                                      "example": {
                                        "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                      }
                                    },
                                    "amount": {
                                      "type": "number"
                                    }
                                  },
                                  "required": [
                                    "measure_id",
                                    "amount"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "price_id"
                            ]
                          },
                          "description": "list of prices with optional UOM prices"
                        }
                      },
                      "required": [
                        "organization_id",
                        "is_available"
                      ]
                    }
                  }
                },
                "type": "object",
                "required": [
                  "name",
                  "sku",
                  "measure_id",
                  "organizations",
                  "is_product",
                  "is_semi_product",
                  "is_material",
                  "is_marked"
                ]
              }
            }
          }
        }
      }
    },
    "/product/update": {
      "put": {
        "tags": [
          "Product"
        ],
        "description": "This method allows updating product in the account.",
        "operationId": "product-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "id of product",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "created_at": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1update/put/requestBody/content/application~1json/schema/properties/date/example"
                              }
                            },
                            "updated_at": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1update/put/requestBody/content/application~1json/schema/properties/date/example"
                              }
                            },
                            "name": {
                              "type": "string"
                            },
                            "number": {
                              "type": "string"
                            },
                            "note": {
                              "type": "string"
                            },
                            "box_item": {
                              "type": "number"
                            },
                            "box_item_barcode": {
                              "type": "string"
                            },
                            "box_type_id": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "box_type": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "example": {
                                    "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                  }
                                },
                                "code": {
                                  "type": "string"
                                },
                                "short_name": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "_id",
                                "name"
                              ]
                            },
                            "measure": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "example": {
                                    "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                  }
                                },
                                "system_code": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "short_name": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "decimal_count": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "_id",
                                "name",
                                "decimal_count"
                              ]
                            },
                            "sku": {
                              "type": "string"
                            },
                            "barcode": {
                              "type": "string"
                            },
                            "barcodes": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "is_active": {
                                    "type": "boolean"
                                  },
                                  "barcode": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "is_active",
                                  "barcode"
                                ]
                              },
                              "description": "list of barcodes of product"
                            },
                            "supplier_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "description": "list of supplier ids"
                            },
                            "warehouse_number": {
                              "type": "string",
                              "description": "Product's location in the warehouse (aisle/shelf/bin label). Absent when not set."
                            },
                            "image": {
                              "type": "string",
                              "description": "image path of product that uploaded to the server"
                            },
                            "materials": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "material_id": {
                                    "type": "string",
                                    "example": {
                                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                    }
                                  },
                                  "amount": {
                                    "type": "number"
                                  },
                                  "box_count": {
                                    "type": "integer"
                                  },
                                  "material": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string",
                                        "example": {
                                          "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                        }
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "sku": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "_id",
                                      "name",
                                      "sku"
                                    ]
                                  }
                                },
                                "required": [
                                  "material_id",
                                  "amount",
                                  "material"
                                ]
                              },
                              "description": "list of materials of product. required if is_compound is true"
                            },
                            "is_compound": {
                              "type": "boolean",
                              "description": "is compound product or not"
                            },
                            "is_marked": {
                              "type": "boolean",
                              "description": "is marked or not"
                            },
                            "is_product": {
                              "type": "boolean",
                              "default": false,
                              "description": "is product or not"
                            },
                            "is_material": {
                              "type": "boolean",
                              "default": false,
                              "description": "is material or not"
                            },
                            "is_semi_product": {
                              "type": "boolean",
                              "default": false,
                              "description": "is semi product or not"
                            },
                            "dimension": {
                              "type": "object",
                              "properties": {
                                "shape": {
                                  "type": "string",
                                  "enum": [
                                    "circular",
                                    "rectangular",
                                    "other"
                                  ]
                                },
                                "netto_weight": {
                                  "type": "number"
                                },
                                "gross_weight": {
                                  "type": "number"
                                },
                                "height": {
                                  "type": "number"
                                },
                                "volume": {
                                  "type": "number"
                                },
                                "diameter": {
                                  "type": "number"
                                },
                                "width": {
                                  "type": "number"
                                },
                                "length": {
                                  "type": "number"
                                }
                              },
                              "description": "dimension of product"
                            },
                            "is_variant": {
                              "type": "boolean",
                              "description": "is variant or not"
                            },
                            "is_parent": {
                              "type": "boolean",
                              "description": "is parent or not"
                            },
                            "attributes": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "attribute_id": {
                                    "type": "string"
                                  },
                                  "attribute_item_id": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "attribute_id",
                                  "attribute_item_id"
                                ]
                              }
                            },
                            "parent_id": {
                              "type": "string",
                              "description": "id of parent product. it depends on variant product",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "organizations": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "organization_id": {
                                    "type": "string",
                                    "example": {
                                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                    }
                                  },
                                  "is_available": {
                                    "type": "boolean"
                                  },
                                  "max_stock": {
                                    "type": "number"
                                  },
                                  "yellow_line": {
                                    "type": "number"
                                  },
                                  "red_line": {
                                    "type": "number"
                                  },
                                  "standard": {
                                    "type": "number"
                                  },
                                  "is_available_for_sale": {
                                    "type": "boolean"
                                  },
                                  "prices": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "price_id": {
                                          "type": "string",
                                          "example": {
                                            "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                          }
                                        },
                                        "amount": {
                                          "type": "number"
                                        },
                                        "uom_prices": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "measure_id": {
                                                "type": "string",
                                                "example": {
                                                  "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                                }
                                              },
                                              "amount": {
                                                "type": "number"
                                              }
                                            },
                                            "required": [
                                              "measure_id",
                                              "amount"
                                            ]
                                          }
                                        }
                                      },
                                      "required": [
                                        "price_id"
                                      ]
                                    },
                                    "description": "list of prices with optional UOM prices"
                                  }
                                },
                                "required": [
                                  "organization_id",
                                  "is_available",
                                  "is_available_for_sale"
                                ]
                              }
                            },
                            "tax_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "description": "list of tax ids"
                            },
                            "discount_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "description": "list of discount ids"
                            },
                            "category": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "example": {
                                    "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                  }
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "_id",
                                "name"
                              ]
                            },
                            "custom_fields": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string",
                                    "example": {
                                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                    }
                                  },
                                  "value": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "_id",
                                  "value"
                                ]
                              }
                            }
                          },
                          "type": "object",
                          "required": [
                            "name",
                            "created_at",
                            "updated_at",
                            "number",
                            "sku",
                            "measure",
                            "is_product",
                            "is_material",
                            "is_semi_product",
                            "is_marked",
                            "is_compound"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "default": "",
                    "description": "id of product"
                  },
                  "name": {
                    "type": "string",
                    "default": "",
                    "x-readme-id": "0.0"
                  },
                  "measure_id": {
                    "type": "string",
                    "default": "",
                    "description": "id of measure unit",
                    "x-readme-id": "0.1"
                  },
                  "category_id": {
                    "type": "string",
                    "default": "",
                    "description": "id of product categories",
                    "x-readme-id": "0.1"
                  },
                  "box_type_id": {
                    "type": "string",
                    "default": "",
                    "description": "id of Box type",
                    "x-readme-id": "0.2"
                  },
                  "box_item": {
                    "type": "number",
                    "default": 0,
                    "description": "number of items that exist in one box"
                  },
                  "box_item_barcode": {
                    "type": "string",
                    "default": "",
                    "description": "id of box item's barcode"
                  },
                  "sku": {
                    "type": "string",
                    "default": "",
                    "description": "local unique id of product"
                  },
                  "barcode": {
                    "type": "string",
                    "default": "",
                    "description": "barcode of product"
                  },
                  "supplier_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "list of supplier ids"
                  },
                  "warehouse_number": {
                    "type": "string",
                    "default": "",
                    "description": "Product's location in the warehouse (aisle/shelf/bin label). Optional, free-form."
                  },
                  "image": {
                    "type": "string",
                    "default": "",
                    "description": "image path of product that uploaded to the server"
                  },
                  "materials": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "material_id": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "number"
                        },
                        "box_count": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "material_id",
                        "amount"
                      ]
                    },
                    "description": "list of materials of product. required if is_compound is true"
                  },
                  "barcodes": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "is_active": {
                          "type": "boolean"
                        },
                        "barcode": {
                          "type": "string"
                        }
                      }
                    },
                    "description": "list of barcodes of product"
                  },
                  "is_semi_product": {
                    "type": "boolean",
                    "default": false,
                    "description": "is semi product or not"
                  },
                  "is_product": {
                    "type": "boolean",
                    "default": false,
                    "description": "is product or not"
                  },
                  "is_material": {
                    "type": "boolean",
                    "default": false,
                    "description": "is material or not"
                  },
                  "dimension": {
                    "type": "object",
                    "properties": {
                      "shape": {
                        "type": "string",
                        "enum": [
                          "circular",
                          "rectangular",
                          "other"
                        ]
                      },
                      "netto_weight": {
                        "type": "number"
                      },
                      "gross_weight": {
                        "type": "number"
                      },
                      "height": {
                        "type": "number"
                      },
                      "volume": {
                        "type": "number"
                      },
                      "diameter": {
                        "type": "number"
                      },
                      "width": {
                        "type": "number"
                      },
                      "length": {
                        "type": "number"
                      }
                    },
                    "description": "dimension of product"
                  },
                  "variants": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "sku": {
                          "type": "string"
                        },
                        "barcode": {
                          "type": "string"
                        },
                        "image": {
                          "type": "boolean"
                        },
                        "organizations": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "organization_id": {
                                "type": "string"
                              },
                              "is_available": {
                                "type": "boolean"
                              },
                              "max_stock": {
                                "type": "number"
                              },
                              "yellow_line": {
                                "type": "number"
                              },
                              "red_line": {
                                "type": "number"
                              },
                              "standard": {
                                "type": "number"
                              },
                              "is_available_for_sale": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "organization_id",
                              "is_available"
                            ]
                          }
                        },
                        "attributes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "attribute_id": {
                                "type": "string"
                              },
                              "attribute_item_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "attribute_id",
                              "attribute_item_id"
                            ]
                          }
                        }
                      },
                      "required": [
                        "_id",
                        "sku",
                        "organizations",
                        "attributes"
                      ]
                    },
                    "description": " list of variants of product. required if is_variant is true"
                  },
                  "organizations": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "organization_id": {
                          "type": "string"
                        },
                        "is_available": {
                          "type": "boolean"
                        },
                        "max_stock": {
                          "type": "number"
                        },
                        "yellow_line": {
                          "type": "number"
                        },
                        "red_line": {
                          "type": "number"
                        },
                        "standard": {
                          "type": "number"
                        },
                        "is_available_for_sale": {
                          "type": "boolean"
                        },
                        "prices": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "price_id": {
                                "type": "string",
                                "example": {
                                  "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                }
                              },
                              "amount": {
                                "type": "number"
                              },
                              "uom_prices": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "measure_id": {
                                      "type": "string",
                                      "example": {
                                        "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                      }
                                    },
                                    "amount": {
                                      "type": "number"
                                    }
                                  },
                                  "required": [
                                    "measure_id",
                                    "amount"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "price_id"
                            ]
                          },
                          "description": "list of prices with optional UOM prices"
                        }
                      },
                      "required": [
                        "organization_id",
                        "is_available"
                      ]
                    }
                  }
                },
                "type": "object",
                "required": [
                  "name",
                  "sku",
                  "measure_id",
                  "organizations",
                  "is_semi_product",
                  "is_product",
                  "is_material",
                  "is_marked",
                  "is_variant",
                  "box_item"
                ]
              }
            }
          }
        }
      }
    },
    "/product/delete/{id}": {
      "delete": {
        "tags": [
          "Product"
        ],
        "description": "Delete a product",
        "operationId": "product-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/product/get-by-id/{id}": {
      "get": {
        "tags": [
          "Product"
        ],
        "description": "Get product using its _id",
        "operationId": "product-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1product~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/product/get-paging": {
      "post": {
        "tags": [
          "Product"
        ],
        "description": "Get products by paging",
        "operationId": "product-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string"
                      },
                      "is_main": {
                        "type": "boolean"
                      },
                      "category_id": {
                        "type": "string"
                      },
                      "is_archived": {
                        "type": "boolean"
                      },
                      "is_compound": {
                        "type": "boolean"
                      },
                      "is_semi_product": {
                        "type": "boolean"
                      },
                      "is_product": {
                        "type": "boolean"
                      },
                      "is_material": {
                        "type": "boolean"
                      },
                      "updated_at": {
                        "type": "string",
                        "description": "ISO time format"
                      },
                      "is_available_for_sale": {
                        "type": "boolean"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1product~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/product/get-deleted": {
      "get": {
        "tags": [
          "Product"
        ],
        "description": "Get deleted product ids",
        "operationId": "product-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/category/create": {
      "post": {
        "tags": [
          "Category"
        ],
        "description": "This method allows adding category into the account.",
        "operationId": "category-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1category~1update/put/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "type": "string",
                    "default": "",
                    "x-readme-id": "0.0",
                    "minLength": 3
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "product",
                      "material",
                      "semi_product"
                    ],
                    "default": "",
                    "description": "type categories"
                  },
                  "parent_id": {
                    "type": "string",
                    "default": "",
                    "description": "id of parent category"
                  },
                  "is_available_for_sale": {
                    "type": "boolean",
                    "default": true,
                    "description": "is available for sale"
                  },
                  "organization_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "ids of organization"
                  },
                  "image": {
                    "type": "string",
                    "default": "",
                    "description": "image path of category that uploaded to the server"
                  }
                },
                "type": "object",
                "required": [
                  "name",
                  "is_available_for_sale",
                  "organization_ids"
                ]
              }
            }
          }
        }
      }
    },
    "/category/update": {
      "put": {
        "tags": [
          "Category"
        ],
        "description": "This method allows updating category in the account.",
        "operationId": "category-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "_id": {
                      "type": "string",
                      "description": "id of category"
                    },
                    "name": {
                      "type": "string"
                    },
                    "is_main_material": {
                      "type": "boolean"
                    },
                    "is_available_for_sale": {
                      "type": "boolean"
                    },
                    "type": {
                      "type": "string"
                    },
                    "parent_id": {
                      "type": "string",
                      "description": "id of parent category"
                    },
                    "organization_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "ids of organizations"
                    },
                    "child_cound": {
                      "type": "number"
                    },
                    "item_count": {
                      "type": "number",
                      "description": "count off all child"
                    },
                    "count": {
                      "type": "number"
                    },
                    "image": {
                      "type": "string"
                    }
                  },
                  "type": "object",
                  "required": [
                    "_id",
                    "name",
                    "count",
                    "child_cound",
                    "item_count",
                    "parent_id",
                    "is_main_material",
                    "is_available_for_sale",
                    "type",
                    "organization_ids",
                    "updated_at",
                    "created_at"
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1category~1create/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "default": "",
                        "description": "id of category"
                      }
                    },
                    "required": [
                      "_id"
                    ]
                  }
                ],
                "type": "object",
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/category/delete/{id}": {
      "delete": {
        "tags": [
          "Category"
        ],
        "description": "Delete a category",
        "operationId": "category-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/category/get-by-id/{id}": {
      "get": {
        "tags": [
          "Category"
        ],
        "description": "Get category using its _id",
        "operationId": "category-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1category~1update/put/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/category/get-paging": {
      "post": {
        "tags": [
          "Category"
        ],
        "description": "Get categories by paging",
        "operationId": "category-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string"
                      },
                      "top": {
                        "type": "boolean"
                      },
                      "updated_at": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2023-10-01T12:00:00Z"
                      },
                      "organization_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d800"
                      },
                      "parent_id": {
                        "type": "string",
                        "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1category~1update/put/responses/200/content/application~1json/schema"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/category/get-deleted": {
      "get": {
        "tags": [
          "Category"
        ],
        "description": "Get deleted category ids",
        "operationId": "category-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/customer/create": {
      "post": {
        "tags": [
          "Customer"
        ],
        "description": "This method allows adding customer into the account.",
        "operationId": "customer-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1customer~1update/put/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "type": "string",
                    "default": "",
                    "x-readme-id": "0.0",
                    "minLength": 1
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "legal",
                      "natural"
                    ],
                    "default": "",
                    "description": "type customer"
                  },
                  "category_id": {
                    "type": "string",
                    "default": ""
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "new",
                      "warning",
                      "black_list",
                      "active"
                    ],
                    "default": ""
                  },
                  "inn": {
                    "type": "string",
                    "default": ""
                  },
                  "director_name": {
                    "type": "string",
                    "default": ""
                  },
                  "address": {
                    "type": "string",
                    "default": ""
                  },
                  "delivery_address": {
                    "type": "object",
                    "properties": {
                      "long": {
                        "type": "number",
                        "default": ""
                      },
                      "lat": {
                        "type": "number",
                        "default": ""
                      },
                      "human_address": {
                        "type": "object",
                        "properties": {
                          "address": {
                            "type": "string",
                            "default": "string"
                          },
                          "city": {
                            "type": "string",
                            "default": "string"
                          },
                          "state": {
                            "type": "string",
                            "default": "string"
                          },
                          "zip": {
                            "type": "string",
                            "default": "string"
                          }
                        }
                      }
                    }
                  },
                  "bank_name": {
                    "type": "string",
                    "default": ""
                  },
                  "agent_id": {
                    "type": "string",
                    "default": ""
                  },
                  "responsible_id": {
                    "type": "string",
                    "default": ""
                  },
                  "account_number": {
                    "type": "string",
                    "default": ""
                  },
                  "mfo": {
                    "type": "string",
                    "default": ""
                  },
                  "loyalty_card_id": {
                    "type": "string",
                    "default": ""
                  },
                  "qqs_number": {
                    "type": "string",
                    "default": ""
                  },
                  "phone_number": {
                    "type": "string",
                    "default": ""
                  },
                  "phone_numbers": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "company_phone_number": {
                    "type": "string",
                    "default": ""
                  },
                  "description": {
                    "type": "string",
                    "default": "",
                    "minLength": 512
                  },
                  "organization_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minLength": 1
                  },
                  "debt_limits": {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string",
                        "default": ""
                      },
                      "limit": {
                        "type": "number",
                        "default": ""
                      },
                      "customer_id": {
                        "type": "string"
                      }
                    }
                  },
                  "organization_id": {
                    "type": "string",
                    "default": ""
                  },
                  "person_id": {
                    "type": "string",
                    "default": ""
                  },
                  "oked": {
                    "type": "string",
                    "default": ""
                  },
                  "gender": {
                    "type": "string",
                    "enum": [
                      "male",
                      "female"
                    ],
                    "default": ""
                  },
                  "image": {
                    "type": "string",
                    "default": ""
                  },
                  "last_name": {
                    "type": "string",
                    "default": ""
                  },
                  "middle_name": {
                    "type": "string",
                    "default": ""
                  },
                  "birth_date": {
                    "type": "string",
                    "default": ""
                  },
                  "legal_person_id": {
                    "type": "string",
                    "default": ""
                  },
                  "telegram_link": {
                    "type": "string",
                    "default": ""
                  },
                  "is_supplier": {
                    "type": "boolean",
                    "default": false
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "inactive"
                    ],
                    "default": ""
                  },
                  "short_name": {
                    "type": "string",
                    "default": ""
                  },
                  "web_site": {
                    "type": "string",
                    "default": ""
                  },
                  "code": {
                    "type": "string",
                    "default": ""
                  },
                  "postal_code": {
                    "type": "string",
                    "default": ""
                  },
                  "owner_id": {
                    "type": "string",
                    "default": ""
                  },
                  "manager_id": {
                    "type": "string",
                    "default": ""
                  },
                  "custom_fields": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string"
                      },
                      "value": {}
                    }
                  }
                },
                "type": "object",
                "required": [
                  "name",
                  "organization_ids"
                ]
              }
            }
          }
        }
      }
    },
    "/customer/update": {
      "put": {
        "tags": [
          "Customer"
        ],
        "description": "This method allows updating customer in the account.",
        "operationId": "customer-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "_id": {
                      "type": "string",
                      "description": "id of customer"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "inn": {
                      "type": "string"
                    },
                    "director_name": {
                      "type": "string"
                    },
                    "address": {
                      "type": "string"
                    },
                    "bank_name": {
                      "type": "string"
                    },
                    "account_number": {
                      "type": "string"
                    },
                    "pinfl": {
                      "type": "string"
                    },
                    "director_pinfl": {
                      "type": "string"
                    },
                    "mfo": {
                      "type": "string"
                    },
                    "oked": {
                      "type": "string"
                    },
                    "qqs_number": {
                      "type": "string"
                    },
                    "phone_number": {
                      "type": "string"
                    },
                    "phone_numbers": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "company_phone_number": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "organization_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "last_sale_at": {
                      "type": "string"
                    },
                    "first_sale_at": {
                      "type": "string"
                    },
                    "total_sale": {
                      "type": "number"
                    },
                    "avg_sale": {
                      "type": "number"
                    },
                    "point": {
                      "type": "number"
                    },
                    "balance": {
                      "type": "number"
                    },
                    "balance_currency_id": {
                      "type": "string"
                    },
                    "balances": {
                      "type": "object",
                      "properties": {
                        "balance": {
                          "type": "number"
                        },
                        "balance_currency_id": {
                          "type": "string"
                        }
                      }
                    },
                    "balance_list": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  },
                  "type": "object",
                  "required": [
                    "_id",
                    "name",
                    "type",
                    "updated_at",
                    "created_at",
                    "organization_ids"
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1customer~1create/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "default": "",
                        "description": "id of customer"
                      }
                    },
                    "required": [
                      "_id"
                    ]
                  }
                ],
                "type": "object",
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/customer/delete/{id}": {
      "delete": {
        "tags": [
          "Customer"
        ],
        "description": "Delete a customer",
        "operationId": "customer-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/customer/get-by-id/{id}": {
      "get": {
        "tags": [
          "Customer"
        ],
        "description": "Get customer using its _id",
        "operationId": "customer-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1customer~1update/put/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/customer/get-paging": {
      "post": {
        "tags": [
          "Customer"
        ],
        "description": "Get customers by paging",
        "operationId": "customer-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "updated_at": {
                        "type": "string"
                      },
                      "organization_id": {
                        "type": "string"
                      },
                      "search": {
                        "type": "string"
                      },
                      "phone_number": {
                        "type": "string"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1customer~1update/put/responses/200/content/application~1json/schema"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/customer/get-deleted": {
      "get": {
        "tags": [
          "Customer"
        ],
        "description": "Get deleted customer ids",
        "operationId": "customer-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/customer/set-state": {
      "put": {
        "tags": [
          "Customer"
        ],
        "description": "setState customer",
        "operationId": "customer-set-state",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "black_list",
                      "new",
                      "active",
                      "warning"
                    ],
                    "example": "new"
                  }
                },
                "type": "object",
                "required": [
                  "state",
                  "_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1customer~1update/put/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/currency/get-all": {
      "get": {
        "tags": [
          "Currency"
        ],
        "parameters": [],
        "description": "Get all currencies",
        "operationId": "currency-get-all",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1currency~1get-main/get/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/price/get-all": {
      "get": {
        "tags": [
          "Price"
        ],
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "inactive"
              ]
            }
          },
          {
            "name": "type",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "sale",
                "income"
              ]
            }
          },
          {
            "name": "currency_id",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "example": "currency_id"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Get all prices",
        "operationId": "price-get-all",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1price~1get-by-id~1%7Bid%7D/get/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/price/items/get-paging": {
      "post": {
        "tags": [
          "Price"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string"
                      },
                      "price_id": {
                        "type": "string"
                      },
                      "product_id": {
                        "type": "string"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "description": "Price items",
        "operationId": "price-items",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1price~1get-by-id~1%7Bid%7D/get/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/discount/create": {
      "post": {
        "tags": [
          "Discount"
        ],
        "description": "This method allows adding discount into the account.",
        "operationId": "discount-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1discount~1update/put/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "organization_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minLength": 1
                  },
                  "auto_attach": {
                    "type": "boolean"
                  },
                  "is_manual": {
                    "type": "boolean"
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "not_started",
                      "active",
                      "expired"
                    ]
                  },
                  "live_type": {
                    "type": "string",
                    "enum": [
                      "forever",
                      "duration"
                    ]
                  },
                  "assign_type": {
                    "type": "string",
                    "enum": [
                      "all",
                      "specific"
                    ]
                  },
                  "apply_type": {
                    "type": "string",
                    "enum": [
                      "percent",
                      "cash"
                    ]
                  },
                  "value": {
                    "type": "number"
                  },
                  "currency_id": {
                    "type": "string"
                  },
                  "starting_date": {
                    "type": "string"
                  },
                  "ending_date": {
                    "type": "string"
                  },
                  "is_all_categories": {
                    "type": "boolean"
                  },
                  "category_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "nested_category_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "item_added_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Product ids"
                  }
                },
                "type": "object",
                "required": [
                  "name",
                  "organization_ids",
                  "is_manual",
                  "auto_attach",
                  "apply_type",
                  "live_type",
                  "assign_type",
                  "value",
                  "currency_id",
                  "starting_date",
                  "ending_date",
                  "is_all_categories",
                  "item_added_ids",
                  "nested_category_ids",
                  "state"
                ]
              }
            }
          }
        }
      }
    },
    "/discount/update": {
      "put": {
        "tags": [
          "Discount"
        ],
        "description": "This method allows updating discount in the account.",
        "operationId": "discount-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "_id": {
                      "type": "string",
                      "description": "id of discount"
                    },
                    "name": {
                      "type": "string"
                    },
                    "organization_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "auto_attach": {
                      "type": "boolean"
                    },
                    "is_manual": {
                      "type": "boolean"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "not_started",
                        "active",
                        "expired"
                      ]
                    },
                    "live_type": {
                      "type": "string",
                      "enum": [
                        "forever",
                        "duration"
                      ]
                    },
                    "assign_type": {
                      "type": "string",
                      "enum": [
                        "all",
                        "specific"
                      ]
                    },
                    "apply_type": {
                      "type": "string",
                      "enum": [
                        "percent",
                        "cash"
                      ]
                    },
                    "value": {
                      "type": "number"
                    },
                    "currency_id": {
                      "type": "string"
                    },
                    "starting_date": {
                      "type": "string"
                    },
                    "ending_date": {
                      "type": "string"
                    },
                    "is_all_categories": {
                      "type": "boolean"
                    },
                    "category_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "nested_category_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "item_added_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "type": "object",
                  "required": [
                    "_id",
                    "name",
                    "auto_attach",
                    "updated_at",
                    "created_at",
                    "is_manual",
                    "state",
                    "live_type",
                    "assign_type",
                    "apply_type",
                    "value",
                    "is_all_categories"
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1discount~1create/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "default": "",
                        "description": "id of customer"
                      }
                    },
                    "required": [
                      "_id"
                    ]
                  }
                ],
                "type": "object",
                "required": [
                  "name",
                  "organization_ids",
                  "is_manual",
                  "auto_attach",
                  "apply_type",
                  "live_type",
                  "assign_type",
                  "value",
                  "currency_id",
                  "starting_date",
                  "ending_date",
                  "is_all_categories",
                  "item_added_ids",
                  "nested_category_ids",
                  "state"
                ]
              }
            }
          }
        }
      }
    },
    "/discount/delete/{id}": {
      "delete": {
        "tags": [
          "Discount"
        ],
        "description": "Delete a discount",
        "operationId": "discount-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/discount/get-by-id/{id}": {
      "get": {
        "tags": [
          "Discount"
        ],
        "description": "Get discount using its _id",
        "operationId": "discount-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1discount~1update/put/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/discount/get-paging": {
      "post": {
        "tags": [
          "Discount"
        ],
        "description": "Get discounts by paging",
        "operationId": "discount-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "apply_type": {
                        "type": "string"
                      },
                      "states": {
                        "type": "string"
                      },
                      "search": {
                        "type": "string"
                      },
                      "currency_id": {
                        "type": "string"
                      },
                      "is_expired": {
                        "type": "boolean"
                      },
                      "organization_ids": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1discount~1update/put/responses/200/content/application~1json/schema"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/discount/get-all": {
      "post": {
        "tags": [
          "Discount"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "apply_type": {
                    "type": "string",
                    "enum": [
                      "percent",
                      "cash"
                    ],
                    "example": "percent"
                  },
                  "currency_id": {
                    "type": "string",
                    "example": "64e5b499189503e999999999"
                  },
                  "organization_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "example": "64e5b499189503e999999999"
                    }
                  },
                  "is_expired": {
                    "type": "boolean",
                    "example": false
                  },
                  "states": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "not_started",
                        "active",
                        "expired"
                      ],
                      "example": "active"
                    }
                  }
                },
                "type": "object"
              }
            }
          }
        },
        "description": "Get all discounts",
        "operationId": "discount-get-all",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1discount~1update/put/responses/200/content/application~1json/schema"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/discount/get-deleted": {
      "get": {
        "tags": [
          "Discount"
        ],
        "description": "Get deleted discount ids",
        "operationId": "discount-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/customer-category/create": {
      "post": {
        "tags": [
          "Customer-category"
        ],
        "description": "This method allows adding customer-category into the account.",
        "operationId": "customer-category-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1customer-category~1update/put/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "type": "string",
                    "default": "",
                    "x-readme-id": "0.0"
                  },
                  "parent_id": {
                    "type": "string"
                  },
                  "organization_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "image": {
                    "type": "string"
                  }
                },
                "type": "object",
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/customer-category/update": {
      "put": {
        "tags": [
          "Customer-category"
        ],
        "description": "This method allows updating customer-category in the account.",
        "operationId": "customer-category-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "_id": {
                      "type": "string",
                      "description": "id of customer-category"
                    },
                    "name": {
                      "type": "string"
                    },
                    "child_count": {
                      "type": "number"
                    },
                    "item_count": {
                      "type": "number"
                    },
                    "image": {
                      "type": "string"
                    },
                    "organization_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "parent": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "type": "object",
                  "required": [
                    "_id",
                    "name",
                    "child_count",
                    "item_count",
                    "updated_at",
                    "created_at",
                    "organization_ids"
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1customer-category~1create/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "default": "",
                        "description": "id of customer-category"
                      }
                    },
                    "required": [
                      "_id"
                    ]
                  }
                ],
                "type": "object",
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/customer-category/delete/{id}": {
      "delete": {
        "tags": [
          "Customer-category"
        ],
        "description": "Delete a customer-category",
        "operationId": "customer-category-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/customer-category/get-by-id/{id}": {
      "get": {
        "tags": [
          "Customer-category"
        ],
        "description": "Get customer-category using its _id",
        "operationId": "customer-category-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1customer-category~1update/put/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/customer-category/get-paging": {
      "post": {
        "tags": [
          "Customer-category"
        ],
        "description": "Get customer-categories by paging",
        "operationId": "customer-category-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "updated_at": {
                        "type": "string"
                      },
                      "organization_id": {
                        "type": "string"
                      },
                      "organization_ids": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1customer-category~1update/put/responses/200/content/application~1json/schema"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/customer-category/get-deleted": {
      "get": {
        "tags": [
          "Customer-category"
        ],
        "description": "Get deleted customer-category ids",
        "operationId": "customer-category-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/product-stock/get-paging": {
      "post": {
        "tags": [
          "Product-stock"
        ],
        "description": "Get product-stocks by paging",
        "operationId": "product-stock-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string"
                      },
                      "warehouse_id": {
                        "type": "string"
                      },
                      "product_id": {
                        "type": "string"
                      },
                      "states": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "is_marked": {
                        "type": "boolean"
                      },
                      "search": {
                        "type": "string"
                      },
                      "nin": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "purchase_id": {
                        "type": "string"
                      },
                      "trade_id": {
                        "type": "string"
                      },
                      "category_id": {
                        "type": "string"
                      },
                      "sort": {
                        "type": "object",
                        "properties": {
                          "amount": {
                            "type": "boolean"
                          },
                          "name": {
                            "type": "number",
                            "description": "asc 1 , desc -1"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "properties": {
                                  "product": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "measure": {
                                        "type": "object",
                                        "properties": {
                                          "_id": {
                                            "type": "string"
                                          },
                                          "system_code": {
                                            "type": "string"
                                          },
                                          "code": {
                                            "type": "string"
                                          },
                                          "short_name": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          },
                                          "decimal_count": {
                                            "type": "number"
                                          }
                                        },
                                        "required": [
                                          "_id",
                                          "name",
                                          "decimal_count"
                                        ]
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "barcode": {
                                        "type": "string"
                                      },
                                      "sku": {
                                        "type": "string"
                                      },
                                      "box_item": {
                                        "type": "number"
                                      },
                                      "box_type": {
                                        "type": "object",
                                        "properties": {
                                          "_id": {
                                            "type": "string"
                                          },
                                          "code": {
                                            "type": "string"
                                          },
                                          "short_name": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "_id",
                                          "name"
                                        ]
                                      }
                                    }
                                  },
                                  "purchase_id": {
                                    "type": "string"
                                  },
                                  "trade_id": {
                                    "type": "string"
                                  },
                                  "organization": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "_id",
                                      "name"
                                    ]
                                  },
                                  "warehouse": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "_id",
                                      "name"
                                    ]
                                  },
                                  "state": {
                                    "type": "string"
                                  },
                                  "mark": {
                                    "type": "string"
                                  },
                                  "cost": {
                                    "type": "number"
                                  },
                                  "amount": {
                                    "type": "number"
                                  },
                                  "cost_currency_id": {
                                    "type": "string"
                                  },
                                  "initial_cost": {
                                    "type": "number"
                                  },
                                  "initial_cost_currency_id": {
                                    "type": "string"
                                  },
                                  "created_at": {
                                    "type": "string"
                                  },
                                  "updated_at": {
                                    "type": "string"
                                  },
                                  "income_id": {
                                    "type": "string"
                                  },
                                  "revision_id": {
                                    "type": "string"
                                  },
                                  "transfer_id": {
                                    "type": "string"
                                  },
                                  "write_off_id": {
                                    "type": "string"
                                  },
                                  "purchase_return_id": {
                                    "type": "string"
                                  },
                                  "production_operation_id": {
                                    "type": "string"
                                  },
                                  "operation_item_id": {
                                    "type": "string"
                                  },
                                  "total": {
                                    "type": "number"
                                  },
                                  "income_date": {
                                    "type": "string"
                                  }
                                },
                                "type": "object",
                                "required": [
                                  "product_id",
                                  "product",
                                  "organization_id",
                                  "uuid",
                                  "state",
                                  "amount",
                                  "cost",
                                  "initial_cost",
                                  "is_in_account"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/product-stock/get-by-mark": {
      "post": {
        "tags": [
          "Product-stock"
        ],
        "description": "Get the product that a marked (serial/IMEI) stock belongs to, enriched for sale (prices, taxes, available quantity). When warehouse_id is omitted, the organization's main warehouse is used. Returns a not-found error if no stock matches the mark.",
        "operationId": "product-stock-get-by-mark",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "mark",
                  "organization_id"
                ],
                "properties": {
                  "mark": {
                    "type": "string",
                    "description": "Mark (serial/IMEI) of the marked product-stock to look up"
                  },
                  "organization_id": {
                    "type": "string",
                    "description": "Organization id the stock belongs to"
                  },
                  "warehouse_id": {
                    "type": "string",
                    "description": "Warehouse id. When omitted, the organization's main warehouse is used"
                  },
                  "states": {
                    "type": "array",
                    "description": "Optional product-stock states to filter by (e.g. stock, sold)",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "description": "The product the looked-up mark belongs to, enriched for sale (prices, taxes, available quantity)",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "sku": {
                              "type": "string"
                            },
                            "barcode": {
                              "type": "string"
                            },
                            "image": {
                              "type": "string"
                            },
                            "measure_id": {
                              "type": "string"
                            },
                            "measure": {
                              "type": "object"
                            },
                            "box_item": {
                              "type": "number"
                            },
                            "is_marked": {
                              "type": "boolean"
                            },
                            "is_compound": {
                              "type": "boolean"
                            },
                            "is_service": {
                              "type": "boolean"
                            },
                            "category": {
                              "type": "object"
                            },
                            "prices": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            },
                            "taxes": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            },
                            "cost": {
                              "type": "number"
                            },
                            "cost_currency_id": {
                              "type": "string"
                            },
                            "quantity": {
                              "type": "number",
                              "description": "Available amount of the product in the resolved warehouse"
                            },
                            "parent_id": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/product-warehouse/get-paging": {
      "post": {
        "tags": [
          "Product-warehouse"
        ],
        "description": "Get product-warehouses by paging",
        "operationId": "product-warehouse-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "updated_at": {
                        "type": "string"
                      },
                      "organization_id": {
                        "type": "string"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "product_id": {
                                    "type": "string"
                                  },
                                  "warehouse_id": {
                                    "type": "string"
                                  },
                                  "organization_id": {
                                    "type": "string"
                                  },
                                  "amount": {
                                    "type": "number"
                                  },
                                  "in_transit": {
                                    "type": "number"
                                  },
                                  "in_trash": {
                                    "type": "number"
                                  },
                                  "booked": {
                                    "type": "number"
                                  }
                                },
                                "type": "object",
                                "required": [
                                  "product_id",
                                  "organization_id",
                                  "warehouse_id"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/product-warehouse/get-deleted": {
      "get": {
        "tags": [
          "Product-warehouse"
        ],
        "description": "Get deleted product-warehouse ids",
        "operationId": "product-warehouse-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/warehouse/get-by-id/{id}": {
      "get": {
        "tags": [
          "Warehouse"
        ],
        "description": "Get warehouse using its _id",
        "operationId": "warehouse-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "is-main": {
                              "type": "boolean"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "inactive"
                              ]
                            },
                            "order_number": {
                              "type": "number"
                            },
                            "note": {
                              "type": "string"
                            },
                            "shape": {
                              "type": "string",
                              "enum": [
                                "rectangle",
                                "circular",
                                "other"
                              ]
                            },
                            "height": {
                              "type": "number"
                            },
                            "width": {
                              "type": "number"
                            },
                            "length": {
                              "type": "number"
                            },
                            "diameter": {
                              "type": "number"
                            },
                            "volume": {
                              "type": "number"
                            },
                            "address": {
                              "type": "string"
                            },
                            "recommended_temperature": {
                              "type": "number"
                            },
                            "recommended_humidity": {
                              "type": "number"
                            },
                            "coordinates": {
                              "type": "object",
                              "properties": {
                                "lat": {
                                  "type": "number"
                                },
                                "long": {
                                  "type": "number"
                                }
                              }
                            },
                            "updated_by": {
                              "type": "string"
                            },
                            "is_default": {
                              "type": "boolean"
                            },
                            "updated_by_user": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                }
                              }
                            },
                            "created_by_user": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                }
                              }
                            },
                            "responsible_employee": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                }
                              }
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "organization": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "warehouse_type": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "order_number": {
                                  "type": "number"
                                },
                                "status": {
                                  "type": "string",
                                  "enum": [
                                    "active",
                                    "inactive"
                                  ]
                                },
                                "is_default": {
                                  "type": "boolean"
                                }
                              }
                            }
                          },
                          "type": "object",
                          "required": [
                            "name"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/warehouse/get-paging": {
      "post": {
        "tags": [
          "Warehouse"
        ],
        "description": "Get warehouse by paging",
        "operationId": "warehouse-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1warehouse~1get-all/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1warehouse~1get-by-id~1%7Bid%7D/get/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/warehouse/get-all": {
      "post": {
        "tags": [
          "Warehouse"
        ],
        "parameters": [],
        "description": "Get all warehouses",
        "operationId": "warehouse-get-all",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string"
                      },
                      "organization_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d800"
                      },
                      "is_main": {
                        "type": "boolean"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "active",
                          "inactive"
                        ]
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1warehouse~1get-by-id~1%7Bid%7D/get/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/warehouse/get-deleted": {
      "get": {
        "tags": [
          "Warehouse"
        ],
        "description": "Get deleted warehouse ids",
        "operationId": "warehouse-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/sale-order/create": {
      "post": {
        "tags": [
          "Sale-order"
        ],
        "description": "Create a sale order. The optional uuid field is tenant-global among active sale orders. The authenticated integration source gates replay: a same-source replay returns the active existing order, while an active UUID owned by another or missing source returns the existing sale-order collision error. Omitting uuid preserves normal creation behavior. After an order is soft-deleted, its UUID may be reused.",
        "operationId": "sale-order-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1sale-order~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error envelope. In particular, an active UUID owned by another integration source (or with no source ownership) returns the existing sale-order AlreadyExists collision error instead of exposing or reusing that order.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "number",
                      "description": "system code of response",
                      "default": 0
                    },
                    "message": {
                      "type": "string",
                      "example": "Success"
                    },
                    "status_code": {
                      "type": "number",
                      "description": "status code of response",
                      "default": 200
                    },
                    "messages": {
                      "type": "object",
                      "properties": {
                        "uz": {
                          "type": "string",
                          "example": "Muvaffaqiyatli"
                        },
                        "ru": {
                          "type": "string",
                          "example": "Успешно"
                        },
                        "en": {
                          "type": "string",
                          "example": "Successful"
                        }
                      }
                    },
                    "time": {
                      "type": "string",
                      "format": "date-time",
                      "description": "time of response",
                      "example": "2025-05-01T12:00:00Z"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "status_code",
                    "messages",
                    "time"
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "uuid": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "\\S",
                    "example": "external-order-123",
                    "description": "Optional external idempotency key. UUID uniqueness is tenant-global among active sale orders. The authenticated integration source gates replay: if it owns the active UUID, the existing order is returned; an active UUID owned by another or missing source returns the sale-order AlreadyExists collision. Source ownership is never accepted from the request body. After an order is soft-deleted, its UUID may be reused."
                  },
                  "code": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "organization_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "visit_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "customer_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "customer_assistant_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "responsible_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "currency_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "currency": {
                    "type": "object",
                    "required": [
                      "numerator",
                      "denominator",
                      "value"
                    ],
                    "properties": {
                      "_id": {
                        "type": "string",
                        "format": "objectId",
                        "example": "66126f4b1e2f4a9cb4244c8f"
                      },
                      "numerator": {
                        "type": "number",
                        "minimum": 1e-7,
                        "example": 1
                      },
                      "denominator": {
                        "type": "number",
                        "minimum": 1e-7,
                        "example": 1000
                      },
                      "value": {
                        "type": "number",
                        "minimum": 1e-7,
                        "example": 11000
                      },
                      "precision": {
                        "type": "number",
                        "example": 3
                      },
                      "round_type": {
                        "type": "string",
                        "enum": [
                          "floor",
                          "ceil",
                          "round"
                        ],
                        "example": "floor"
                      }
                    }
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "new",
                      "draft",
                      "in_progress",
                      "canceled",
                      "done",
                      "accepted"
                    ]
                  },
                  "state_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "date": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1update/put/requestBody/content/application~1json/schema/properties/date/example"
                    }
                  },
                  "delivery_date": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1update/put/requestBody/content/application~1json/schema/properties/date/example"
                    }
                  },
                  "note": {
                    "type": "string",
                    "description": "Complete order note. Integration creates preserve long courier, pickup, and customer instructions; the API request-body limit still applies."
                  },
                  "discounts": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "value",
                        "name"
                      ],
                      "properties": {
                        "_id": {
                          "type": "string",
                          "format": "objectId",
                          "example": "66126f4b1e2f4a9cb4244c90"
                        },
                        "value": {
                          "type": "number",
                          "example": 10
                        },
                        "name": {
                          "type": "string",
                          "example": "10%"
                        },
                        "apply_type": {
                          "type": "string",
                          "enum": [
                            "percent",
                            "cash"
                          ],
                          "example": "percent"
                        },
                        "is_custom": {
                          "type": "boolean",
                          "example": true
                        }
                      }
                    }
                  },
                  "products": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "product_id",
                        "amount",
                        "price",
                        "price_id",
                        "warehouse_id"
                      ],
                      "properties": {
                        "product_id": {
                          "type": "string",
                          "format": "objectId",
                          "example": "66126f4b1e2f4a9cb4244a01"
                        },
                        "amount": {
                          "type": "number",
                          "minimum": 1e-7,
                          "example": 2
                        },
                        "price": {
                          "type": "number",
                          "minimum": 0,
                          "example": 15000
                        },
                        "real_price": {
                          "type": "number",
                          "minimum": 0,
                          "example": 14500
                        },
                        "discounts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "value",
                              "name"
                            ],
                            "properties": {
                              "_id": {
                                "type": "string",
                                "format": "objectId",
                                "example": "66126f4b1e2f4a9cb4244c90"
                              },
                              "value": {
                                "type": "number",
                                "example": 10
                              },
                              "name": {
                                "type": "string",
                                "example": "10%"
                              },
                              "apply_type": {
                                "type": "string",
                                "enum": [
                                  "percent",
                                  "cash"
                                ],
                                "example": "percent"
                              },
                              "is_custom": {
                                "type": "boolean",
                                "example": true
                              }
                            }
                          }
                        },
                        "price_id": {
                          "type": "string",
                          "format": "objectId",
                          "example": "66126f4b1e2f4a9cb4244a02"
                        },
                        "warehouse_id": {
                          "type": "string",
                          "format": "objectId",
                          "example": "66126f4b1e2f4a9cb4244a03"
                        },
                        "box_count": {
                          "type": "number",
                          "minimum": 0,
                          "example": 2
                        },
                        "box_item": {
                          "type": "number",
                          "minimum": 0,
                          "example": 24
                        },
                        "product": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "product_id": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "measure_id": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "measure": {
                              "type": "object",
                              "properties": {
                                "system_code": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "short_name": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "decimal_count": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "system_code",
                                "code",
                                "short_name",
                                "name",
                                "decimal_count"
                              ]
                            }
                          }
                        }
                      }
                    }
                  },
                  "delivery_address": {
                    "type": "object",
                    "properties": {
                      "long": {
                        "type": "number"
                      },
                      "lat": {
                        "type": "number"
                      },
                      "human_address": {
                        "type": "object",
                        "properties": {
                          "addres": {
                            "type": "string"
                          },
                          "city": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string"
                          },
                          "zip": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "required": [
                      "long",
                      "lat"
                    ]
                  },
                  "price_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1update/put/requestBody/content/application~1json/schema/properties/date/example"
                    }
                  },
                  "custom_fields": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "example": {
                          "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                        }
                      },
                      "value": {
                        "type": "object"
                      }
                    }
                  }
                },
                "type": "object",
                "required": [
                  "state",
                  "products",
                  "organization_id",
                  "customer_id",
                  "date",
                  "discounts",
                  "responsible_id"
                ]
              }
            }
          }
        }
      }
    },
    "/sale-order/update": {
      "put": {
        "tags": [
          "Sale-order"
        ],
        "description": "This method allows updating saler-order in the account.",
        "operationId": "saler-order-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "created_at": {
                              "type": "string"
                            },
                            "updated_at": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "uuid": {
                              "type": "string",
                              "example": "external-order-123"
                            },
                            "visit_id": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "code": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "organization_id": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "organization": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "_id",
                                "name"
                              ]
                            },
                            "customer_id": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "customer": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "legal",
                                    "natural"
                                  ]
                                },
                                "phone_number": {
                                  "type": "string"
                                },
                                "phone_numbers": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "name": {
                                  "type": "string"
                                },
                                "image": {
                                  "type": "string"
                                },
                                "custom_fields": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "value": {
                                        "type": "object"
                                      }
                                    }
                                  }
                                }
                              },
                              "required": [
                                "_id",
                                "name",
                                "type"
                              ]
                            },
                            "customer_assistant": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "legal",
                                    "natural"
                                  ]
                                }
                              }
                            },
                            "customer_assistant_hierarchy": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "legal",
                                      "natural"
                                    ]
                                  },
                                  "first_name": {
                                    "type": "string"
                                  },
                                  "last_name": {
                                    "type": "string"
                                  },
                                  "middle_name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              }
                            },
                            "responsible_id": {
                              "type": "string"
                            },
                            "customer_image_url": {
                              "type": "string"
                            },
                            "responsible": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "_id",
                                "full_name"
                              ]
                            },
                            "price_id": {
                              "type": "string"
                            },
                            "price": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "short_name": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "_id",
                                "name"
                              ]
                            },
                            "state_id": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "new",
                                "draw",
                                "in_progress",
                                "canceled",
                                "done",
                                "accepted"
                              ]
                            },
                            "note": {
                              "type": "string"
                            },
                            "date": {
                              "type": "string"
                            },
                            "delivery_date": {
                              "type": "string"
                            },
                            "number": {
                              "type": "string"
                            },
                            "device": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "device_id": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "_id",
                                "name",
                                "device_id"
                              ]
                            },
                            "currency": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "format": "objectId",
                                  "example": "66126f4b1e2f4a9cb4244c8b"
                                },
                                "to_currency_id": {
                                  "type": "string",
                                  "format": "objectId",
                                  "example": "66126f4b1e2f4a9cb4244c8c"
                                },
                                "uuid": {
                                  "type": "number",
                                  "example": "66126f4b1e2f4a9cb4244c8d"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "number",
                                  "example": 1
                                },
                                "symbol": {
                                  "type": "string"
                                },
                                "side": {
                                  "type": "string",
                                  "enum": [
                                    "start",
                                    "end"
                                  ],
                                  "example": "start"
                                },
                                "numerator": {
                                  "type": "number",
                                  "example": 1
                                },
                                "denominator": {
                                  "type": "number",
                                  "example": 1
                                },
                                "round_type": {
                                  "type": "string",
                                  "enum": [
                                    "floor",
                                    "ceil",
                                    "round"
                                  ],
                                  "example": "floor"
                                },
                                "precision": {
                                  "type": "number",
                                  "example": 3
                                }
                              },
                              "required": [
                                "to_currency_id",
                                "name",
                                "value",
                                "numerator",
                                "denominator",
                                "round_type",
                                "precision"
                              ]
                            },
                            "currency_id": {
                              "type": "string"
                            },
                            "total_to_pay": {
                              "type": "number"
                            },
                            "total_price": {
                              "type": "number"
                            },
                            "discount": {
                              "type": "number"
                            },
                            "total_discount": {
                              "type": "number"
                            },
                            "discounts": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "required": [
                                  "name",
                                  "value",
                                  "apply_type"
                                ],
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "type": "number"
                                  },
                                  "apply_type": {
                                    "type": "string",
                                    "enum": [
                                      "percent",
                                      "cash"
                                    ]
                                  },
                                  "currency_id": {
                                    "type": "string"
                                  }
                                }
                              }
                            },
                            "products": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            },
                            "delivery_address": {
                              "type": "object",
                              "required": [
                                "long",
                                "lat"
                              ],
                              "properties": {
                                "long": {
                                  "type": "number"
                                },
                                "lat": {
                                  "type": "number"
                                },
                                "human_address": {
                                  "type": "object",
                                  "properties": {
                                    "addres": {
                                      "type": "string"
                                    },
                                    "city": {
                                      "type": "string"
                                    },
                                    "state": {
                                      "type": "string"
                                    },
                                    "zip": {
                                      "type": "string"
                                    }
                                  }
                                }
                              }
                            },
                            "total_sale": {
                              "type": "number"
                            },
                            "total_amount": {
                              "type": "number"
                            },
                            "trade_status": {
                              "type": "string",
                              "enum": [
                                "zero",
                                "partial",
                                "fully"
                              ]
                            },
                            "trades": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "b2b",
                                      "b2c"
                                    ]
                                  },
                                  "organization_id": {
                                    "type": "string"
                                  },
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "new",
                                      "in_progress",
                                      "draft",
                                      "canceled",
                                      "done"
                                    ]
                                  },
                                  "state_id": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "string"
                                  },
                                  "uuid": {
                                    "type": "number"
                                  },
                                  "currency": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "to_currency_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "numerator": {
                                        "type": "number"
                                      },
                                      "denominator": {
                                        "type": "number"
                                      },
                                      "round_type": {
                                        "type": "string",
                                        "enum": [
                                          "floor",
                                          "ceil",
                                          "round"
                                        ]
                                      },
                                      "precision": {
                                        "type": "number"
                                      }
                                    }
                                  },
                                  "cashbox_id": {
                                    "type": "string"
                                  },
                                  "calc_tax_after_discount": {
                                    "type": "boolean"
                                  },
                                  "sale_settings": {
                                    "type": "object",
                                    "required": [
                                      "discount"
                                    ],
                                    "properties": {
                                      "discount": {
                                        "type": "number"
                                      }
                                    }
                                  },
                                  "total_extra_cost": {
                                    "type": "number"
                                  },
                                  "total_effected_extra_cost": {
                                    "type": "number"
                                  }
                                }
                              }
                            },
                            "custom_fields": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          },
                          "type": "object",
                          "required": [
                            "_id",
                            "uuid",
                            "organization_id",
                            "customer_id",
                            "responsible_id",
                            "state",
                            "state_id",
                            "number",
                            "date",
                            "currency"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "code": {
                    "type": "string",
                    "example": ""
                  },
                  "name": {
                    "type": "string",
                    "example": ""
                  },
                  "organization_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "visit_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "customer_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "customer_assistant_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "responsible_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "currency_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "currency": {
                    "type": "object",
                    "required": [
                      "numerator",
                      "denominator",
                      "value"
                    ],
                    "properties": {
                      "_id": {
                        "type": "string",
                        "format": "objectId",
                        "example": "66126f4b1e2f4a9cb4244c8f"
                      },
                      "numerator": {
                        "type": "number",
                        "minimum": 1e-7,
                        "example": 1
                      },
                      "denominator": {
                        "type": "number",
                        "minimum": 1e-7,
                        "example": 1000
                      },
                      "value": {
                        "type": "number",
                        "minimum": 1e-7,
                        "example": 11000
                      },
                      "precision": {
                        "type": "number",
                        "example": 3
                      },
                      "round_type": {
                        "type": "string",
                        "enum": [
                          "floor",
                          "ceil",
                          "round"
                        ],
                        "example": "floor"
                      }
                    }
                  },
                  "date": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1update/put/requestBody/content/application~1json/schema/properties/date/example"
                    }
                  },
                  "delivery_date": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1update/put/requestBody/content/application~1json/schema/properties/date/example"
                    }
                  },
                  "note": {
                    "type": "string"
                  },
                  "discounts": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "value",
                        "name"
                      ],
                      "properties": {
                        "_id": {
                          "type": "string",
                          "format": "objectId",
                          "example": "66126f4b1e2f4a9cb4244c90"
                        },
                        "value": {
                          "type": "number",
                          "example": 10
                        },
                        "name": {
                          "type": "string",
                          "example": "10%"
                        },
                        "discount_apply_type": {
                          "type": "string",
                          "enum": [
                            "percentage",
                            "cash"
                          ],
                          "example": "percentage"
                        },
                        "currency_id": {
                          "type": "string",
                          "format": "objectId",
                          "example": "66126f4b1e2f4a9cb4244c91"
                        }
                      }
                    }
                  },
                  "products": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "product_id",
                        "amount",
                        "price",
                        "price_id",
                        "warehouse_id"
                      ],
                      "properties": {
                        "product_id": {
                          "type": "string",
                          "format": "objectId",
                          "example": "66126f4b1e2f4a9cb4244a01"
                        },
                        "amount": {
                          "type": "number",
                          "minimum": 1e-7,
                          "example": 2
                        },
                        "price": {
                          "type": "number",
                          "minimum": 0,
                          "example": 15000
                        },
                        "real_price": {
                          "type": "number",
                          "minimum": 0,
                          "example": 14500
                        },
                        "discounts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "value",
                              "name"
                            ],
                            "properties": {
                              "_id": {
                                "type": "string",
                                "format": "objectId",
                                "example": "66126f4b1e2f4a9cb4244c90"
                              },
                              "value": {
                                "type": "number",
                                "example": 10
                              },
                              "name": {
                                "type": "string",
                                "example": "10%"
                              },
                              "discount_apply_type": {
                                "type": "string",
                                "enum": [
                                  "percent",
                                  "cash"
                                ],
                                "example": "percent"
                              },
                              "currency_id": {
                                "type": "string",
                                "format": "objectId",
                                "example": "66126f4b1e2f4a9cb4244c91"
                              }
                            }
                          }
                        },
                        "price_id": {
                          "type": "string",
                          "format": "objectId",
                          "example": "66126f4b1e2f4a9cb4244a02"
                        },
                        "warehouse_id": {
                          "type": "string",
                          "format": "objectId",
                          "example": "66126f4b1e2f4a9cb4244a03"
                        },
                        "box_count": {
                          "type": "number",
                          "minimum": 0,
                          "example": 2
                        },
                        "box_item": {
                          "type": "number",
                          "minimum": 0,
                          "example": 24
                        },
                        "product": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "product_id": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "measure_id": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "measure": {
                              "type": "object",
                              "properties": {
                                "system_code": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "short_name": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "decimal_count": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "system_code",
                                "code",
                                "short_name",
                                "name",
                                "decimal_count"
                              ]
                            }
                          }
                        }
                      }
                    }
                  },
                  "delivery_address": {
                    "type": "object",
                    "properties": {
                      "long": {
                        "type": "number"
                      },
                      "lat": {
                        "type": "number"
                      },
                      "human_address": {
                        "type": "object",
                        "properties": {
                          "addres": {
                            "type": "string"
                          },
                          "city": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string"
                          },
                          "zip": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "required": [
                      "long",
                      "lat"
                    ]
                  },
                  "price_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1update/put/requestBody/content/application~1json/schema/properties/date/example"
                    }
                  },
                  "custom_fields": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "example": {
                          "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                        }
                      },
                      "value": {
                        "type": "string",
                        "example": "any",
                        "description": "must be any data types"
                      }
                    }
                  },
                  "is_offline": {
                    "type": "boolean"
                  }
                },
                "type": "object",
                "required": [
                  "_id",
                  "products",
                  "discounts",
                  "currency_id"
                ]
              }
            }
          }
        }
      }
    },
    "/sale-order/delete/{id}": {
      "delete": {
        "tags": [
          "Sale-order"
        ],
        "description": "Delete a sale-order",
        "operationId": "sale-order-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sale-order/get-by-id/{id}": {
      "get": {
        "tags": [
          "Sale-order"
        ],
        "description": "Get sale-order using its _id",
        "operationId": "sale-order-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1sale-order~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sale-order/get-paging": {
      "post": {
        "tags": [
          "Sale-order"
        ],
        "description": "Get sale-orders by paging",
        "operationId": "sale-order-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string",
                        "example": {
                          "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                        }
                      },
                      "customer_id": {
                        "type": "string",
                        "example": {
                          "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                        }
                      },
                      "currency_id": {
                        "type": "string",
                        "example": {
                          "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                        }
                      },
                      "states": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "search": {
                        "type": "string"
                      },
                      "date_form": {
                        "type": "string",
                        "example": {
                          "$ref": "#/paths/~1task~1update/put/requestBody/content/application~1json/schema/properties/date/example"
                        }
                      },
                      "date_to": {
                        "type": "string",
                        "example": {
                          "$ref": "#/paths/~1task~1update/put/requestBody/content/application~1json/schema/properties/date/example"
                        }
                      },
                      "delivery_date_from": {
                        "type": "string",
                        "example": {
                          "$ref": "#/paths/~1task~1update/put/requestBody/content/application~1json/schema/properties/date/example"
                        }
                      },
                      "delivery_date_to": {
                        "type": "string",
                        "example": {
                          "$ref": "#/paths/~1task~1update/put/requestBody/content/application~1json/schema/properties/date/example"
                        }
                      },
                      "created_from_bot": {
                        "type": "boolean"
                      },
                      "trade_statuses": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "visit_id": {
                        "type": "string",
                        "example": {
                          "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                        }
                      },
                      "state_id": {
                        "type": "string",
                        "example": {
                          "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                        }
                      },
                      "name": {
                        "type": "string"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "properties": {
                                  "created_at": {
                                    "type": "string"
                                  },
                                  "updated_at": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "uuid": {
                                    "type": "string",
                                    "example": "external-order-123"
                                  },
                                  "code": {
                                    "type": "string"
                                  },
                                  "organization": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "_id",
                                      "name"
                                    ]
                                  },
                                  "customer": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "type": {
                                        "type": "string",
                                        "enum": [
                                          "legal",
                                          "natural"
                                        ]
                                      },
                                      "phone_number": {
                                        "type": "string"
                                      },
                                      "phone_numbers": {
                                        "type": "array",
                                        "items": {
                                          "type": "string"
                                        }
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "image": {
                                        "type": "string"
                                      },
                                      "custom_fields": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "_id": {
                                              "type": "string"
                                            },
                                            "value": {
                                              "type": "object"
                                            }
                                          }
                                        }
                                      }
                                    },
                                    "required": [
                                      "_id",
                                      "name",
                                      "type"
                                    ]
                                  },
                                  "customer_image_url": {
                                    "type": "string"
                                  },
                                  "responsible": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "_id",
                                      "full_name"
                                    ]
                                  },
                                  "state_id": {
                                    "type": "string",
                                    "example": {
                                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                    }
                                  },
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "new",
                                      "draw",
                                      "in_progress",
                                      "canceled",
                                      "done",
                                      "accepted"
                                    ]
                                  },
                                  "note": {
                                    "type": "string"
                                  },
                                  "date": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "string"
                                  },
                                  "currency_id": {
                                    "type": "string"
                                  },
                                  "total_to_pay": {
                                    "type": "number"
                                  },
                                  "total_price": {
                                    "type": "number"
                                  },
                                  "total_discount": {
                                    "type": "number"
                                  },
                                  "total_sale": {
                                    "type": "number"
                                  },
                                  "total_amount": {
                                    "type": "number"
                                  },
                                  "trade_status": {
                                    "type": "string",
                                    "enum": [
                                      "zero",
                                      "partial",
                                      "fully"
                                    ]
                                  },
                                  "created_from_bot": {
                                    "type": "boolean"
                                  },
                                  "position": {
                                    "type": "number"
                                  },
                                  "task": {
                                    "type": "object",
                                    "properties": {
                                      "type_id": {
                                        "type": "string",
                                        "example": {
                                          "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                        }
                                      },
                                      "date": {
                                        "type": "string",
                                        "example": {
                                          "$ref": "#/paths/~1task~1update/put/requestBody/content/application~1json/schema/properties/date/example"
                                        }
                                      },
                                      "created_by": {
                                        "type": "string",
                                        "example": {
                                          "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                        }
                                      },
                                      "responsible_id": {
                                        "type": "string",
                                        "example": {
                                          "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                        }
                                      }
                                    }
                                  }
                                },
                                "type": "object",
                                "required": [
                                  "uuid",
                                  "state",
                                  "state_id",
                                  "number",
                                  "date"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/sale-order/get-deleted": {
      "get": {
        "tags": [
          "Sale-order"
        ],
        "description": "Get deleted sale-order ids",
        "operationId": "sale-order-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/attribute/create": {
      "post": {
        "tags": [
          "Attribute"
        ],
        "description": "This method allows adding attribute into the account.",
        "operationId": "attribute-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1attribute~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "type": "string",
                    "default": ""
                  },
                  "is_active": {
                    "type": "boolean",
                    "default": true
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "type": "object",
                "required": [
                  "name",
                  "items",
                  "is_active"
                ]
              }
            }
          }
        }
      }
    },
    "/attribute/update": {
      "put": {
        "tags": [
          "Attribute"
        ],
        "description": "This method allows updating attribute in the account.",
        "operationId": "attribute-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "is_active": {
                              "type": "boolean"
                            },
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "attribute_id": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "_id"
                                ]
                              }
                            }
                          },
                          "type": "object",
                          "required": [
                            "_id"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "default": "",
                    "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                  },
                  "name": {
                    "type": "string",
                    "default": ""
                  },
                  "is_active": {
                    "type": "boolean",
                    "default": true
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "type": "object"
              }
            }
          }
        }
      }
    },
    "/attribute/get-all": {
      "get": {
        "tags": [
          "Attribute"
        ],
        "description": "Get all attributes",
        "operationId": "attribute-get-all",
        "parameters": [
          {
            "name": "is_active",
            "required": false,
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1attribute~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/attribute/get-by-id/{id}": {
      "get": {
        "tags": [
          "Attribute"
        ],
        "description": "Get attribute using its _id",
        "operationId": "attribute-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1attribute~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/attribute/get-paging": {
      "post": {
        "tags": [
          "Attribute"
        ],
        "description": "Get attributes by paging",
        "operationId": "attribute-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string"
                      },
                      "is_active": {
                        "type": "boolean"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1attribute~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/booking-table/create": {
      "post": {
        "tags": [
          "Booking-table"
        ],
        "description": "This method allows adding booking-table into the account.",
        "operationId": "booking-table-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1booking-table~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "type": "string",
                    "default": ""
                  },
                  "organization_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "order": {
                    "type": "number"
                  }
                },
                "type": "object",
                "required": [
                  "name",
                  "organization_id"
                ]
              }
            }
          }
        }
      }
    },
    "/booking-table/update": {
      "put": {
        "tags": [
          "Booking-table"
        ],
        "description": "This method allows updating booking-table in the account.",
        "operationId": "booking-table-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "order": {
                              "type": "number"
                            },
                            "organization_id": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            }
                          },
                          "type": "object",
                          "required": [
                            "_id",
                            "name",
                            "order",
                            "organization_id"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "default": "",
                    "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                  },
                  "name": {
                    "type": "string",
                    "default": ""
                  },
                  "order": {
                    "type": "number"
                  }
                },
                "type": "object",
                "required": [
                  "order"
                ]
              }
            }
          }
        }
      }
    },
    "/booking-table/delete/{id}": {
      "delete": {
        "tags": [
          "Booking-table"
        ],
        "description": "Delete a booking-table",
        "operationId": "booking-table-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/booking-table/get-all": {
      "get": {
        "tags": [
          "Booking-table"
        ],
        "parameters": [
          {
            "name": "organization_id",
            "in": "query",
            "description": "Organization ID",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Get all booking-tables",
        "operationId": "booking-table-get-all",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1booking-table~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/booking-table/get-by-id/{id}": {
      "get": {
        "tags": [
          "Booking-table"
        ],
        "description": "Get booking-table using its _id",
        "operationId": "booking-table-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1booking-table~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/booking-table/get-deleted": {
      "get": {
        "tags": [
          "Booking-table"
        ],
        "description": "Get deleted booking-table ids",
        "operationId": "booking-table-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/box-types/create": {
      "post": {
        "tags": [
          "Box-types"
        ],
        "description": "This method allows adding box-types into the account.",
        "operationId": "box-types-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1box-types~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "type": "string",
                    "default": ""
                  },
                  "short_name": {
                    "type": "string",
                    "default": ""
                  },
                  "code": {
                    "type": "string",
                    "default": ""
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "inactive"
                    ],
                    "default": "active"
                  }
                },
                "type": "object",
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/box-types/update": {
      "put": {
        "tags": [
          "Box-types"
        ],
        "description": "This method allows updating box-types in the account.",
        "operationId": "box-types-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "short_name": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "inactive"
                              ]
                            }
                          },
                          "type": "object",
                          "required": [
                            "name"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "name": {
                    "type": "string",
                    "default": ""
                  },
                  "short_name": {
                    "type": "string",
                    "default": ""
                  },
                  "code": {
                    "type": "string",
                    "default": ""
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "inactive"
                    ],
                    "default": "active"
                  }
                },
                "type": "object",
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/box-types/delete/{id}": {
      "delete": {
        "tags": [
          "Box-types"
        ],
        "description": "Delete a box-types",
        "operationId": "box-types-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/box-types/get-all": {
      "get": {
        "tags": [
          "Box-types"
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Search box-types",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Get all box-typess",
        "operationId": "box-types-get-all",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1box-types~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/box-types/get-by-id/{id}": {
      "get": {
        "tags": [
          "Box-types"
        ],
        "description": "Get box-types using its _id",
        "operationId": "box-types-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1box-types~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/box-types/get-deleted": {
      "get": {
        "tags": [
          "Box-types"
        ],
        "description": "Get deleted box-types ids",
        "operationId": "box-types-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/box-types/get-paging": {
      "post": {
        "tags": [
          "Box-types"
        ],
        "description": "Get box-types by paging",
        "operationId": "box-types-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "short_name": {
                        "type": "string"
                      },
                      "code": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "active",
                          "inactive"
                        ]
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "code": {
                                    "type": "string"
                                  },
                                  "short_name": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "active",
                                      "inactive"
                                    ]
                                  },
                                  "updated_by_user": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "created_by_user": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "created_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "updated_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "is_default": {
                                    "type": "boolean"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/cashback-setting/create": {
      "post": {
        "tags": [
          "Cashback-settings"
        ],
        "description": "This method allows adding cashback-settings into the account.",
        "operationId": "cashback-settings-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1cashback-setting~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "by_amount",
                      "all"
                    ],
                    "default": "by_amount"
                  },
                  "is_active": {
                    "type": "boolean",
                    "default": true
                  },
                  "organization_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "organization_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                    }
                  },
                  "cashbacks": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "cashback_type": {
                          "type": "string",
                          "enum": [
                            "percent",
                            "cash"
                          ],
                          "default": "percent"
                        },
                        "min_amount": {
                          "type": "number"
                        },
                        "amount": {
                          "type": "number"
                        },
                        "percent": {
                          "type": "number"
                        },
                        "currency_id": {
                          "type": "string",
                          "example": {
                            "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                          }
                        }
                      },
                      "required": [
                        "cashback_type",
                        "percent",
                        "currency_id",
                        "amount"
                      ]
                    }
                  }
                },
                "type": "object",
                "required": [
                  "type",
                  "is_active",
                  "organization_id",
                  "cashbacks"
                ]
              }
            }
          }
        }
      }
    },
    "/cashback-setting/update": {
      "put": {
        "tags": [
          "Cashback-settings"
        ],
        "description": "This method allows updating cashback-settings in the account.",
        "operationId": "cashback-settings-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "all",
                                "by_amount"
                              ]
                            },
                            "is_active": {
                              "type": "boolean",
                              "default": false
                            },
                            "organization_id": {
                              "type": "string"
                            },
                            "cashbacks": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "cashback_type": {
                                    "type": "string",
                                    "enum": [
                                      "percent",
                                      "cash"
                                    ]
                                  },
                                  "min_amount": {
                                    "type": "number"
                                  },
                                  "amount": {
                                    "type": "number"
                                  },
                                  "percent": {
                                    "type": "number"
                                  },
                                  "currency_id": {
                                    "type": "string",
                                    "example": {
                                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                    }
                                  }
                                },
                                "required": [
                                  "cashback_type",
                                  "min_amount"
                                ]
                              }
                            }
                          },
                          "type": "object",
                          "required": [
                            "type",
                            "organization_id"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "default": "",
                    "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "by_amount",
                      "all"
                    ],
                    "default": "by_amount"
                  },
                  "is_active": {
                    "type": "boolean",
                    "default": true
                  },
                  "organization_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "organization_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                    }
                  },
                  "cashbacks": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "cashback_type": {
                          "type": "string",
                          "enum": [
                            "percent",
                            "cash"
                          ],
                          "default": "percent"
                        },
                        "min_amount": {
                          "type": "number"
                        },
                        "amount": {
                          "type": "number"
                        },
                        "percent": {
                          "type": "number"
                        },
                        "currency_id": {
                          "type": "string",
                          "example": {
                            "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                          }
                        }
                      },
                      "required": [
                        "cashback_type",
                        "percent",
                        "currency_id",
                        "amount"
                      ]
                    }
                  }
                },
                "type": "object",
                "required": [
                  "type",
                  "is_active",
                  "organization_id",
                  "cashbacks",
                  "_id"
                ]
              }
            }
          }
        }
      }
    },
    "/cashback-setting/delete/{id}": {
      "delete": {
        "tags": [
          "Cashback-settings"
        ],
        "description": "Delete a cashback-settings",
        "operationId": "cashback-settings-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cashback-setting/get-all": {
      "get": {
        "tags": [
          "Cashback-settings"
        ],
        "parameters": [],
        "description": "Get all cashback-settings",
        "operationId": "cashback-settings-get-all",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1cashback-setting~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cashback-setting/get-by-id/{id}": {
      "get": {
        "tags": [
          "Cashback-settings"
        ],
        "description": "Get cashback-settings using its _id",
        "operationId": "cashback-settings-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1cashback-setting~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cashback-setting/get-deleted": {
      "get": {
        "tags": [
          "Cashback-settings"
        ],
        "description": "Get deleted cashback-settings ids",
        "operationId": "cashback-settings-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/cashback-setting/get-by-organization_id/{organization_id}": {
      "get": {
        "tags": [
          "Cashback-settings"
        ],
        "description": "Get cashback-settings using organization_id",
        "operationId": "cashback-settings-get-by-organization-id",
        "parameters": [
          {
            "name": "organization_id",
            "description": "organization_id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1cashback-setting~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cashbox/get-all": {
      "get": {
        "tags": [
          "Cashbox"
        ],
        "parameters": [
          {
            "name": "organization_id",
            "description": "organization_id",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "description": "organization_id"
            }
          }
        ],
        "description": "Get all cashbox",
        "operationId": "cashbox-get-all",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Cashbox ID"
                              },
                              "name": {
                                "type": "string",
                                "description": "Cashbox name"
                              },
                              "organization_id": {
                                "type": "string",
                                "description": "Organization ID"
                              },
                              "created_at": {
                                "type": "string",
                                "format": "date-time",
                                "description": "Created at timestamp"
                              },
                              "updated_at": {
                                "type": "string",
                                "format": "date-time",
                                "description": "Updated at timestamp"
                              },
                              "currency_id": {
                                "type": "string",
                                "description": "Currency ID"
                              },
                              "responsible_id": {
                                "type": "string",
                                "description": "Responsible ID"
                              },
                              "balance": {
                                "type": "number",
                                "description": "Cashbox balance"
                              },
                              "type": {
                                "type": "string",
                                "enum": [
                                  "main",
                                  "ordinary"
                                ],
                                "description": "Cashbox type"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cashbox-session/open": {
      "post": {
        "tags": [
          "Cashbox-session"
        ],
        "description": "Open a cashier shift (cashbox session) on a cashbox with a declared opening balance. The acting cashier is resolved from the integration token (the optional `user_id` header, else the tenant owner).",
        "operationId": "cashbox-session-open",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "organization_id",
                  "cashbox_id",
                  "opened_balance"
                ],
                "properties": {
                  "organization_id": {
                    "type": "string",
                    "description": "Organization ObjectId the session belongs to"
                  },
                  "cashbox_id": {
                    "type": "string",
                    "description": "Cashbox (till) ObjectId to open a shift on"
                  },
                  "opened_balance": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "currency_id",
                        "payment_method_id",
                        "expected"
                      ],
                      "properties": {
                        "currency_id": {
                          "type": "string",
                          "description": "Currency ObjectId"
                        },
                        "payment_method_id": {
                          "type": "string",
                          "description": "Payment-method ObjectId"
                        },
                        "expected": {
                          "type": "number",
                          "description": "Declared expected amount for this payment method"
                        }
                      }
                    },
                    "description": "Opening balance per payment method"
                  },
                  "opened_at": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Optional shift open time (ISO 8601); defaults to now"
                  },
                  "open_note": {
                    "type": "string",
                    "description": "Optional free-text note"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The opened session",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "session_uuid": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "open",
                                "closed",
                                "resolved",
                                "flagged"
                              ]
                            },
                            "organization_id": {
                              "type": "string"
                            },
                            "cashbox_id": {
                              "type": "string"
                            },
                            "user_id": {
                              "type": "string"
                            },
                            "opened_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "closed_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "opened_balance": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "currency_id": {
                                    "type": "string"
                                  },
                                  "payment_method_id": {
                                    "type": "string"
                                  },
                                  "expected": {
                                    "type": "number"
                                  },
                                  "actual": {
                                    "type": "number"
                                  }
                                }
                              }
                            },
                            "closed_balance": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1cashbox-session~1open/post/responses/200/content/application~1json/schema/allOf/1/properties/data/properties/opened_balance/items"
                              }
                            },
                            "has_diff_on_open": {
                              "type": "boolean"
                            },
                            "has_diff_on_close": {
                              "type": "boolean"
                            },
                            "open_note": {
                              "type": "string"
                            },
                            "close_note": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cashbox-session/close": {
      "put": {
        "tags": [
          "Cashbox-session"
        ],
        "description": "Close an open shift, reconciling the declared closing balance against the expected totals.",
        "operationId": "cashbox-session-close",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "_id",
                  "closed_balance"
                ],
                "properties": {
                  "_id": {
                    "type": "string",
                    "description": "Cashbox-session ObjectId to close"
                  },
                  "closed_balance": {
                    "type": "array",
                    "items": {
                      "$ref": "#/paths/~1cashbox-session~1open/post/requestBody/content/application~1json/schema/properties/opened_balance/items"
                    },
                    "description": "Counted closing balance per payment method"
                  },
                  "close_note": {
                    "type": "string",
                    "description": "Optional free-text note"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The closed session",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1cashbox-session~1open/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cashbox-session/get-paging": {
      "post": {
        "tags": [
          "Cashbox-session"
        ],
        "description": "Paginated list of cashbox sessions, filterable by organization, cashbox, cashier, state, and discrepancy.",
        "operationId": "cashbox-session-get-paging",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string",
                        "description": "Filter by organization ObjectId"
                      },
                      "cashbox_id": {
                        "type": "string",
                        "description": "Filter by cashbox ObjectId"
                      },
                      "user_id": {
                        "type": "string",
                        "description": "Filter by cashier (user) ObjectId"
                      },
                      "state": {
                        "type": "string",
                        "enum": [
                          "open",
                          "closed",
                          "resolved",
                          "flagged"
                        ],
                        "description": "Filter by session state"
                      },
                      "has_diff": {
                        "type": "boolean",
                        "description": "Filter sessions that closed with a discrepancy"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1cashbox-session~1open/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cashbox-session/get-by-id/{id}": {
      "get": {
        "tags": [
          "Cashbox-session"
        ],
        "description": "Fetch a single cashbox session by ObjectId.",
        "operationId": "cashbox-session-get-by-id",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Cashbox-session ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The session",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1cashbox-session~1open/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cashbox-session/get-active": {
      "post": {
        "tags": [
          "Cashbox-session"
        ],
        "description": "Return the caller's active (open) session in the given organization, if any.",
        "operationId": "cashbox-session-get-active",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "organization_id"
                ],
                "properties": {
                  "organization_id": {
                    "type": "string",
                    "description": "Organization ObjectId to find the caller's active session in"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The active session",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1cashbox-session~1open/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/open-ticket/create": {
      "post": {
        "tags": [
          "Open-ticket"
        ],
        "description": "Create an open ticket (a held order / table bill) with its draft receipt and products.",
        "operationId": "open-ticket-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "organization_id",
                  "receipt"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Display name of the open ticket"
                  },
                  "organization_id": {
                    "type": "string",
                    "description": "Organization ObjectId the ticket belongs to"
                  },
                  "booking_table_id": {
                    "type": "string",
                    "description": "Booking table (seat/table) ObjectId, if the ticket is tied to a table"
                  },
                  "comment": {
                    "type": "string",
                    "description": "Optional free-text comment"
                  },
                  "receipt": {
                    "type": "object",
                    "required": [
                      "products"
                    ],
                    "properties": {
                      "organization_id": {
                        "type": "string"
                      },
                      "warehouse_id": {
                        "type": "string"
                      },
                      "customer_id": {
                        "type": "string"
                      },
                      "responsible_id": {
                        "type": "string"
                      },
                      "currency_id": {
                        "type": "string"
                      },
                      "price_id": {
                        "type": "string"
                      },
                      "note": {
                        "type": "string"
                      },
                      "products": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "required": [
                            "product_id",
                            "warehouse_id",
                            "amount",
                            "price"
                          ],
                          "properties": {
                            "product_id": {
                              "type": "string"
                            },
                            "warehouse_id": {
                              "type": "string"
                            },
                            "amount": {
                              "type": "number"
                            },
                            "price": {
                              "type": "number"
                            },
                            "box_count": {
                              "type": "number"
                            },
                            "note": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created open ticket",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1open-ticket~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/open-ticket/update": {
      "put": {
        "tags": [
          "Open-ticket"
        ],
        "description": "Update an existing open ticket and its draft receipt.",
        "operationId": "open-ticket-update",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1open-ticket~1create/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "_id"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated open ticket",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "organization_id": {
                              "type": "string"
                            },
                            "uuid": {
                              "type": "string"
                            },
                            "booking_table_id": {
                              "type": "string"
                            },
                            "receipt": {
                              "type": "object"
                            }
                          },
                          "required": [
                            "_id",
                            "name",
                            "organization_id"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/open-ticket/get-paging": {
      "post": {
        "tags": [
          "Open-ticket"
        ],
        "description": "Paginated list of open tickets, filterable by organization.",
        "operationId": "open-ticket-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string",
                        "description": "Filter by organization ObjectId"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1open-ticket~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/open-ticket/get-by-id/{id}": {
      "get": {
        "tags": [
          "Open-ticket"
        ],
        "description": "Fetch a single open ticket by ObjectId.",
        "operationId": "open-ticket-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Open-ticket ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The open ticket",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1open-ticket~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/open-ticket/delete-many": {
      "post": {
        "tags": [
          "Open-ticket"
        ],
        "description": "Soft-delete multiple open tickets by their ObjectIds.",
        "operationId": "open-ticket-delete-many",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "ids"
                ],
                "properties": {
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Open-ticket ObjectIds to delete"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/role/create": {
      "post": {
        "tags": [
          "Role"
        ],
        "description": "Create a role with its permission access map.",
        "operationId": "role-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "access"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Role name"
                  },
                  "access": {
                    "type": "object",
                    "description": "permission map: key → access degree (a|s|r|d)",
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  "web_access": {
                    "type": "object",
                    "description": "permission map for the web back-office surface"
                  },
                  "mobile_access": {
                    "type": "object",
                    "description": "permission map for the mobile/POS surface"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created role",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1role~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/role/update": {
      "put": {
        "tags": [
          "Role"
        ],
        "description": "Update an existing role and its permission access map.",
        "operationId": "role-update",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1role~1create/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "_id"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated role",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "web": {
                              "type": "boolean"
                            },
                            "mobile": {
                              "type": "boolean"
                            }
                          },
                          "type": "object",
                          "required": [
                            "_id",
                            "name"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/role/delete/{id}": {
      "delete": {
        "tags": [
          "Role"
        ],
        "description": "Delete a role",
        "operationId": "role-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/role/get-by-id/{id}": {
      "get": {
        "tags": [
          "Role"
        ],
        "description": "Get role using its _id",
        "operationId": "role-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1role~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/role/get-paging": {
      "post": {
        "tags": [
          "Role"
        ],
        "description": "Get roles by paging",
        "operationId": "role-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string"
                      },
                      "nin": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "web": {
                                    "type": "boolean"
                                  },
                                  "mobile": {
                                    "type": "boolean"
                                  }
                                },
                                "type": "object",
                                "required": [
                                  "_id",
                                  "name"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/section/get-by-id/{id}": {
      "get": {
        "tags": [
          "Section"
        ],
        "description": "Get section using its _id",
        "operationId": "section-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1section~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/section/get-paging": {
      "post": {
        "tags": [
          "Section"
        ],
        "description": "Get sections by paging",
        "operationId": "section-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string"
                      },
                      "parent_id": {
                        "type": "string",
                        "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                      },
                      "organization_id": {
                        "type": "string",
                        "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                      },
                      "top": {
                        "type": "boolean",
                        "default": false
                      },
                      "updated_at": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2024-07-20T10:30:00Z"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "created_at": {
                                    "type": "string"
                                  },
                                  "updated_at": {
                                    "type": "string"
                                  },
                                  "is_deleted": {
                                    "type": "boolean"
                                  },
                                  "parent": {
                                    "type": "object",
                                    "required": [
                                      "_id",
                                      "name"
                                    ],
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "is_deleted": {
                                        "type": "boolean"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "chief": {
                                    "type": "object",
                                    "required": [
                                      "_id",
                                      "full_name"
                                    ],
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      },
                                      "is_deleted": {
                                        "type": "boolean"
                                      }
                                    }
                                  }
                                },
                                "type": "object",
                                "required": [
                                  "name"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/position/get-by-id/{id}": {
      "get": {
        "tags": [
          "Position"
        ],
        "description": "Get position using its _id",
        "operationId": "position-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1position~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/position/get-paging": {
      "post": {
        "tags": [
          "Position"
        ],
        "description": "Get positions by paging",
        "operationId": "position-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string"
                      },
                      "section_id": {
                        "type": "string",
                        "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                      },
                      "organization_id": {
                        "type": "string",
                        "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                      },
                      "accessed_organization_ids": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "created_at": {
                                    "type": "string"
                                  },
                                  "updated_at": {
                                    "type": "string"
                                  },
                                  "max_employee_count": {
                                    "type": "number"
                                  },
                                  "employee_count": {
                                    "type": "number"
                                  }
                                },
                                "type": "object",
                                "required": [
                                  "_id",
                                  "name"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/person/get-by-id/{id}": {
      "post": {
        "tags": [
          "Person"
        ],
        "description": "Fetch a single person by ObjectId. Legal and natural persons are both stored as persons; the response is the aggregated legal- or natural-person record depending on the stored type.",
        "operationId": "person-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "number": {
                              "type": "number"
                            },
                            "type": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "short_name": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "inactive"
                              ]
                            },
                            "phone_number": {
                              "type": "string"
                            },
                            "telegram_link": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            },
                            "web_site": {
                              "type": "string"
                            },
                            "address": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "postal_code": {
                              "type": "string"
                            },
                            "inn": {
                              "type": "string"
                            },
                            "image": {
                              "type": "string"
                            },
                            "location": {
                              "type": "object"
                            },
                            "is_customer": {
                              "type": "boolean"
                            },
                            "is_supplier": {
                              "type": "boolean"
                            },
                            "is_default": {
                              "type": "boolean"
                            },
                            "updated_by_user": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                }
                              }
                            },
                            "created_by_user": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                }
                              }
                            },
                            "owner": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "short_name": {
                                  "type": "string"
                                }
                              }
                            },
                            "manager": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "first_name": {
                                  "type": "string"
                                },
                                "last_name": {
                                  "type": "string"
                                }
                              }
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "balance": {
                              "type": "number"
                            },
                            "balance_list": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            },
                            "total_balance": {
                              "type": "number"
                            },
                            "customer": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "employee": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "supplier": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "delivery_address": {
                              "type": "string"
                            },
                            "responsible_id": {
                              "type": "string"
                            },
                            "responsible": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "required": [
                            "name",
                            "type",
                            "number"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/person/balance/get-paging": {
      "post": {
        "tags": [
          "Person"
        ],
        "description": "Paginated list of persons WITH their balances per organization and currency. Filter by type, status, organization_id and balance_type. Use /person/get-paging for a plain list without balance aggregation — it is considerably cheaper.",
        "operationId": "person-balance-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "legal",
                          "natural"
                        ],
                        "example": "legal"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "active",
                          "inactive"
                        ],
                        "example": "active"
                      },
                      "organization_id": {
                        "type": "string",
                        "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                      },
                      "balance_type": {
                        "type": "string",
                        "enum": [
                          "debt",
                          "credit",
                          "zero",
                          "not_zero"
                        ],
                        "example": "not_zero",
                        "description": "Filter by balance state."
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list of persons with balances",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "last_name": {
                                    "type": "string"
                                  },
                                  "first_name": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "boolean"
                                  },
                                  "person_id": {
                                    "type": "string"
                                  },
                                  "phone_number": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "active",
                                      "inactive"
                                    ]
                                  },
                                  "code": {
                                    "type": "string"
                                  },
                                  "balance_list": {
                                    "type": "array",
                                    "items": {
                                      "type": "object"
                                    }
                                  }
                                },
                                "type": "object",
                                "required": [
                                  "name"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/supplier/get-by-id/{id}": {
      "get": {
        "tags": [
          "Supplier"
        ],
        "description": "Get supplier using its _id",
        "operationId": "supplier-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1supplier~1update/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/supplier/get-paging": {
      "post": {
        "tags": [
          "Supplier"
        ],
        "description": "Get suppliers by paging",
        "operationId": "supplier-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string"
                      },
                      "category_id": {
                        "type": "string",
                        "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                      },
                      "updated_at": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2024-07-20T10:30:00Z"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "completely_deleted": {
                                    "type": "boolean"
                                  },
                                  "is_deleted": {
                                    "type": "boolean"
                                  },
                                  "created_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "director_name": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "phone_number": {
                                    "type": "string"
                                  },
                                  "refund_count": {
                                    "type": "number"
                                  },
                                  "sale_count": {
                                    "type": "number"
                                  },
                                  "total_sale": {
                                    "type": "number"
                                  },
                                  "first_sale_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "last_sale_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "type": {
                                    "type": "string"
                                  },
                                  "updatedAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "updated_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "total_balance": {
                                    "type": "number"
                                  },
                                  "balance": {
                                    "type": "number"
                                  },
                                  "balance_currency_id": {
                                    "type": "string"
                                  },
                                  "address": {
                                    "type": "string"
                                  },
                                  "inn": {
                                    "type": "string"
                                  },
                                  "comment": {
                                    "type": "string"
                                  },
                                  "avg_product": {
                                    "type": "number"
                                  },
                                  "avg_sale": {
                                    "type": "number"
                                  },
                                  "total_spent": {
                                    "type": "number"
                                  },
                                  "category": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "note": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/employee/create": {
      "post": {
        "tags": [
          "Employee"
        ],
        "description": "This method allows adding employee into the account.",
        "operationId": "employee-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1employee~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "full_name": {
                    "type": "string",
                    "default": "",
                    "x-readme-id": "0.0",
                    "minLength": 1
                  },
                  "inn": {
                    "type": "string",
                    "default": "",
                    "x-readme-id": "0.0"
                  },
                  "phone_number": {
                    "type": "string",
                    "default": ""
                  },
                  "jshir": {
                    "type": "string",
                    "default": "",
                    "minLength": 14,
                    "maxLength": 14
                  },
                  "address": {
                    "type": "string",
                    "default": "",
                    "maxLength": 100
                  },
                  "passport_number": {
                    "type": "string",
                    "default": ""
                  },
                  "passport_issued_date": {
                    "type": "string",
                    "default": ""
                  },
                  "passport_issued_by": {
                    "type": "string",
                    "default": "",
                    "minLength": 3
                  },
                  "acceptance_date": {
                    "type": "string",
                    "default": ""
                  },
                  "work_rate": {
                    "type": "number",
                    "minimum": 0,
                    "default": 0
                  },
                  "testing_end_time": {
                    "type": "string",
                    "default": ""
                  },
                  "contract_end_time": {
                    "type": "string",
                    "default": false
                  },
                  "holidays": {
                    "type": "number",
                    "default": 0,
                    "minimum": 0,
                    "maximum": 28
                  },
                  "comment": {
                    "type": "string",
                    "default": "",
                    "maxLength": 250
                  },
                  "pincode": {
                    "type": "string",
                    "default": "",
                    "minLength": 6,
                    "maxLength": 6
                  },
                  "password": {
                    "type": "string",
                    "default": "",
                    "minLength": 6,
                    "maxLength": 256
                  },
                  "is_free": {
                    "type": "boolean",
                    "default": false
                  },
                  "accesses": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "properties": {
                        "organization_id": {
                          "type": "string",
                          "example": {
                            "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                          }
                        },
                        "positions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "position_id": {
                                "type": "string",
                                "example": {
                                  "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                }
                              },
                              "section_id": {
                                "type": "string",
                                "example": {
                                  "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                }
                              }
                            }
                          }
                        },
                        "role_id": {
                          "type": "string"
                        },
                        "salaries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "fixed",
                                  "task_by"
                                ]
                              },
                              "amount": {
                                "type": "number"
                              },
                              "is_active": {
                                "type": "boolean"
                              },
                              "currency_id": {
                                "type": "string",
                                "example": {
                                  "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                }
                              },
                              "unit": {
                                "type": "string",
                                "enum": [
                                  "hour",
                                  "day"
                                ]
                              }
                            },
                            "required": [
                              "salary_type_id",
                              "amount"
                            ]
                          }
                        }
                      },
                      "required": [
                        "organization_id",
                        "role_id"
                      ]
                    }
                  },
                  "person_id": {
                    "type": "string",
                    "default": "",
                    "description": "person id of employee"
                  },
                  "gender": {
                    "type": "string",
                    "default": "",
                    "enum": [
                      "male",
                      "female"
                    ]
                  },
                  "image": {
                    "type": "string",
                    "default": "",
                    "description": "image path of employee that uploaded to the server"
                  },
                  "last_name": {
                    "type": "string",
                    "default": "",
                    "x-readme-id": "0.0"
                  },
                  "middle_name": {
                    "type": "string",
                    "default": "",
                    "x-readme-id": "0.0"
                  },
                  "birth_date": {
                    "type": "string",
                    "default": "",
                    "description": "date of birth of employee"
                  },
                  "legal_person_id": {
                    "type": "string",
                    "default": "",
                    "description": "id of legal person"
                  },
                  "telegram_link": {
                    "type": "string",
                    "default": "",
                    "description": "link of telegram account"
                  },
                  "email": {
                    "type": "string",
                    "default": "",
                    "description": "email of employee"
                  },
                  "is_supplier": {
                    "type": "boolean",
                    "default": false,
                    "description": "is supplier or not"
                  },
                  "is_customer": {
                    "type": "boolean",
                    "default": false,
                    "description": "is customer or not"
                  },
                  "status": {
                    "type": "string",
                    "default": "",
                    "enum": [
                      "active",
                      "inactive"
                    ],
                    "description": "status of employee"
                  },
                  "short_name": {
                    "type": "string",
                    "default": "",
                    "description": "short name of employee"
                  },
                  "web-site": {
                    "type": "string",
                    "default": "",
                    "description": "web-site of employee"
                  },
                  "code": {
                    "type": "string",
                    "default": "",
                    "description": "code of employee"
                  },
                  "postal_code": {
                    "type": "string",
                    "default": "",
                    "description": "postal code of employee"
                  },
                  "owner_id": {
                    "type": "string",
                    "default": "",
                    "description": "id of owner",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "manager_id": {
                    "type": "string",
                    "default": "",
                    "description": "id of manager",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "delivery_address": {
                    "type": "object",
                    "description": "delivery address of employee",
                    "properties": {
                      "lat": {
                        "type": "number",
                        "default": 0
                      },
                      "long": {
                        "type": "number",
                        "default": 0
                      },
                      "human_address": {
                        "type": "object",
                        "properties": {
                          "address": {
                            "type": "string",
                            "default": ""
                          },
                          "city": {
                            "type": "string",
                            "default": ""
                          },
                          "state": {
                            "type": "string",
                            "default": ""
                          },
                          "zip": {
                            "type": "string",
                            "default": ""
                          }
                        }
                      }
                    },
                    "required": [
                      "lat",
                      "long"
                    ]
                  }
                },
                "type": "object",
                "required": [
                  "full_name",
                  "phone_number",
                  "pincode",
                  "password",
                  "is_free",
                  "accessess"
                ]
              }
            }
          }
        }
      }
    },
    "/employee/update": {
      "put": {
        "tags": [
          "Employee"
        ],
        "description": "This method allows updating employee in the account.",
        "operationId": "employee-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "id of employee",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "full_name": {
                              "type": "string"
                            },
                            "inn": {
                              "type": "string"
                            },
                            "phone_number": {
                              "type": "string",
                              "default": ""
                            },
                            "jshir": {
                              "type": "string",
                              "default": "",
                              "minLength": 14,
                              "maxLength": 14
                            },
                            "passport_number": {
                              "type": "string",
                              "default": ""
                            },
                            "passport_issued_date": {
                              "type": "string",
                              "default": ""
                            },
                            "passport_issued_by": {
                              "type": "string",
                              "default": "",
                              "minLength": 3
                            },
                            "acceptance_date": {
                              "type": "string",
                              "default": ""
                            },
                            "work_rate": {
                              "type": "number",
                              "minimum": 0,
                              "default": 0
                            },
                            "testing_end_time": {
                              "type": "string",
                              "default": ""
                            },
                            "contract_end_time": {
                              "type": "string",
                              "default": false
                            },
                            "holidays": {
                              "type": "number",
                              "default": 0,
                              "minimum": 0,
                              "maximum": 28
                            },
                            "comment": {
                              "type": "string",
                              "default": "",
                              "maxLength": 250
                            },
                            "is_free": {
                              "type": "boolean",
                              "default": false
                            },
                            "address": {
                              "type": "string",
                              "default": "",
                              "description": "address of employee"
                            },
                            "gender": {
                              "type": "string",
                              "default": "",
                              "enum": [
                                "male",
                                "female"
                              ]
                            },
                            "image": {
                              "type": "string",
                              "default": "",
                              "description": "image path of employee that uploaded to the server"
                            },
                            "last_name": {
                              "type": "string",
                              "default": "",
                              "x-readme-id": "0.0"
                            },
                            "middle_name": {
                              "type": "string",
                              "default": "",
                              "x-readme-id": "0.0"
                            },
                            "birth_date": {
                              "type": "string",
                              "default": "",
                              "description": "date of birth of employee"
                            },
                            "legal_person_id": {
                              "type": "string",
                              "default": "",
                              "description": "id of legal person"
                            },
                            "telegram_link": {
                              "type": "string",
                              "default": "",
                              "description": "link of telegram account"
                            },
                            "email": {
                              "type": "string",
                              "default": "",
                              "description": "email of employee"
                            },
                            "is_supplier": {
                              "type": "boolean",
                              "default": false,
                              "description": "is supplier or not"
                            },
                            "status": {
                              "type": "string",
                              "default": "",
                              "enum": [
                                "active",
                                "inactive"
                              ],
                              "description": "status of employee"
                            },
                            "short_name": {
                              "type": "string",
                              "default": "",
                              "description": "short name of employee"
                            },
                            "web-site": {
                              "type": "string",
                              "default": "",
                              "description": "web-site of employee"
                            },
                            "code": {
                              "type": "string",
                              "default": "",
                              "description": "code of employee"
                            },
                            "postal_code": {
                              "type": "string",
                              "default": "",
                              "description": "postal code of employee"
                            },
                            "delivery_address": {
                              "type": "object",
                              "description": "delivery address of employee",
                              "properties": {
                                "lat": {
                                  "type": "number",
                                  "default": 0
                                },
                                "long": {
                                  "type": "number",
                                  "default": 0
                                },
                                "human_address": {
                                  "type": "object",
                                  "properties": {
                                    "address": {
                                      "type": "string",
                                      "default": ""
                                    },
                                    "city": {
                                      "type": "string",
                                      "default": ""
                                    },
                                    "state": {
                                      "type": "string",
                                      "default": ""
                                    },
                                    "zip": {
                                      "type": "string",
                                      "default": ""
                                    }
                                  }
                                }
                              },
                              "required": [
                                "lat",
                                "long"
                              ]
                            },
                            "number": {
                              "type": "string",
                              "default": "",
                              "description": "number of employee"
                            },
                            "balance_action": {
                              "type": "string",
                              "default": "",
                              "description": "action of balance"
                            },
                            "is_boss": {
                              "type": "boolean",
                              "default": false,
                              "description": "is boss or not"
                            },
                            "employment_type": {
                              "type": "string"
                            },
                            "salary": {
                              "type": "object",
                              "properties": {
                                "is_active": {
                                  "type": "boolean"
                                },
                                "employee_id": {
                                  "type": "string"
                                },
                                "organization_id": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "fixed",
                                    "task_by"
                                  ]
                                },
                                "amount": {
                                  "type": "number",
                                  "default": 0
                                },
                                "currency_id": {
                                  "type": "string",
                                  "description": "id of currency"
                                },
                                "unit": {
                                  "type": "string",
                                  "enum": [
                                    "hour",
                                    "day"
                                  ]
                                }
                              }
                            },
                            "salary_currency_id": {
                              "type": "string",
                              "default": "",
                              "description": "id of currency"
                            },
                            "boss_id": {
                              "type": "string",
                              "default": "",
                              "description": "id of boss"
                            },
                            "balance": {
                              "type": "object",
                              "properties": {
                                "organization_id": {
                                  "type": "string"
                                },
                                "payment_method_id": {
                                  "type": "string"
                                },
                                "currency_id": {
                                  "type": "string"
                                },
                                "amount": {
                                  "type": "number",
                                  "default": 0
                                }
                              }
                            },
                            "balance_currency_id": {
                              "type": "string",
                              "default": "",
                              "description": "id of currency"
                            },
                            "balance_list": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "amount": {
                                    "type": "number",
                                    "default": 0
                                  },
                                  "organization_id": {
                                    "type": "string"
                                  },
                                  "payment_method_id": {
                                    "type": "string"
                                  },
                                  "currency_id": {
                                    "type": "string"
                                  }
                                }
                              }
                            },
                            "positions": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "organization_id": {
                                    "type": "string"
                                  },
                                  "section": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "is_deleted": {
                                        "type": "boolean"
                                      },
                                      "completely_deleted": {
                                        "type": "boolean"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "position": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "is_deleted": {
                                        "type": "boolean"
                                      },
                                      "completely_deleted": {
                                        "type": "boolean"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "role": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "is_deleted": {
                                        "type": "boolean"
                                      },
                                      "completely_deleted": {
                                        "type": "boolean"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "web": {
                                        "type": "boolean"
                                      },
                                      "mobile": {
                                        "type": "boolean"
                                      }
                                    }
                                  },
                                  "role_id": {
                                    "type": "string"
                                  }
                                }
                              }
                            },
                            "is_deleted": {
                              "type": "boolean",
                              "default": false
                            },
                            "completely_deleted": {
                              "type": "boolean",
                              "default": false
                            },
                            "created_at": {
                              "type": "string",
                              "default": "",
                              "description": "date of creation"
                            },
                            "updated_at": {
                              "type": "string",
                              "default": "",
                              "description": "date of update"
                            },
                            "person": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "id of person"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "name of person"
                                },
                                "full_name": {
                                  "type": "string",
                                  "description": "last name of person"
                                }
                              }
                            }
                          },
                          "type": "object",
                          "required": [
                            "_id",
                            "full_name",
                            "phone_number"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "full_name": {
                    "type": "string",
                    "default": "",
                    "x-readme-id": "0.0",
                    "minLength": 1
                  },
                  "inn": {
                    "type": "string",
                    "default": "",
                    "x-readme-id": "0.0"
                  },
                  "phone_number": {
                    "type": "string",
                    "default": ""
                  },
                  "jshir": {
                    "type": "string",
                    "default": "",
                    "minLength": 14,
                    "maxLength": 14
                  },
                  "address": {
                    "type": "string",
                    "default": "",
                    "maxLength": 100
                  },
                  "passport_number": {
                    "type": "string",
                    "default": ""
                  },
                  "passport_issued_date": {
                    "type": "string",
                    "default": ""
                  },
                  "passport_issued_by": {
                    "type": "string",
                    "default": "",
                    "minLength": 3
                  },
                  "acceptance_date": {
                    "type": "string",
                    "default": ""
                  },
                  "work_rate": {
                    "type": "number",
                    "minimum": 0,
                    "default": 0
                  },
                  "testing_end_time": {
                    "type": "string",
                    "default": ""
                  },
                  "contract_end_time": {
                    "type": "string",
                    "default": false
                  },
                  "holidays": {
                    "type": "number",
                    "default": 0,
                    "minimum": 0,
                    "maximum": 28
                  },
                  "comment": {
                    "type": "string",
                    "default": "",
                    "maxLength": 250
                  },
                  "is_free": {
                    "type": "boolean",
                    "default": false
                  },
                  "accesses": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "properties": {
                        "organization_id": {
                          "type": "string",
                          "example": {
                            "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                          }
                        },
                        "positions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "position_id": {
                                "type": "string",
                                "example": {
                                  "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                }
                              },
                              "section_id": {
                                "type": "string",
                                "example": {
                                  "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                }
                              }
                            },
                            "required": [
                              "position_id",
                              "section_id"
                            ]
                          }
                        },
                        "role_id": {
                          "type": "string"
                        },
                        "salaries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "fixed",
                                  "task_by"
                                ]
                              },
                              "amount": {
                                "type": "number"
                              },
                              "is_active": {
                                "type": "boolean"
                              },
                              "currency_id": {
                                "type": "string",
                                "example": {
                                  "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                }
                              },
                              "unit": {
                                "type": "string",
                                "enum": [
                                  "hour",
                                  "day"
                                ]
                              }
                            },
                            "required": [
                              "is_active",
                              "type",
                              "currency_id",
                              "unit"
                            ]
                          }
                        }
                      },
                      "required": [
                        "organization_id",
                        "role_id"
                      ]
                    }
                  },
                  "person_id": {
                    "type": "string",
                    "default": "",
                    "description": "person id of employee"
                  },
                  "gender": {
                    "type": "string",
                    "default": "",
                    "enum": [
                      "male",
                      "female"
                    ]
                  },
                  "image": {
                    "type": "string",
                    "default": "",
                    "description": "image path of employee that uploaded to the server"
                  },
                  "last_name": {
                    "type": "string",
                    "default": "",
                    "x-readme-id": "0.0"
                  },
                  "middle_name": {
                    "type": "string",
                    "default": "",
                    "x-readme-id": "0.0"
                  },
                  "birth_date": {
                    "type": "string",
                    "default": "",
                    "description": "date of birth of employee"
                  },
                  "legal_person_id": {
                    "type": "string",
                    "default": "",
                    "description": "id of legal person"
                  },
                  "telegram_link": {
                    "type": "string",
                    "default": "",
                    "description": "link of telegram account"
                  },
                  "email": {
                    "type": "string",
                    "default": "",
                    "description": "email of employee"
                  },
                  "status": {
                    "type": "string",
                    "default": "",
                    "enum": [
                      "active",
                      "inactive"
                    ],
                    "description": "status of employee"
                  },
                  "short_name": {
                    "type": "string",
                    "default": "",
                    "description": "short name of employee"
                  },
                  "web-site": {
                    "type": "string",
                    "default": "",
                    "description": "web-site of employee"
                  },
                  "code": {
                    "type": "string",
                    "default": "",
                    "description": "code of employee"
                  },
                  "postal_code": {
                    "type": "string",
                    "default": "",
                    "description": "postal code of employee"
                  },
                  "owner_id": {
                    "type": "string",
                    "default": "",
                    "description": "id of owner",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "manager_id": {
                    "type": "string",
                    "default": "",
                    "description": "id of manager",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "delivery_address": {
                    "type": "object",
                    "description": "delivery address of employee",
                    "properties": {
                      "lat": {
                        "type": "number",
                        "default": 0
                      },
                      "long": {
                        "type": "number",
                        "default": 0
                      },
                      "human_address": {
                        "type": "object",
                        "properties": {
                          "address": {
                            "type": "string",
                            "default": ""
                          },
                          "city": {
                            "type": "string",
                            "default": ""
                          },
                          "state": {
                            "type": "string",
                            "default": ""
                          },
                          "zip": {
                            "type": "string",
                            "default": ""
                          }
                        }
                      }
                    }
                  }
                },
                "type": "object",
                "required": [
                  "_id",
                  "full_name",
                  "phone_number",
                  "is_free",
                  "accessess"
                ]
              }
            }
          }
        }
      }
    },
    "/employee/delete/{id}": {
      "delete": {
        "tags": [
          "Employee"
        ],
        "description": "Delete a employee",
        "operationId": "employee-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/employee/get-by-id/{id}": {
      "get": {
        "tags": [
          "Employee"
        ],
        "description": "Get employee using its _id",
        "operationId": "employee-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1employee~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/employee/get-deleted": {
      "get": {
        "tags": [
          "Employee"
        ],
        "description": "Get deleted employee ids",
        "operationId": "employee-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/employee/get-paging": {
      "post": {
        "tags": [
          "Employee"
        ],
        "description": "Get employees by paging",
        "operationId": "employee-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string",
                        "example": {
                          "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                        }
                      },
                      "position_id": {
                        "type": "string",
                        "example": {
                          "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                        }
                      },
                      "section_id": {
                        "type": "string",
                        "example": {
                          "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                        }
                      },
                      "search": {
                        "type": "string",
                        "default": ""
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "properties": {
                                  "_id": {
                                    "type": "string",
                                    "description": "id of employee",
                                    "example": {
                                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                                    }
                                  },
                                  "full_name": {
                                    "type": "string",
                                    "description": "full name of employee"
                                  },
                                  "number": {
                                    "type": "string",
                                    "description": "number of employee"
                                  },
                                  "phone_number": {
                                    "type": "string",
                                    "description": "phone number of employee"
                                  },
                                  "balance_list": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "_id": {
                                          "type": "string"
                                        },
                                        "amount": {
                                          "type": "number",
                                          "default": 0
                                        },
                                        "organization_id": {
                                          "type": "string"
                                        },
                                        "payment_method_id": {
                                          "type": "string"
                                        },
                                        "currency_id": {
                                          "type": "string"
                                        }
                                      }
                                    }
                                  },
                                  "person_id": {
                                    "type": "string",
                                    "description": "id of person"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/organization/get-all": {
      "get": {
        "tags": [
          "Organization"
        ],
        "parameters": [],
        "description": "Get all organization",
        "operationId": "organization-get-all",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "$ref": "#/paths/~1organization~1get-by-id~1%7Bid%7D/get/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sale-settings/get": {
      "get": {
        "tags": [
          "Sale-settings"
        ],
        "parameters": [],
        "description": "Get all sale-settings",
        "operationId": "sale-settings-get",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "$ref": "#/paths/~1sale-settings~1set/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sale-settings/set": {
      "put": {
        "tags": [
          "Sale-settings"
        ],
        "description": "This method allows updating sale-settings in the account.",
        "operationId": "sale-settings-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "booking_product_in_order": {
                              "type": "boolean",
                              "default": false
                            },
                            "sell_product_in_negative": {
                              "type": "boolean",
                              "default": false
                            },
                            "calc_tax_after_discount": {
                              "type": "boolean",
                              "default": false
                            },
                            "past_date_sell": {
                              "type": "boolean",
                              "default": true
                            },
                            "max_day_past_date_sell": {
                              "type": "number"
                            },
                            "calc_sale_discount_after_product": {
                              "type": "boolean",
                              "default": true
                            },
                            "is_tax_active": {
                              "type": "boolean",
                              "default": false
                            },
                            "is_cashback_active": {
                              "type": "boolean",
                              "default": false
                            },
                            "trade_state": {
                              "type": "string",
                              "enum": [
                                "new",
                                "draft",
                                "done",
                                "cancelled",
                                "in_progress"
                              ],
                              "default": "new"
                            },
                            "show_gross_weight": {
                              "type": "boolean",
                              "default": false
                            },
                            "show_netto_weight": {
                              "type": "boolean",
                              "default": false
                            },
                            "debt_approve_by_boss": {
                              "type": "boolean",
                              "default": false
                            },
                            "discount_approve_by_boss": {
                              "type": "boolean",
                              "default": false
                            },
                            "on_revision": {
                              "type": "string",
                              "enum": [
                                "warning",
                                "error"
                              ],
                              "default": "warning"
                            },
                            "discount": {
                              "type": "object",
                              "properties": {
                                "is_enabled": {
                                  "type": "boolean",
                                  "default": false
                                },
                                "limit_by_percent": {
                                  "type": "number",
                                  "default": 0
                                }
                              },
                              "required": [
                                "is_enabled",
                                "limit_by_percent"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "booking_product_in_order": {
                    "type": "boolean",
                    "default": false
                  },
                  "sell_product_in_negative": {
                    "type": "boolean",
                    "default": false
                  },
                  "calc_tax_after_discount": {
                    "type": "boolean",
                    "default": false
                  },
                  "past_date_sell": {
                    "type": "boolean",
                    "default": true
                  },
                  "max_day_past_date_sell": {
                    "type": "number"
                  },
                  "calc_sale_discount_after_product": {
                    "type": "boolean",
                    "default": true
                  },
                  "is_tax_active": {
                    "type": "boolean",
                    "default": false
                  },
                  "is_cashback_active": {
                    "type": "boolean",
                    "default": false
                  },
                  "trade_state": {
                    "type": "string",
                    "enum": [
                      "new",
                      "draft",
                      "done",
                      "cancelled",
                      "in_progress"
                    ],
                    "default": "new"
                  },
                  "show_gross_weight": {
                    "type": "boolean",
                    "default": false
                  },
                  "show_netto_weight": {
                    "type": "boolean",
                    "default": false
                  },
                  "debt_approve_by_boss": {
                    "type": "boolean",
                    "default": false
                  },
                  "discount_approve_by_boss": {
                    "type": "boolean",
                    "default": false
                  },
                  "on_revision": {
                    "type": "string",
                    "enum": [
                      "warning",
                      "error"
                    ],
                    "default": "warning"
                  },
                  "discount": {
                    "type": "object",
                    "properties": {
                      "is_enabled": {
                        "type": "boolean",
                        "default": false
                      },
                      "limit_by_percent": {
                        "type": "number",
                        "default": 0
                      }
                    },
                    "required": [
                      "is_enabled",
                      "limit_by_percent"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/warehouse-settings/get": {
      "get": {
        "tags": [
          "Warehouse-settings"
        ],
        "parameters": [],
        "description": "Get the tenant's warehouse settings (created with defaults on first access).",
        "operationId": "warehouse-settings-get",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The warehouse settings",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "account_id": {
                              "type": "string"
                            },
                            "direct_transfer": {
                              "type": "boolean"
                            },
                            "direct_acceptance": {
                              "type": "boolean"
                            },
                            "create_product_with_stock": {
                              "type": "boolean"
                            },
                            "show_sale_price_in_transfers": {
                              "type": "boolean"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/warehouse-settings/set": {
      "put": {
        "tags": [
          "Warehouse-settings"
        ],
        "description": "Update the tenant's warehouse settings (partial patch).",
        "operationId": "warehouse-settings-set",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Partial patch — send only the fields you want to change.",
                "properties": {
                  "direct_transfer": {
                    "type": "boolean",
                    "description": "Auto-accept internal transfers without a separate acceptance step"
                  },
                  "direct_acceptance": {
                    "type": "boolean",
                    "description": "Auto-accept incoming stock on receipt"
                  },
                  "create_product_with_stock": {
                    "type": "boolean",
                    "description": "Allow creating a product together with an initial stock quantity"
                  },
                  "show_sale_price_in_transfers": {
                    "type": "boolean",
                    "description": "Show sale price on transfer documents"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated warehouse settings",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1warehouse-settings~1get/get/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/finance-settings/get": {
      "get": {
        "tags": [
          "Finance-settings"
        ],
        "parameters": [],
        "description": "Get the tenant's finance settings (created with defaults on first access).",
        "operationId": "finance-settings-get",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The finance settings",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "account_id": {
                              "type": "string"
                            },
                            "apply_in_main": {
                              "type": "boolean"
                            },
                            "service_cost_type": {
                              "type": "string",
                              "enum": [
                                "fixed",
                                "priced"
                              ]
                            },
                            "multi_currency": {
                              "type": "boolean"
                            },
                            "expense_approval_enabled": {
                              "type": "boolean"
                            },
                            "expense_approval_limit": {
                              "type": "number"
                            },
                            "discount_below_min_price_policy": {
                              "type": "string",
                              "enum": [
                                "strict",
                                "warning",
                                "override"
                              ]
                            },
                            "expense_approval_currency": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "symbol": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "number"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/finance-settings/set": {
      "put": {
        "tags": [
          "Finance-settings"
        ],
        "description": "Update the tenant's finance settings (partial patch). Setting expense_approval_currency_id denormalizes the currency; multi_currency cannot be disabled while more than one currency exists.",
        "operationId": "finance-settings-set",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Partial patch — send only the fields you want to change.",
                "properties": {
                  "apply_in_main": {
                    "type": "boolean",
                    "description": "Apply finance rules in the main organization"
                  },
                  "service_cost_type": {
                    "type": "string",
                    "enum": [
                      "fixed",
                      "priced"
                    ],
                    "description": "Service cost calculation type"
                  },
                  "multi_currency": {
                    "type": "boolean",
                    "description": "Enable multi-currency. Cannot be turned off while more than one currency exists."
                  },
                  "expense_approval_enabled": {
                    "type": "boolean",
                    "description": "Require owner approval for expenses above the limit"
                  },
                  "expense_approval_limit": {
                    "type": "number",
                    "description": "Approval threshold amount (in the approval currency)"
                  },
                  "expense_approval_currency_id": {
                    "type": "string",
                    "description": "Currency ObjectId the approval limit is denominated in"
                  },
                  "discount_below_min_price_policy": {
                    "type": "string",
                    "enum": [
                      "strict",
                      "warning",
                      "override"
                    ],
                    "description": "Policy when a sale discount drops below the product minimum price"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated finance settings",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1finance-settings~1get/get/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/units-of-measure/create": {
      "post": {
        "tags": [
          "Units-of-measure"
        ],
        "description": "This method allows adding units-of-measure into the account.",
        "operationId": "units-of-measure-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1units-of-measure~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "type": "string",
                    "default": ""
                  },
                  "short_name": {
                    "type": "string",
                    "default": ""
                  },
                  "code": {
                    "type": "string",
                    "default": ""
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "inactive"
                    ],
                    "default": "active"
                  },
                  "decimal_count": {
                    "type": "integer",
                    "default": 0,
                    "minimum": 0,
                    "maximum": 6
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "inventory",
                      "service"
                    ],
                    "default": ""
                  }
                },
                "type": "object",
                "required": [
                  "decimal_count",
                  "name",
                  "type"
                ]
              }
            }
          }
        }
      }
    },
    "/units-of-measure/update": {
      "put": {
        "tags": [
          "Units-of-measure"
        ],
        "description": "This method allows updating units-of-measure in the account.",
        "operationId": "units-of-measure-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "short_name": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "inactive"
                              ]
                            },
                            "system_code": {
                              "type": "string"
                            },
                            "decimal_count": {
                              "type": "integer",
                              "default": 0,
                              "minimum": 0,
                              "maximum": 6
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "inventory",
                                "service"
                              ]
                            },
                            "is_default": {
                              "type": "boolean"
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          },
                          "type": "object",
                          "required": [
                            "name",
                            "decimal_count",
                            "type"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "name": {
                    "type": "string",
                    "default": ""
                  },
                  "short_name": {
                    "type": "string",
                    "default": ""
                  },
                  "code": {
                    "type": "string",
                    "default": ""
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "inactive"
                    ],
                    "default": "active"
                  },
                  "decimal_count": {
                    "type": "integer",
                    "default": 0,
                    "minimum": 0,
                    "maximum": 6
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "inventory",
                      "service"
                    ],
                    "default": ""
                  }
                },
                "type": "object",
                "required": [
                  "decimal_count",
                  "name",
                  "_id"
                ]
              }
            }
          }
        }
      }
    },
    "/units-of-measure/delete/{id}": {
      "delete": {
        "tags": [
          "Units-of-measure"
        ],
        "description": "Delete a units-of-measure",
        "operationId": "units-of-measure-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/units-of-measure/get-all": {
      "get": {
        "tags": [
          "Units-of-measure"
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Search units-of-measure",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "description": "type units-of-measure",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "inventory",
                "service"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "status units-of-measure",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "inactive"
              ]
            }
          }
        ],
        "description": "Get all units-of-measures",
        "operationId": "units-of-measure-get-all",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1units-of-measure~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/units-of-measure/get-by-id/{id}": {
      "get": {
        "tags": [
          "Units-of-measure"
        ],
        "description": "Get units-of-measure using its _id",
        "operationId": "units-of-measure-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1units-of-measure~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/units-of-measure/get-deleted": {
      "get": {
        "tags": [
          "Units-of-measure"
        ],
        "description": "Get deleted units-of-measure ids",
        "operationId": "units-of-measure-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/units-of-measure/get-paging": {
      "post": {
        "tags": [
          "Units-of-measure"
        ],
        "description": "Get units-of-measure by paging",
        "operationId": "units-of-measure-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "inventory",
                          "service"
                        ]
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "active",
                          "inactive"
                        ]
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "code": {
                                    "type": "string"
                                  },
                                  "short_name": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "active",
                                      "inactive"
                                    ]
                                  },
                                  "system_code": {
                                    "type": "string"
                                  },
                                  "decimal_count": {
                                    "type": "integer",
                                    "default": 0,
                                    "minimum": 0,
                                    "maximum": 6
                                  },
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "inventory",
                                      "service"
                                    ]
                                  },
                                  "updated_by_user": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "created_by_user": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "created_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "updated_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "is_default": {
                                    "type": "boolean"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/payment-method/create": {
      "post": {
        "tags": [
          "Payment-method"
        ],
        "description": "This method allows adding payment-method into the account.",
        "operationId": "payment-method-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1payment-method~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "type": "string",
                    "default": ""
                  },
                  "shortcut": {
                    "type": "string",
                    "pattern": "^F(1[0-2]|[1-9])$",
                    "description": "Keyboard shortcut on the POS, `F1`–`F12`.",
                    "example": "F8"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "cashless"
                    ],
                    "default": "cashless",
                    "description": "Only `cashless` can be created. Every account has exactly one `cash` method, created by the system; sending `cash` returns a validation error."
                  },
                  "subtype": {
                    "type": "string",
                    "nullable": true,
                    "enum": [
                      "terminal",
                      "online",
                      "bank",
                      "bnpl"
                    ],
                    "description": "Finer classification of a `cashless` method: `terminal`, `online`, `bank` or `bnpl`. `cash` takes no subtype. Omit or send `null` to leave the method unclassified.",
                    "example": "terminal"
                  }
                },
                "type": "object",
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/payment-method/update": {
      "put": {
        "tags": [
          "Payment-method"
        ],
        "description": "This method allows updating payment-method in the account.",
        "operationId": "payment-method-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "shortcut": {
                              "type": "string"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "cash",
                                "cashless"
                              ],
                              "description": "`cash` (exactly one per account, created by the system) or `cashless`. Earlier versions of the API also returned `card`, `terminal`, `transfer`, `gift`, `integration` — these are now `cashless`, described by `subtype` and `is_integration`."
                            },
                            "subtype": {
                              "type": "string",
                              "nullable": true,
                              "enum": [
                                "terminal",
                                "online",
                                "bank",
                                "bnpl"
                              ],
                              "description": "Classification of a `cashless` method. `null` when the method is `cash` or has not been classified yet."
                            },
                            "is_integration": {
                              "type": "boolean",
                              "default": false,
                              "description": "The method was created by a payment integration (Payme, Click, …) rather than by a person. Replaces the old `integration` type."
                            },
                            "is_enabled": {
                              "type": "boolean",
                              "default": true
                            },
                            "is_default": {
                              "type": "boolean",
                              "default": false
                            },
                            "is_visible": {
                              "type": "boolean",
                              "default": false
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          },
                          "type": "object",
                          "required": [
                            "name"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "type": "string",
                    "default": ""
                  },
                  "shortcut": {
                    "type": "string",
                    "pattern": "^F(1[0-2]|[1-9])$",
                    "description": "Keyboard shortcut on the POS, `F1`–`F12`.",
                    "example": "F8"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "cash",
                      "cashless"
                    ],
                    "description": "Optional; omit it to keep the current type. A method cannot be changed to or from `cash`: a `type` that would do so is ignored and the rest of the update is applied."
                  },
                  "subtype": {
                    "type": "string",
                    "nullable": true,
                    "enum": [
                      "terminal",
                      "online",
                      "bank",
                      "bnpl"
                    ],
                    "description": "Finer classification of a `cashless` method: `terminal`, `online`, `bank` or `bnpl`. `cash` takes no subtype. Omit or send `null` to leave the method unclassified.",
                    "example": "terminal"
                  },
                  "_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  }
                },
                "type": "object",
                "required": [
                  "name",
                  "_id"
                ]
              }
            }
          }
        }
      }
    },
    "/payment-method/delete/{id}": {
      "delete": {
        "tags": [
          "Payment-method"
        ],
        "description": "Delete a payment-method",
        "operationId": "payment-method-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/payment-method/get-all": {
      "get": {
        "tags": [
          "Payment-method"
        ],
        "parameters": [
          {
            "name": "is_enabled",
            "in": "query",
            "description": "Filter payment-methods by enabled status",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "description": "Get all payment-methods",
        "operationId": "payment-method-get-all",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1payment-method~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/payment-method/get-by-id/{id}": {
      "get": {
        "tags": [
          "Payment-method"
        ],
        "description": "Get payment-method using its _id",
        "operationId": "payment-method-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1payment-method~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/payment-method/get-deleted": {
      "get": {
        "tags": [
          "Payment-method"
        ],
        "description": "Get deleted payment-method ids",
        "operationId": "payment-method-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/payment-method/set-active": {
      "put": {
        "tags": [
          "Payment-method"
        ],
        "description": "This method allows setActive payment-method in the account.",
        "operationId": "payment-method-set-active",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1payment-method~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "is_enabled": {
                    "type": "boolean",
                    "default": true
                  },
                  "_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  }
                },
                "required": [
                  "_id",
                  "is_enabled"
                ]
              }
            }
          }
        }
      }
    },
    "/payment-type/create": {
      "post": {
        "tags": [
          "Payment-type"
        ],
        "description": "This method allows adding payment-type into the account.",
        "operationId": "payment-type-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1payment-type~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "type": "string",
                    "default": ""
                  },
                  "parent_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "transaction_type": {
                    "type": "string",
                    "enum": [
                      "income",
                      "expense",
                      "transfer",
                      "exchange",
                      "nothing",
                      "exchange_method"
                    ],
                    "default": "income"
                  },
                  "user_type": {
                    "type": "string",
                    "enum": [
                      "supplier",
                      "employee",
                      "customer",
                      "person",
                      "other"
                    ],
                    "default": "supplier"
                  },
                  "can_be_canceled": {
                    "type": "boolean",
                    "default": false
                  }
                },
                "type": "object",
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/payment-type/update": {
      "put": {
        "tags": [
          "Payment-type"
        ],
        "description": "This method allows updating payment-type in the account.",
        "operationId": "payment-type-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "short_cut": {
                              "type": "string"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "cash",
                                "card",
                                "debt",
                                "gift",
                                "transfer",
                                "terminal",
                                "by_balance",
                                "by_cashback"
                              ]
                            },
                            "is_enabled": {
                              "type": "boolean",
                              "default": true
                            },
                            "is_default": {
                              "type": "boolean",
                              "default": false
                            },
                            "is_visible": {
                              "type": "boolean",
                              "default": false
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          },
                          "type": "object",
                          "required": [
                            "name"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "default": "",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "name": {
                    "type": "string",
                    "default": ""
                  },
                  "parent_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "transaction_type": {
                    "type": "string",
                    "enum": [
                      "income",
                      "expense",
                      "transfer",
                      "exchange",
                      "nothing",
                      "exchange_method"
                    ],
                    "default": "income"
                  },
                  "user_type": {
                    "type": "string",
                    "enum": [
                      "supplier",
                      "employee",
                      "customer",
                      "person",
                      "other"
                    ],
                    "default": "supplier"
                  },
                  "can_be_canceled": {
                    "type": "boolean",
                    "default": false
                  }
                },
                "type": "object",
                "required": [
                  "name",
                  "_id"
                ]
              }
            }
          }
        }
      }
    },
    "/payment-type/delete/{id}": {
      "delete": {
        "tags": [
          "Payment-type"
        ],
        "description": "Delete a payment-type",
        "operationId": "payment-type-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/payment-type/get-all": {
      "post": {
        "tags": [
          "Payment-type"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "transaction_type": {
                    "type": "string",
                    "enum": [
                      "income",
                      "expense",
                      "transfer",
                      "exchange",
                      "nothing",
                      "exchange_method"
                    ]
                  },
                  "user_type": {
                    "type": "string",
                    "enum": [
                      "supplier",
                      "employee",
                      "customer",
                      "person",
                      "other"
                    ]
                  },
                  "is_visible": {
                    "type": "boolean",
                    "default": false
                  },
                  "is_active": {
                    "type": "boolean",
                    "default": true
                  },
                  "search": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "description": "Get all payment-types",
        "operationId": "payment-type-get-all",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1payment-type~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/payment-type/get-by-id/{id}": {
      "get": {
        "tags": [
          "Payment-type"
        ],
        "description": "Get payment-type using its _id",
        "operationId": "payment-type-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1payment-type~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/payment-type/get-deleted": {
      "get": {
        "tags": [
          "Payment-type"
        ],
        "description": "Get deleted payment-type ids",
        "operationId": "payment-type-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/payment-type/set-state": {
      "put": {
        "tags": [
          "Payment-type"
        ],
        "description": "This method allows setActive payment-type in the account.",
        "operationId": "payment-type-set-active",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1payment-type~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "is_active": {
                    "type": "boolean",
                    "default": true
                  },
                  "_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  }
                },
                "required": [
                  "_id",
                  "is_active"
                ]
              }
            }
          }
        }
      }
    },
    "/extra-cost/create": {
      "post": {
        "tags": [
          "Extra-cost"
        ],
        "description": "This method allows adding extra-cost into the account.",
        "operationId": "extra-cost-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1extra-cost~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "type": "string",
                    "default": ""
                  },
                  "is_affect_price": {
                    "type": "boolean",
                    "default": false
                  },
                  "distribution_method": {
                    "type": "string",
                    "enum": [
                      "byPrice",
                      "byAmount",
                      "byGrossWeight",
                      "byVolume",
                      "manual"
                    ],
                    "default": "byPrice"
                  },
                  "recommended_amount": {
                    "type": "number",
                    "default": 0
                  },
                  "max_amount": {
                    "type": "number",
                    "default": 0
                  },
                  "currency_id": {
                    "type": "string",
                    "example": "646b0c2f3d4e1a001f8b4567"
                  },
                  "payment_type_id": {
                    "type": "string",
                    "example": "646b0c2f3d4e1a001f8b4567"
                  },
                  "user_type": {
                    "type": "string",
                    "enum": [
                      "supplier",
                      "employee",
                      "customer",
                      "person",
                      "other"
                    ],
                    "default": "supplier"
                  },
                  "customer_id": {
                    "type": "string",
                    "example": "646b0c2f3d4e1a001f8b4567"
                  },
                  "supplier_id": {
                    "type": "string",
                    "example": "646b0c2f3d4e1a001f8b4567"
                  },
                  "employee_id": {
                    "type": "string",
                    "example": "646b0c2f3d4e1a001f8b4567"
                  },
                  "person_id": {
                    "type": "string",
                    "example": "646b0c2f3d4e1a001f8b4567"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "inactive"
                    ],
                    "default": "active"
                  },
                  "note": {
                    "type": "string",
                    "default": "",
                    "maxLength": 512
                  }
                },
                "type": "object",
                "required": [
                  "name",
                  "is_affect_price",
                  "distribution_method",
                  "recommended_amount",
                  "max_amount",
                  "currency_id",
                  "payment_type_id",
                  "status"
                ]
              }
            }
          }
        }
      }
    },
    "/extra-cost/update": {
      "put": {
        "tags": [
          "Extra-cost"
        ],
        "description": "This method allows updating extra-cost in the account.",
        "operationId": "extra-cost-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "is_affect_price": {
                              "type": "boolean"
                            },
                            "distribution_method": {
                              "type": "string"
                            },
                            "amount": {
                              "type": "number"
                            },
                            "should_create_transaction": {
                              "type": "boolean"
                            },
                            "recommended_amount": {
                              "type": "number"
                            },
                            "max_amount": {
                              "type": "number"
                            },
                            "note": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "inactive"
                              ]
                            },
                            "payment_type": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "user_type": {
                                  "type": "string"
                                }
                              }
                            },
                            "currency_id": {
                              "type": "string"
                            },
                            "currency": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "updated_by_user": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                }
                              }
                            },
                            "created_by_user": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                }
                              }
                            },
                            "employee": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                }
                              }
                            },
                            "customer": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "supplier": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "person": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "type": "object",
                          "required": [
                            "name",
                            "currency_id",
                            "payment_type_id",
                            "max_amount",
                            "recommended_amount"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "default": "",
                    "example": "646b0c2f3d4e1a001f8b4567"
                  },
                  "name": {
                    "type": "string",
                    "default": ""
                  },
                  "is_affect_price": {
                    "type": "boolean",
                    "default": false
                  },
                  "distribution_method": {
                    "type": "string",
                    "enum": [
                      "byPrice",
                      "byAmount",
                      "byGrossWeight",
                      "byVolume",
                      "manual"
                    ],
                    "default": "byPrice"
                  },
                  "recommended_amount": {
                    "type": "number",
                    "default": 0
                  },
                  "max_amount": {
                    "type": "number",
                    "default": 0
                  },
                  "currency_id": {
                    "type": "string",
                    "example": "646b0c2f3d4e1a001f8b4567"
                  },
                  "payment_type_id": {
                    "type": "string",
                    "example": "646b0c2f3d4e1a001f8b4567"
                  },
                  "user_type": {
                    "type": "string",
                    "enum": [
                      "supplier",
                      "employee",
                      "customer",
                      "person",
                      "other"
                    ],
                    "default": "supplier"
                  },
                  "customer_id": {
                    "type": "string",
                    "example": "646b0c2f3d4e1a001f8b4567"
                  },
                  "supplier_id": {
                    "type": "string",
                    "example": "646b0c2f3d4e1a001f8b4567"
                  },
                  "employee_id": {
                    "type": "string",
                    "example": "646b0c2f3d4e1a001f8b4567"
                  },
                  "person_id": {
                    "type": "string",
                    "example": "646b0c2f3d4e1a001f8b4567"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "inactive"
                    ],
                    "default": "active"
                  },
                  "note": {
                    "type": "string",
                    "default": "",
                    "maxLength": 512
                  }
                },
                "type": "object",
                "required": [
                  "name",
                  "is_affect_price",
                  "distribution_method",
                  "recommended_amount",
                  "max_amount",
                  "currency_id",
                  "payment_type_id",
                  "status",
                  "_id"
                ]
              }
            }
          }
        }
      }
    },
    "/extra-cost/delete/{id}": {
      "delete": {
        "tags": [
          "Extra-cost"
        ],
        "description": "Delete a extra-cost",
        "operationId": "extra-cost-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/extra-cost/get-all": {
      "get": {
        "tags": [
          "Extra-cost"
        ],
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "inactive"
              ]
            }
          },
          {
            "name": "distribution_method_ne",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "byPrice",
                "byAmount",
                "byGrossWeight",
                "byVolume",
                "manual"
              ]
            }
          }
        ],
        "description": "Get all extra-costs",
        "operationId": "extra-cost-get-all",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1extra-cost~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/extra-cost/get-by-id/{id}": {
      "get": {
        "tags": [
          "Extra-cost"
        ],
        "description": "Get extra-cost using its _id",
        "operationId": "extra-cost-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1extra-cost~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/extra-cost/get-deleted": {
      "get": {
        "tags": [
          "Extra-cost"
        ],
        "description": "Get deleted extra-cost ids",
        "operationId": "extra-cost-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/extra-cost/get-paging": {
      "post": {
        "tags": [
          "Extra-cost"
        ],
        "description": "Get extra-cost by paging",
        "operationId": "extra-cost-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string"
                      },
                      "distribution_method_ne": {
                        "type": "string",
                        "enum": [
                          "byPrice",
                          "byAmount",
                          "byGrossWeight",
                          "byVolume",
                          "manual"
                        ],
                        "default": "byPrice"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "active",
                          "inactive"
                        ]
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "$ref": "#GetById"
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/purchase/create": {
      "post": {
        "tags": [
          "Purchase"
        ],
        "description": "This method allows adding purchase into the account.",
        "operationId": "purchase-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1purchase~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "code": {
                    "type": "string",
                    "example": "PR-001"
                  },
                  "organization_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "canceled",
                      "new",
                      "done",
                      "in_progress",
                      "draft"
                    ],
                    "example": "new"
                  },
                  "date": {
                    "type": "string",
                    "format": "date",
                    "example": "2023-10-01"
                  },
                  "income_date": {
                    "type": "string",
                    "format": "date",
                    "example": "2023-10-01"
                  },
                  "responsible_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "supplier_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "supliaer_assistant_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "warehouse_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "currency_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "note": {
                    "type": "string",
                    "example": "This is a note",
                    "maxLength": 512
                  },
                  "price_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "orders": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "order_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d80a"
                        },
                        "products": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "order_item_id": {
                                "type": "string",
                                "example": "64b7f4d9e2b3b6a0b7c5d80a"
                              },
                              "product_id": {
                                "type": "string",
                                "example": "64b7f4d9e2b3b6a0b7c5d80a"
                              },
                              "amount": {
                                "type": "number",
                                "example": 10
                              },
                              "box_count": {
                                "type": "number",
                                "example": 2,
                                "minimum": 0
                              },
                              "box_item": {
                                "type": "number",
                                "example": 5,
                                "minimum": 0
                              },
                              "cost": {
                                "type": "number",
                                "example": 100
                              },
                              "extra_cost": {
                                "type": "number",
                                "example": 10
                              },
                              "extra_costs": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "cost_id": {
                                      "type": "string",
                                      "example": "64b7f4d9e2b3b6a0b7c5d80a"
                                    },
                                    "amount": {
                                      "type": "number",
                                      "example": 10
                                    }
                                  },
                                  "required": [
                                    "cost_id",
                                    "amount"
                                  ]
                                }
                              },
                              "marks": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "prices": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "price_id": {
                                      "type": "string",
                                      "example": "64b7f4d9e2b3b6a0b7c5d80a"
                                    },
                                    "amount": {
                                      "type": "number",
                                      "example": 10,
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "price_id",
                                    "amount"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "product_id",
                              "amount",
                              "cost",
                              "extra_cost",
                              "prices",
                              "extra_costs",
                              "marks"
                            ]
                          },
                          "minItems": 1
                        }
                      },
                      "required": [
                        "products"
                      ]
                    }
                  },
                  "additional_costs": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "cost_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d80a"
                        },
                        "amount": {
                          "type": "number",
                          "example": 10
                        },
                        "customer_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d80a"
                        },
                        "employee_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d80a"
                        },
                        "supplier_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d80a"
                        },
                        "person_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d80a"
                        }
                      },
                      "required": [
                        "cost_id",
                        "amount"
                      ]
                    }
                  },
                  "is_auto_income": {
                    "type": "boolean",
                    "example": true
                  },
                  "contract_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  }
                },
                "type": "object",
                "required": [
                  "organization_id",
                  "state",
                  "date",
                  "responsible_id",
                  "supliaer_id",
                  "warehouse_id",
                  "currency_id",
                  "orders",
                  "additional_costs"
                ]
              }
            }
          }
        }
      }
    },
    "/purchase/update": {
      "put": {
        "tags": [
          "Purchase"
        ],
        "description": "This method allows updating purchase in the account.",
        "operationId": "purchase-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "code": {
                              "type": "string"
                            },
                            "number": {
                              "type": "string"
                            },
                            "organization_id": {
                              "type": "string"
                            },
                            "organization": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "state": {
                              "type": "string"
                            },
                            "date": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "income_date": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "responsible_id": {
                              "type": "string"
                            },
                            "responsible": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                }
                              }
                            },
                            "supplier_id": {
                              "type": "string"
                            },
                            "supplier": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "created_by": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                }
                              }
                            },
                            "suplier_assistant": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "string"
                                }
                              }
                            },
                            "supplier_assistant_hierarchy": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string"
                                  },
                                  "first_name": {
                                    "type": "string"
                                  },
                                  "last_name": {
                                    "type": "string"
                                  },
                                  "middle_name": {
                                    "type": "string"
                                  }
                                }
                              }
                            },
                            "currency_id": {
                              "type": "string"
                            },
                            "currency": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "uuid": {
                                  "type": "number"
                                },
                                "value": {
                                  "type": "number"
                                },
                                "symbol": {
                                  "type": "string"
                                },
                                "side": {
                                  "type": "string"
                                }
                              }
                            },
                            "note": {
                              "type": "string"
                            },
                            "total_amount": {
                              "type": "number"
                            },
                            "total_cost": {
                              "type": "number"
                            },
                            "additional_costs": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            },
                            "orders": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            },
                            "invoice": {
                              "type": "object"
                            },
                            "is_fully_income": {
                              "type": "boolean"
                            },
                            "total_income": {
                              "type": "number"
                            },
                            "total_refunded": {
                              "type": "number"
                            },
                            "is_auto_create": {
                              "type": "boolean"
                            },
                            "is_fully_refunded": {
                              "type": "boolean"
                            },
                            "incomes": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            },
                            "purchase_returns": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            },
                            "total_extra_cost": {
                              "type": "number"
                            },
                            "contract_id": {
                              "type": "string"
                            },
                            "contract": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "number": {
                                  "type": "string"
                                },
                                "currency_id": {
                                  "type": "string"
                                },
                                "organization_id": {
                                  "type": "string"
                                },
                                "amount": {
                                  "type": "number"
                                },
                                "date": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "expire_date": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "person_id": {
                                  "type": "string"
                                },
                                "note": {
                                  "type": "string"
                                },
                                "is_active": {
                                  "type": "boolean"
                                },
                                "contract_number": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "type": "object",
                          "required": [
                            "_id",
                            "created_at",
                            "updated_at",
                            "number",
                            "organization_id",
                            "date",
                            "responsible_id",
                            "supplier_id",
                            "currency_id",
                            "currency",
                            "total_amount",
                            "total_cost",
                            "total_extra_cost"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "code": {
                    "type": "string",
                    "example": "PR-001"
                  },
                  "organization_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "date": {
                    "type": "string",
                    "format": "date",
                    "example": "2023-10-01"
                  },
                  "income_date": {
                    "type": "string",
                    "format": "date",
                    "example": "2023-10-01"
                  },
                  "responsible_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "supliaer_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "supliaer_assistant_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "warehouse_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "currency_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "note": {
                    "type": "string",
                    "example": "This is a note",
                    "maxLength": 512
                  },
                  "orders": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "order_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d80a"
                        },
                        "products": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "order_item_id": {
                                "type": "string",
                                "example": "64b7f4d9e2b3b6a0b7c5d80a"
                              },
                              "product_id": {
                                "type": "string",
                                "example": "64b7f4d9e2b3b6a0b7c5d80a"
                              },
                              "amount": {
                                "type": "number",
                                "example": 10
                              },
                              "box_count": {
                                "type": "number",
                                "example": 2,
                                "minimum": 0
                              },
                              "box_item": {
                                "type": "number",
                                "example": 5,
                                "minimum": 0
                              },
                              "cost": {
                                "type": "number",
                                "example": 100
                              },
                              "extra_cost": {
                                "type": "number",
                                "example": 10
                              },
                              "extra_costs": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "cost_id": {
                                      "type": "string",
                                      "example": "64b7f4d9e2b3b6a0b7c5d80a"
                                    },
                                    "amount": {
                                      "type": "number",
                                      "example": 10
                                    }
                                  },
                                  "required": [
                                    "cost_id",
                                    "amount"
                                  ]
                                }
                              },
                              "prices": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "price_id": {
                                      "type": "string",
                                      "example": "64b7f4d9e2b3b6a0b7c5d80a"
                                    },
                                    "amount": {
                                      "type": "number",
                                      "example": 10,
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "price_id",
                                    "amount"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "product_id",
                              "amount",
                              "cost",
                              "extra_cost",
                              "prices",
                              "extra_costs"
                            ]
                          },
                          "minItems": 1
                        }
                      },
                      "required": [
                        "products"
                      ]
                    }
                  },
                  "additional_costs": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "cost_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d80a"
                        },
                        "amount": {
                          "type": "number",
                          "example": 10
                        },
                        "customer_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d80a"
                        },
                        "employee_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d80a"
                        },
                        "supplier_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d80a"
                        },
                        "person_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d80a"
                        }
                      },
                      "required": [
                        "cost_id",
                        "amount"
                      ]
                    }
                  },
                  "is_auto_income": {
                    "type": "boolean",
                    "example": true
                  },
                  "contract_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  }
                },
                "type": "object",
                "required": [
                  "organization_id",
                  "date",
                  "responsible_id",
                  "supliaer_id",
                  "warehouse_id",
                  "currency_id",
                  "orders",
                  "additional_costs"
                ]
              }
            }
          }
        }
      }
    },
    "/purchase/get-paging": {
      "post": {
        "tags": [
          "Purchase"
        ],
        "description": "Get purchase by paging",
        "operationId": "purchase-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string",
                        "description": "search string to filter by code or name"
                      },
                      "states": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "canceled",
                            "new",
                            "done",
                            "in_progress"
                          ]
                        },
                        "description": "list of states to filter by state"
                      },
                      "organization_id": {
                        "type": "string",
                        "description": "organization id to filter by organization"
                      },
                      "responsible_id": {
                        "type": "string",
                        "description": "responsible id to filter by responsible"
                      },
                      "date_from": {
                        "type": "string",
                        "format": "date-time",
                        "description": "date from to filter by date"
                      },
                      "date_to": {
                        "type": "string",
                        "format": "date-time",
                        "description": "date to to filter by date"
                      },
                      "supliaer_id": {
                        "type": "string",
                        "description": "supplier id to filter by supplier"
                      },
                      "is_fully_income": {
                        "type": "boolean",
                        "description": "is fully income to filter by fully income"
                      },
                      "is_fully_refunded": {
                        "type": "boolean",
                        "description": "is fully refunded to filter by fully refunded"
                      },
                      "has_any_income": {
                        "type": "boolean",
                        "description": "has any income to filter by any income"
                      },
                      "contract_id": {
                        "type": "string",
                        "description": "contract id to filter by contract"
                      },
                      "income_states": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "zero",
                            "full",
                            "partial"
                          ]
                        },
                        "description": "list of states to filter by income state"
                      },
                      "refunded_states": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "zero",
                            "full",
                            "partial"
                          ]
                        },
                        "description": "list of states to filter by refunded state"
                      },
                      "currency_id": {
                        "type": "string",
                        "description": "currency id to filter by currency"
                      },
                      "updated_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "updated at from to filter by updated at"
                      },
                      "total_from": {
                        "type": "number",
                        "description": "total from to filter by total"
                      },
                      "total_to": {
                        "type": "number",
                        "description": "total to to filter by total"
                      },
                      "is_auto_create": {
                        "type": "boolean",
                        "description": "is auto created to filter by auto created"
                      },
                      "sort_by": {
                        "type": "string",
                        "description": "sort by field to sort by"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "properties": {
                        "created_at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updated_at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "code": {
                          "type": "string"
                        },
                        "number": {
                          "type": "string"
                        },
                        "organization_id": {
                          "type": "string"
                        },
                        "organization": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          }
                        },
                        "state": {
                          "type": "string"
                        },
                        "date": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "income_date": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "responsible_id": {
                          "type": "string"
                        },
                        "responsible": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "full_name": {
                              "type": "string"
                            }
                          }
                        },
                        "supplier_id": {
                          "type": "string"
                        },
                        "supplier": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          }
                        },
                        "currency_id": {
                          "type": "string"
                        },
                        "total_amount": {
                          "type": "number"
                        },
                        "total_cost": {
                          "type": "number"
                        },
                        "is_fully_income": {
                          "type": "boolean"
                        },
                        "total_income": {
                          "type": "number"
                        },
                        "total_refunded": {
                          "type": "number"
                        },
                        "is_fully_refunded": {
                          "type": "boolean"
                        },
                        "contract": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "number": {
                              "type": "string"
                            },
                            "currency_id": {
                              "type": "string"
                            },
                            "organization_id": {
                              "type": "string"
                            },
                            "amount": {
                              "type": "number"
                            },
                            "date": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "expire_date": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "person_id": {
                              "type": "string"
                            },
                            "note": {
                              "type": "string"
                            },
                            "is_active": {
                              "type": "boolean"
                            },
                            "contract_number": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "type": "object",
                      "required": [
                        "_id",
                        "created_at",
                        "updated_at",
                        "number",
                        "organization_id",
                        "date",
                        "responsible_id",
                        "supplier_id",
                        "currency_id",
                        "total_amount"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/purchase/get-by-id/{id}": {
      "get": {
        "tags": [
          "Purchase"
        ],
        "description": "Get purchase using its _id",
        "operationId": "purchase-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1purchase~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/purchase/set-state": {
      "put": {
        "tags": [
          "Purchase"
        ],
        "description": "setState purchase",
        "operationId": "purchase-cancel",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "canceled",
                      "new",
                      "done",
                      "in_progress",
                      "draft"
                    ],
                    "example": "new"
                  },
                  "cancel_extra_cost": {
                    "type": "boolean",
                    "default": false,
                    "description": "cancel extra costs when canceling the purchase"
                  },
                  "with_transactions": {
                    "type": "boolean",
                    "default": false,
                    "description": "cancel transactions when canceling the purchase"
                  }
                },
                "type": "object",
                "required": [
                  "state",
                  "_id",
                  "cancel_extra_cost",
                  "with_transactions"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1purchase~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/income/create": {
      "post": {
        "tags": [
          "Income"
        ],
        "description": "This method allows adding income into the account.",
        "operationId": "income-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1income~1cancel/put/responses/200/content/application~1json/schema"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "nullable": true,
                    "example": "INC-2024-001"
                  },
                  "organization_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d7f2"
                  },
                  "responsible_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d7f3"
                  },
                  "date": {
                    "type": "string",
                    "format": "date-time",
                    "example": "2024-07-20T10:30:00Z"
                  },
                  "supplier_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d7f4"
                  },
                  "supplier_assistant_id": {
                    "type": "string",
                    "nullable": true,
                    "example": "64b7f4d9e2b3b6a0b7c5d7f5"
                  },
                  "warehouse_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d7f6"
                  },
                  "currency_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d7f7"
                  },
                  "note": {
                    "type": "string",
                    "nullable": true,
                    "maxLength": 512,
                    "example": "Some notes about the income"
                  },
                  "purchases": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "purchase_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d7f8"
                        },
                        "products": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "purchase_item_id": {
                                "type": "string",
                                "example": "64b7f4d9e2b3b6a0b7c5d7f9"
                              },
                              "amount": {
                                "type": "number",
                                "default": 0
                              },
                              "box_count": {
                                "type": "number",
                                "default": 0,
                                "minimum": 0
                              },
                              "box_item": {
                                "type": "number",
                                "default": 0,
                                "minimum": 0
                              },
                              "product_id": {
                                "type": "string",
                                "example": "64b7f4d9e2b3b6a0b7c5d7fa"
                              },
                              "cost": {
                                "type": "number",
                                "default": 0
                              },
                              "extra_cost": {
                                "type": "number",
                                "default": 0
                              },
                              "marks": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "extra_costs": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "cost_id": {
                                      "type": "string",
                                      "example": "64b7f4d9e2b3b6a0b7c5d7fb"
                                    },
                                    "amount": {
                                      "type": "number",
                                      "example": 10
                                    }
                                  },
                                  "required": [
                                    "cost_id",
                                    "amount"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "product_id",
                              "amount",
                              "cost",
                              "extra_cost",
                              "marks",
                              "extra_costs",
                              "purchase_item_id"
                            ]
                          }
                        }
                      },
                      "required": [
                        "purchase_id",
                        "products"
                      ]
                    },
                    "minItems": 1
                  },
                  "additional_costs": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "cost_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d7fc"
                        },
                        "amount": {
                          "type": "number",
                          "default": 0
                        },
                        "customer_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d7fd"
                        },
                        "person_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d7fe"
                        },
                        "supplier_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                        },
                        "employee_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d800"
                        }
                      },
                      "required": [
                        "cost_id",
                        "amount"
                      ]
                    }
                  }
                },
                "required": [
                  "organization_id",
                  "responsible_id",
                  "date",
                  "supplier_id",
                  "warehouse_id",
                  "currency_id",
                  "purchases"
                ]
              }
            }
          }
        }
      }
    },
    "/income/cancel": {
      "put": {
        "tags": [
          "Income"
        ],
        "description": "Cancel income",
        "operationId": "income-cancel",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d801"
                  },
                  "cancel_extra_cost": {
                    "type": "boolean",
                    "example": true
                  },
                  "with_transactions": {
                    "type": "boolean",
                    "example": true
                  }
                },
                "type": "object",
                "required": [
                  "cancel_extra_cost",
                  "with_transactions",
                  "_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updated_at": {
                      "type": "number",
                      "format": "date-time"
                    },
                    "code": {
                      "type": "string",
                      "example": "INC-2024-001"
                    },
                    "number": {
                      "type": "string"
                    },
                    "organization_id": {
                      "type": "string"
                    },
                    "organization": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "date": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "warehouse_id": {
                      "type": "string"
                    },
                    "warehouse": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "responsible_id": {
                      "type": "string"
                    },
                    "responsible": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "full_name": {
                          "type": "string"
                        }
                      }
                    },
                    "supplier_id": {
                      "type": "string"
                    },
                    "supplier": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "currency_id": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "symbol": {
                          "type": "string"
                        },
                        "uuid": {
                          "type": "number"
                        },
                        "value": {
                          "type": "number"
                        },
                        "side": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "_id",
                        "name",
                        "value"
                      ]
                    },
                    "note": {
                      "type": "string"
                    },
                    "total_amount": {
                      "type": "number"
                    },
                    "total_cost": {
                      "type": "number"
                    },
                    "additional_costs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "cost_id": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "number"
                          },
                          "cost": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "is_affect_price": {
                                "type": "boolean"
                              },
                              "distribution_method": {
                                "type": "string"
                              },
                              "recommended_amount": {
                                "type": "number"
                              },
                              "max_amount": {
                                "type": "number"
                              },
                              "currency_id": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "purchases": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "state": {
                      "type": "string"
                    },
                    "created_by": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "number"
                        },
                        "full_name": {
                          "type": "string"
                        },
                        "phone_number": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/income/get-by-id/{id}": {
      "get": {
        "tags": [
          "Income"
        ],
        "description": "Get income using its _id",
        "operationId": "income-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1income~1cancel/put/responses/200/content/application~1json/schema"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/income/get-paging": {
      "post": {
        "tags": [
          "Income"
        ],
        "description": "Get income by paging",
        "operationId": "income-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string"
                      },
                      "supplier_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                      },
                      "organization_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d800"
                      },
                      "responsible_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d801"
                      },
                      "date_from": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2024-07-01T00:00:00Z"
                      },
                      "date_to": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2024-07-31T23:59:59Z"
                      },
                      "updated_at": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2024-07-20T10:30:00Z"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "created_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "updated_at": {
                                    "type": "number",
                                    "format": "date-time"
                                  },
                                  "code": {
                                    "type": "string",
                                    "example": "INC-2024-001"
                                  },
                                  "number": {
                                    "type": "string"
                                  },
                                  "organization_id": {
                                    "type": "string"
                                  },
                                  "organization": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "date": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "responsible_id": {
                                    "type": "string"
                                  },
                                  "responsible": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "supplier_id": {
                                    "type": "string"
                                  },
                                  "supplier": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "currency_id": {
                                    "type": "string"
                                  },
                                  "currency": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "symbol": {
                                        "type": "string"
                                      },
                                      "uuid": {
                                        "type": "number"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "side": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "_id",
                                      "name",
                                      "value"
                                    ]
                                  },
                                  "note": {
                                    "type": "string"
                                  },
                                  "total_amount": {
                                    "type": "number"
                                  },
                                  "total_cost": {
                                    "type": "number"
                                  },
                                  "state": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/invoice/create": {
      "post": {
        "tags": [
          "Invoice"
        ],
        "description": "This method allows adding invoice into the account.",
        "operationId": "invoice-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1invoice~1set-state/put/responses/200/content/application~1json/schema"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "user_type": {
                    "type": "string",
                    "enum": [
                      "supplier",
                      "employee",
                      "customer",
                      "person",
                      "other"
                    ],
                    "example": "customer"
                  },
                  "payment_type_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                  },
                  "organization_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d800"
                  },
                  "customer_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d801"
                  },
                  "customer_assistant_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d802"
                  },
                  "supplier_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d803"
                  },
                  "supplier_assistant_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d804"
                  },
                  "employee_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d805"
                  },
                  "employee_assistant_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d806"
                  },
                  "person_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d807"
                  },
                  "person_assistant_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d808"
                  },
                  "currency_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d809"
                  },
                  "to_be_paid": {
                    "type": "number",
                    "example": 100
                  },
                  "payment_date": {
                    "type": "string",
                    "format": "date-time",
                    "example": "2024-07-20T10:30:00Z"
                  },
                  "description": {
                    "type": "string",
                    "example": "Invoice description",
                    "maxLength": 512
                  },
                  "exchange_balance": {
                    "type": "boolean",
                    "example": false
                  }
                },
                "type": "object",
                "required": [
                  "user_type",
                  "payment_type_id",
                  "organization_id",
                  "customer_id",
                  "supplier_id",
                  "employee_id",
                  "person_id",
                  "currency_id",
                  "to_be_paid",
                  "payment_date",
                  "exchange_balance"
                ]
              }
            }
          }
        }
      }
    },
    "/invoice/get-by-id/{id}": {
      "get": {
        "tags": [
          "Invoice"
        ],
        "description": "Get invoice using its _id",
        "operationId": "invoice-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1invoice~1set-state/put/responses/200/content/application~1json/schema"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/invoice/set-state": {
      "put": {
        "tags": [
          "Invoice"
        ],
        "description": "setState invoice",
        "operationId": "invoice-cancel",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "canceled",
                      "pending",
                      "done",
                      "rejected"
                    ],
                    "example": "canceled"
                  },
                  "with_transactions": {
                    "type": "boolean",
                    "example": true
                  }
                },
                "type": "object",
                "required": [
                  "state",
                  "_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "number": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    },
                    "can_be_canceled": {
                      "type": "boolean"
                    },
                    "balance_changes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "currency_id": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "number"
                          },
                          "value": {
                            "type": "number"
                          },
                          "user_type": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "organization": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "payment_type": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "user_type": {
                      "type": "string"
                    },
                    "is_refund": {
                      "type": "boolean"
                    },
                    "date": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "customer": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "supplier": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "employee": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "full_name": {
                          "type": "string"
                        }
                      }
                    },
                    "person": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "full_name": {
                          "type": "string"
                        }
                      }
                    },
                    "write_off": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "number": {
                          "type": "string"
                        }
                      }
                    },
                    "income": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "number": {
                          "type": "string"
                        }
                      }
                    },
                    "purchase": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "number": {
                          "type": "string"
                        }
                      }
                    },
                    "revision": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "balance_type": {
                          "type": "string"
                        },
                        "number": {
                          "type": "string"
                        }
                      }
                    },
                    "purchase_return": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "number": {
                          "type": "string"
                        }
                      }
                    },
                    "trade": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "number": {
                          "type": "string"
                        },
                        "is_refund": {
                          "type": "boolean"
                        }
                      }
                    },
                    "to_be_paid": {
                      "type": "number"
                    },
                    "paid": {
                      "type": "number"
                    },
                    "paid_by_balance": {
                      "type": "number"
                    },
                    "paid_by_cashback": {
                      "type": "number"
                    },
                    "to_be_refunded": {
                      "type": "number"
                    },
                    "refunded": {
                      "type": "number"
                    },
                    "currency_id": {
                      "type": "string"
                    },
                    "payment_date": {
                      "type": "integer"
                    },
                    "created_by": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "full_name": {
                          "type": "string"
                        }
                      }
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "extra_cost": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "number"
                        }
                      }
                    },
                    "attachments": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "description": {
                      "type": "string"
                    },
                    "transactions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "responsible_id": {
                      "type": "string"
                    },
                    "responsible": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "full_name": {
                          "type": "string"
                        }
                      }
                    },
                    "customer_assistant": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        }
                      }
                    },
                    "supplier_assistant": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        }
                      }
                    },
                    "employee_assistant": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        }
                      }
                    },
                    "person_assistant": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        }
                      }
                    },
                    "supplier_assistant_hierarchy": {
                      "type": "string"
                    },
                    "customer_assistant_hierarchy": {
                      "type": "string"
                    },
                    "employee_assistant_hierarchy": {
                      "type": "string"
                    },
                    "person_assistant_hierarchy": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/invoice/get-paging": {
      "post": {
        "tags": [
          "Invoice"
        ],
        "description": "Get invoice by paging",
        "operationId": "invoice-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "is_fully_paid": {
                        "type": "boolean",
                        "example": true
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "income",
                          "expense",
                          "transfer",
                          "exchange",
                          "exchange_method",
                          "nothing"
                        ]
                      },
                      "trade_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d80a"
                      },
                      "customer_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d80b"
                      },
                      "supplier_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d80c"
                      },
                      "employee_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d80d"
                      },
                      "person_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d80e"
                      },
                      "date_from": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2024-07-20T10:30:00Z"
                      },
                      "date_to": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2024-07-21T10:30:00Z"
                      },
                      "search": {
                        "type": "string",
                        "example": "search"
                      },
                      "organization_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d80f"
                      },
                      "payment_type_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d810"
                      },
                      "payment_type_ids": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "example": [
                          "64b7f4d9e2b3b6a0b7c5d811",
                          "64b7f4d9e2b3b6a0b7c5d812"
                        ]
                      },
                      "is_main": {
                        "type": "boolean",
                        "example": true
                      },
                      "is_installment_plan": {
                        "type": "boolean",
                        "example": false
                      },
                      "states": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "canceled",
                            "pending",
                            "done",
                            "rejected"
                          ]
                        },
                        "example": [
                          "canceled",
                          "pending"
                        ]
                      },
                      "paid_states": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string"
                                  },
                                  "state": {
                                    "type": "string"
                                  },
                                  "can_be_canceled": {
                                    "type": "boolean"
                                  },
                                  "balance_changes": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "_id": {
                                          "type": "string"
                                        },
                                        "currency_id": {
                                          "type": "string"
                                        },
                                        "amount": {
                                          "type": "number"
                                        },
                                        "value": {
                                          "type": "number"
                                        },
                                        "user_type": {
                                          "type": "string"
                                        }
                                      }
                                    }
                                  },
                                  "organization": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "payment_type": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "payment_type_id": {
                                    "type": "string"
                                  },
                                  "user_type": {
                                    "type": "string"
                                  },
                                  "is_refund": {
                                    "type": "boolean"
                                  },
                                  "date": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "parent_id": {
                                    "type": "string"
                                  },
                                  "customer_id": {
                                    "type": "string"
                                  },
                                  "customer": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "supplier_id": {
                                    "type": "string"
                                  },
                                  "supplier": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "employee_id": {
                                    "type": "string"
                                  },
                                  "employee": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "person_id": {
                                    "type": "string"
                                  },
                                  "person": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "write_off_id": {
                                    "type": "string"
                                  },
                                  "write_off": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "number": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "income_id": {
                                    "type": "string"
                                  },
                                  "income": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "number": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "revision_id": {
                                    "type": "string"
                                  },
                                  "revision": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "type": {
                                        "type": "string"
                                      },
                                      "balance_type": {
                                        "type": "string"
                                      },
                                      "number": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "to_be_paid": {
                                    "type": "number"
                                  },
                                  "paid": {
                                    "type": "number"
                                  },
                                  "paid_by_balance": {
                                    "type": "number"
                                  },
                                  "paid_by_cashback": {
                                    "type": "number"
                                  },
                                  "to_be_refunded": {
                                    "type": "number"
                                  },
                                  "refunded": {
                                    "type": "number"
                                  },
                                  "currency_id": {
                                    "type": "string"
                                  },
                                  "currency": {
                                    "type": "object",
                                    "properties": {
                                      "uuid": {
                                        "type": "number"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "code": {
                                        "type": "string"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "round_type": {
                                        "type": "string",
                                        "enum": [
                                          "floor",
                                          "ceil",
                                          "round"
                                        ]
                                      },
                                      "precision": {
                                        "type": "number"
                                      },
                                      "is_main": {
                                        "type": "boolean"
                                      },
                                      "country_id": {
                                        "type": "string"
                                      },
                                      "symbol": {
                                        "type": "string"
                                      },
                                      "side": {
                                        "type": "string",
                                        "enum": [
                                          "start",
                                          "end"
                                        ]
                                      }
                                    }
                                  },
                                  "purchase_id": {
                                    "type": "string"
                                  },
                                  "purchase_return_id": {
                                    "type": "string"
                                  },
                                  "trade_id": {
                                    "type": "string"
                                  },
                                  "payment_date": {
                                    "type": "integer"
                                  },
                                  "created_by": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "created_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "extra_cost": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "amount": {
                                        "type": "number"
                                      }
                                    }
                                  },
                                  "attachments": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "description": {
                                    "type": "string"
                                  },
                                  "plan_items": {
                                    "type": "array",
                                    "items": {
                                      "type": "object"
                                    }
                                  },
                                  "customer_assistant": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "type": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "supplier_assistant": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "type": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "employee_assistant": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "type": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "person_assistant": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "type": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "supplier_assistant_hierarchy": {
                                    "type": "string"
                                  },
                                  "customer_assistant_hierarchy": {
                                    "type": "string"
                                  },
                                  "employee_assistant_hierarchy": {
                                    "type": "string"
                                  },
                                  "person_assistant_hierarchy": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/production-operation/create": {
      "post": {
        "tags": [
          "Production-operation"
        ],
        "description": "This method allows adding production-operation into the account.",
        "operationId": "production-operation-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-operation~1set-state/put/responses/200/content/application~1json/schema"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "product_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d80a"
                        },
                        "amount": {
                          "type": "number",
                          "example": 10,
                          "minimum": 0,
                          "maximum": 1000000000
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "used",
                            "produced"
                          ],
                          "example": "produced"
                        },
                        "cost_percentage": {
                          "type": "number",
                          "example": 10,
                          "minimum": 0,
                          "maximum": 100
                        },
                        "extra_costs": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "cost_id": {
                                "type": "string",
                                "example": "64b7f4d9e2b3b6a0b7c5d80a"
                              },
                              "amount": {
                                "type": "number",
                                "example": 10,
                                "minimum": 0,
                                "maximum": 1000000000
                              }
                            },
                            "required": [
                              "cost_id",
                              "amount"
                            ]
                          }
                        }
                      },
                      "required": [
                        "cost_percentage",
                        "extra_costs",
                        "product_id",
                        "type"
                      ]
                    },
                    "minItems": 1,
                    "description": "list of materials of product. required if is_compound is true"
                  },
                  "code": {
                    "type": "string",
                    "default": ""
                  },
                  "note": {
                    "type": "string",
                    "default": ""
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "canceled",
                      "new",
                      "done",
                      "in_progress"
                    ],
                    "example": "canceled"
                  },
                  "organization_id": {
                    "type": "string",
                    "default": ""
                  },
                  "responsible_id": {
                    "type": "string",
                    "default": ""
                  },
                  "used_warehouse_id": {
                    "type": "string",
                    "default": ""
                  },
                  "used_date": {
                    "type": "string",
                    "format": "date-time",
                    "example": "2024-07-20T10:30:00Z"
                  },
                  "produced_warehouse_id": {
                    "type": "string",
                    "default": ""
                  },
                  "produced_date": {
                    "type": "string",
                    "format": "date-time",
                    "example": "2024-07-20T10:30:00Z"
                  },
                  "currency_id": {
                    "type": "string",
                    "default": ""
                  },
                  "route_sheet_id": {
                    "type": "string",
                    "default": ""
                  },
                  "amount": {
                    "type": "number",
                    "default": 0,
                    "minimum": 0,
                    "maximum": 1000000000
                  },
                  "create_reminder": {
                    "type": "boolean",
                    "default": false
                  },
                  "additional_costs": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "cost_id": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "number"
                        },
                        "customer_id": {
                          "type": "string"
                        },
                        "supplier_id": {
                          "type": "string"
                        },
                        "employee_id": {
                          "type": "string"
                        },
                        "person_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "cost_id",
                        "amount"
                      ]
                    }
                  }
                },
                "type": "object",
                "required": [
                  "items",
                  "organization_id",
                  "used_warehouse_id",
                  "produced_warehouse_id",
                  "used_date",
                  "produced_date",
                  "currency_id"
                ]
              }
            }
          }
        }
      }
    },
    "/production-operation/update": {
      "put": {
        "tags": [
          "Production-operation"
        ],
        "description": "This method allows updating production-operation in the account.",
        "operationId": "production-operation-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-operation~1set-state/put/responses/200/content/application~1json/schema"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "product_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d80a"
                        },
                        "amount": {
                          "type": "number",
                          "example": 10,
                          "minimum": 0,
                          "maximum": 1000000000
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "used",
                            "produced"
                          ],
                          "example": "produced"
                        },
                        "cost_percentage": {
                          "type": "number",
                          "example": 10,
                          "minimum": 0,
                          "maximum": 100
                        },
                        "extra_costs": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "cost_id": {
                                "type": "string",
                                "example": "64b7f4d9e2b3b6a0b7c5d80a"
                              },
                              "amount": {
                                "type": "number",
                                "example": 10,
                                "minimum": 0,
                                "maximum": 1000000000
                              }
                            },
                            "required": [
                              "cost_id",
                              "amount"
                            ]
                          }
                        }
                      },
                      "required": [
                        "cost_percentage",
                        "extra_costs",
                        "product_id",
                        "type"
                      ]
                    },
                    "minItems": 1,
                    "description": "list of materials of product. required if is_compound is true"
                  },
                  "code": {
                    "type": "string",
                    "default": ""
                  },
                  "note": {
                    "type": "string",
                    "default": ""
                  },
                  "organization_id": {
                    "type": "string",
                    "default": ""
                  },
                  "responsible_id": {
                    "type": "string",
                    "default": ""
                  },
                  "used_warehouse_id": {
                    "type": "string",
                    "default": ""
                  },
                  "used_date": {
                    "type": "string",
                    "format": "date-time",
                    "example": "2024-07-20T10:30:00Z"
                  },
                  "produced_warehouse_id": {
                    "type": "string",
                    "default": ""
                  },
                  "produced_date": {
                    "type": "string",
                    "format": "date-time",
                    "example": "2024-07-20T10:30:00Z"
                  },
                  "currency_id": {
                    "type": "string",
                    "default": ""
                  },
                  "route_sheet_id": {
                    "type": "string",
                    "default": ""
                  },
                  "amount": {
                    "type": "number",
                    "default": 0,
                    "minimum": 0,
                    "maximum": 1000000000
                  },
                  "create_reminder": {
                    "type": "boolean",
                    "default": false
                  },
                  "additional_costs": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "cost_id": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "number"
                        },
                        "customer_id": {
                          "type": "string"
                        },
                        "supplier_id": {
                          "type": "string"
                        },
                        "employee_id": {
                          "type": "string"
                        },
                        "person_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "cost_id",
                        "amount"
                      ]
                    }
                  }
                },
                "type": "object",
                "required": [
                  "items",
                  "_id"
                ]
              }
            }
          }
        }
      }
    },
    "/production-operation/get-paging": {
      "post": {
        "tags": [
          "Production-operation"
        ],
        "description": "Get production-operation by paging",
        "operationId": "production-operation-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string",
                        "description": "search string to filter by code or name"
                      },
                      "state": {
                        "type": "string",
                        "enum": [
                          "canceled",
                          "new",
                          "done",
                          "in_progress"
                        ],
                        "description": "state of the production operation"
                      },
                      "organization_id": {
                        "type": "string",
                        "description": "organization id to filter by organization"
                      },
                      "responsible_id": {
                        "type": "string",
                        "description": "responsible id to filter by responsible"
                      },
                      "route_sheet_id": {
                        "type": "string",
                        "description": "route sheet id to filter by route sheet"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "used_warehouse": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "produced_warehouse": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "organization": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "currency": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "currency_id": {
                                    "type": "string"
                                  },
                                  "items": {
                                    "type": "array",
                                    "items": {
                                      "type": "object"
                                    }
                                  },
                                  "state": {
                                    "type": "string"
                                  },
                                  "is_overused": {
                                    "type": "boolean"
                                  },
                                  "code": {
                                    "type": "string"
                                  },
                                  "total_produced": {
                                    "type": "number"
                                  },
                                  "total_used": {
                                    "type": "number"
                                  },
                                  "total_cost": {
                                    "type": "number"
                                  },
                                  "number": {
                                    "type": "string"
                                  },
                                  "produced_date": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "amount": {
                                    "type": "number"
                                  },
                                  "total_used:": {
                                    "type": "number"
                                  },
                                  "used_date": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "additional_costs": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "_id": {
                                          "type": "string"
                                        },
                                        "cost_id": {
                                          "type": "string"
                                        },
                                        "amount": {
                                          "type": "number"
                                        },
                                        "customer_id": {
                                          "type": "string"
                                        },
                                        "employee_id": {
                                          "type": "string"
                                        },
                                        "supplier_id": {
                                          "type": "string"
                                        },
                                        "person_id": {
                                          "type": "string"
                                        }
                                      }
                                    }
                                  },
                                  "total_expense": {
                                    "type": "number"
                                  },
                                  "created_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "created_by": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "route_sheet": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "code": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "responsible": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      },
                                      "phone_number": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "note": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/production-operation/get-by-id/{id}": {
      "get": {
        "tags": [
          "Production-operation"
        ],
        "description": "Get production-operation using its _id",
        "operationId": "production-operation-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-operation~1set-state/put/responses/200/content/application~1json/schema"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-operation/set-state": {
      "put": {
        "tags": [
          "Production-operation"
        ],
        "description": "setState production-operation",
        "operationId": "production-operation-cancel",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "canceled",
                      "new",
                      "done",
                      "in_progress"
                    ],
                    "example": "new"
                  }
                },
                "type": "object",
                "required": [
                  "state",
                  "_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "product": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "box_item": {
                          "type": "number"
                        },
                        "barcode": {
                          "type": "string"
                        },
                        "barcodes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "is_active": {
                                "type": "boolean"
                              },
                              "barcode": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "_id",
                              "barcode"
                            ]
                          }
                        },
                        "measure": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "short_name": {
                              "type": "string"
                            },
                            "decimal_count": {
                              "type": "integer"
                            },
                            "system_code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "_id",
                            "name",
                            "decimal_count"
                          ]
                        },
                        "dimension": {
                          "type": "object",
                          "properties": {
                            "shape": {
                              "type": "string",
                              "enum": [
                                "circular",
                                "rectangular",
                                "other"
                              ]
                            },
                            "netto_weight": {
                              "type": "number"
                            },
                            "gross_weight": {
                              "type": "number"
                            },
                            "height": {
                              "type": "number"
                            },
                            "volume": {
                              "type": "number"
                            },
                            "diameter": {
                              "type": "number"
                            },
                            "width": {
                              "type": "number"
                            },
                            "length": {
                              "type": "number"
                            }
                          }
                        },
                        "is_material": {
                          "type": "boolean"
                        },
                        "is_product": {
                          "type": "boolean"
                        },
                        "is_semi_product": {
                          "type": "boolean"
                        },
                        "is_variant": {
                          "type": "boolean"
                        },
                        "sku": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "_id",
                        "name",
                        "measure",
                        "sku"
                      ]
                    },
                    "type": {
                      "type": "string"
                    },
                    "amount": {
                      "type": "number"
                    },
                    "marks": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "warehouse_amount": {
                      "type": "number"
                    },
                    "total_cost": {
                      "type": "number"
                    },
                    "total_expense": {
                      "type": "number"
                    },
                    "extra_costs": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "cost_percentage": {
                      "type": "number"
                    },
                    "used_warehouse": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "produced_warehouse": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "organization": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "currency": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "currency_id": {
                      "type": "string"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "state": {
                      "type": "string"
                    },
                    "is_overused": {
                      "type": "boolean"
                    },
                    "code": {
                      "type": "string"
                    },
                    "total_produced": {
                      "type": "number"
                    },
                    "total_used": {
                      "type": "number"
                    },
                    "number": {
                      "type": "string"
                    },
                    "produced_date": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "total_used:": {
                      "type": "number"
                    },
                    "used_date": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "additional_costs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "cost_id": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "number"
                          },
                          "customer_id": {
                            "type": "string"
                          },
                          "employee_id": {
                            "type": "string"
                          },
                          "supplier_id": {
                            "type": "string"
                          },
                          "person_id": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "created_by": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "full_name": {
                          "type": "string"
                        }
                      }
                    },
                    "route_sheet": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        }
                      }
                    },
                    "responsible": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "full_name": {
                          "type": "string"
                        },
                        "phone_number": {
                          "type": "string"
                        }
                      }
                    },
                    "note": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/production/route-sheet/create": {
      "post": {
        "tags": [
          "Production-route-sheet"
        ],
        "description": "This method allows adding production-route-sheet into the account.",
        "operationId": "production-route-sheet-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production~1route-sheet~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "items": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "properties": {
                        "product_id": {
                          "type": "string",
                          "example": "646b0c2f3d4e1a001f8b4567"
                        },
                        "amount": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000,
                          "example": 100
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "used",
                            "produced"
                          ],
                          "example": "used"
                        },
                        "cost_percentage": {
                          "type": "number",
                          "example": 10
                        },
                        "extra_costs": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "cost_id": {
                                "type": "string",
                                "example": "646b0c2f3d4e1a001f8b4567"
                              },
                              "amount": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000,
                                "example": 100
                              }
                            },
                            "required": [
                              "cost_id",
                              "amount"
                            ]
                          }
                        }
                      },
                      "required": [
                        "product_id",
                        "amount",
                        "type",
                        "cost_percentage",
                        "extra_costs"
                      ]
                    }
                  },
                  "code": {
                    "type": "string",
                    "default": "",
                    "example": "code"
                  },
                  "name": {
                    "type": "string",
                    "default": "",
                    "example": "name"
                  },
                  "note": {
                    "type": "string",
                    "default": "",
                    "example": "note"
                  },
                  "is_active": {
                    "type": "boolean",
                    "default": false,
                    "example": false
                  },
                  "organization_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "example": "646b0c2f3d4e1a001f8b4567"
                    }
                  },
                  "additional_costs": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "cost_id": {
                          "type": "string",
                          "example": "646b0c2f3d4e1a001f8b4567"
                        },
                        "amount": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000,
                          "example": 100
                        },
                        "customer_id": {
                          "type": "string",
                          "example": "646b0c2f3d4e1a001f8b4567"
                        },
                        "supplier_id": {
                          "type": "string",
                          "example": "646b0c2f3d4e1a001f8b4567"
                        },
                        "employee_id": {
                          "type": "string",
                          "example": "646b0c2f3d4e1a001f8b4567"
                        },
                        "person_id": {
                          "type": "string",
                          "example": "646b0c2f3d4e1a001f8b4567"
                        }
                      },
                      "required": [
                        "cost_id",
                        "amount"
                      ]
                    }
                  }
                },
                "type": "object",
                "required": [
                  "items",
                  "name",
                  "organization_ids"
                ]
              }
            }
          }
        }
      }
    },
    "/production/route-sheet/update": {
      "put": {
        "tags": [
          "Production-route-sheet"
        ],
        "description": "This method allows updating production-route-sheet in the account.",
        "operationId": "production-route-sheet-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "_id": {
                              "type": "string",
                              "default": "",
                              "example": "646b0c2f3d4e1a001f8b4567"
                            },
                            "product": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "default": "",
                                  "example": "646b0c2f3d4e1a001f8b4567"
                                },
                                "name": {
                                  "type": "string",
                                  "default": "",
                                  "example": "name"
                                },
                                "box_item": {
                                  "type": "number",
                                  "default": 0
                                },
                                "barcodes": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string",
                                        "default": "",
                                        "example": "646b0c2f3d4e1a001f8b4567"
                                      },
                                      "barcode": {
                                        "type": "string",
                                        "default": "",
                                        "example": "barcode"
                                      },
                                      "is_active": {
                                        "type": "boolean",
                                        "default": false
                                      }
                                    }
                                  }
                                },
                                "barcode": {
                                  "type": "string",
                                  "default": "",
                                  "example": "barcode"
                                },
                                "measure": {
                                  "type": "object",
                                  "properties": {
                                    "name": {
                                      "type": "string",
                                      "default": "",
                                      "example": "name"
                                    },
                                    "system_code": {
                                      "type": "string",
                                      "default": "",
                                      "example": "system_code"
                                    },
                                    "code": {
                                      "type": "string",
                                      "default": "",
                                      "example": "code"
                                    },
                                    "short_name": {
                                      "type": "string",
                                      "default": "",
                                      "example": "short_name"
                                    },
                                    "decimal_count": {
                                      "type": "number",
                                      "default": 0
                                    }
                                  }
                                },
                                "measure_id": {
                                  "type": "string",
                                  "default": "",
                                  "example": "646b0c2f3d4e1a001f8b4567"
                                },
                                "dimension": {
                                  "type": "object",
                                  "properties": {
                                    "shape": {
                                      "type": "string",
                                      "default": "other",
                                      "enum": [
                                        "circular",
                                        "rectangular",
                                        "other"
                                      ]
                                    },
                                    "netto_weight": {
                                      "type": "number",
                                      "default": 0
                                    },
                                    "gross_weight": {
                                      "type": "number",
                                      "default": 0
                                    },
                                    "height": {
                                      "type": "number",
                                      "default": 0
                                    },
                                    "volume": {
                                      "type": "number",
                                      "default": 0
                                    },
                                    "diameter": {
                                      "type": "number",
                                      "default": 0
                                    },
                                    "width": {
                                      "type": "number",
                                      "default": 0
                                    },
                                    "length": {
                                      "type": "number",
                                      "default": 0
                                    }
                                  }
                                },
                                "is_material": {
                                  "type": "boolean",
                                  "default": false
                                },
                                "is_product": {
                                  "type": "boolean",
                                  "default": false
                                },
                                "is_semi_product": {
                                  "type": "boolean",
                                  "default": false
                                },
                                "is_variant": {
                                  "type": "boolean",
                                  "default": false
                                },
                                "sku": {
                                  "type": "string",
                                  "default": "",
                                  "example": "sku"
                                }
                              }
                            },
                            "warehouse_amount": {
                              "type": "number"
                            },
                            "type": {
                              "type": "string"
                            },
                            "measure_id": {
                              "type": "string",
                              "default": "",
                              "example": "646b0c2f3d4e1a001f8b4567"
                            },
                            "measure": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "default": "",
                                  "example": "name"
                                },
                                "system_code": {
                                  "type": "string",
                                  "default": "",
                                  "example": "system_code"
                                },
                                "code": {
                                  "type": "string",
                                  "default": "",
                                  "example": "code"
                                },
                                "short_name": {
                                  "type": "string",
                                  "default": "",
                                  "example": "short_name"
                                },
                                "decimal_count": {
                                  "type": "number",
                                  "default": 0
                                }
                              }
                            },
                            "amount": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1000000000,
                              "example": 100
                            },
                            "marks": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "route_sheet_id": {
                              "type": "string",
                              "default": "",
                              "example": "646b0c2f3d4e1a001f8b4567"
                            },
                            "cost_percentage": {
                              "type": "number",
                              "example": 10
                            },
                            "extra_costs": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string",
                                    "default": "",
                                    "example": "646b0c2f3d4e1a001f8b4567"
                                  },
                                  "cost_id": {
                                    "type": "string",
                                    "default": "",
                                    "example": "646b0c2f3d4e1a001f8b4567"
                                  },
                                  "amount": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1000000000,
                                    "example": 100
                                  },
                                  "employee_id": {
                                    "type": "string",
                                    "default": "",
                                    "example": "646b0c2f3d4e1a001f8b4567"
                                  },
                                  "customer_id": {
                                    "type": "string",
                                    "default": "",
                                    "example": "646b0c2f3d4e1a001f8b4567"
                                  },
                                  "supplier_id": {
                                    "type": "string",
                                    "default": "",
                                    "example": "646b0c2f3d4e1a001f8b4567"
                                  },
                                  "person_id": {
                                    "type": "string",
                                    "default": "",
                                    "example": "646b0c2f3d4e1a001f8b4567"
                                  }
                                },
                                "required": [
                                  "cost_id",
                                  "amount"
                                ]
                              }
                            }
                          },
                          "required": [
                            "_id"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "default": "",
                    "example": "646b0c2f3d4e1a001f8b4567"
                  },
                  "items": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string",
                          "example": "646b0c2f3d4e1a001f8b4567"
                        },
                        "product_id": {
                          "type": "string",
                          "example": "646b0c2f3d4e1a001f8b4567"
                        },
                        "amount": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000,
                          "example": 100
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "used",
                            "produced"
                          ],
                          "example": "used"
                        },
                        "cost_percentage": {
                          "type": "number",
                          "example": 10
                        },
                        "extra_costs": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "cost_id": {
                                "type": "string",
                                "example": "646b0c2f3d4e1a001f8b4567"
                              },
                              "amount": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1000000000,
                                "example": 100
                              }
                            },
                            "required": [
                              "cost_id",
                              "amount"
                            ]
                          }
                        }
                      },
                      "required": [
                        "cost_percentage",
                        "extra_costs"
                      ]
                    }
                  },
                  "code": {
                    "type": "string",
                    "default": "",
                    "example": "code"
                  },
                  "name": {
                    "type": "string",
                    "default": "",
                    "example": "name"
                  },
                  "note": {
                    "type": "string",
                    "default": "",
                    "example": "note"
                  },
                  "is_active": {
                    "type": "boolean",
                    "default": false,
                    "example": false
                  },
                  "organization_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "example": "646b0c2f3d4e1a001f8b4567"
                    }
                  },
                  "additional_costs": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "cost_id": {
                          "type": "string",
                          "example": "646b0c2f3d4e1a001f8b4567"
                        },
                        "amount": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000,
                          "example": 100
                        },
                        "customer_id": {
                          "type": "string",
                          "example": "646b0c2f3d4e1a001f8b4567"
                        },
                        "supplier_id": {
                          "type": "string",
                          "example": "646b0c2f3d4e1a001f8b4567"
                        },
                        "employee_id": {
                          "type": "string",
                          "example": "646b0c2f3d4e1a001f8b4567"
                        },
                        "person_id": {
                          "type": "string",
                          "example": "646b0c2f3d4e1a001f8b4567"
                        }
                      },
                      "required": [
                        "cost_id",
                        "amount"
                      ]
                    }
                  }
                },
                "type": "object",
                "required": [
                  "items",
                  "_id"
                ]
              }
            }
          }
        }
      }
    },
    "/production/route-sheet/get-paging": {
      "post": {
        "tags": [
          "Production-route-sheet"
        ],
        "description": "Get production-route-sheet by paging",
        "operationId": "production-route-sheet-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string"
                      },
                      "organization_id": {
                        "type": "string",
                        "default": "",
                        "example": "646b0c2f3d4e1a001f8b4567"
                      },
                      "is_active": {
                        "type": "boolean",
                        "default": false,
                        "example": false
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "$ref": "#GetById"
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/production/route-sheet/get-by-id/{id}": {
      "get": {
        "tags": [
          "Production-route-sheet"
        ],
        "description": "Get production-route-sheet using its _id",
        "operationId": "production-route-sheet-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production~1route-sheet~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production/route-sheet/delete/{id}": {
      "delete": {
        "tags": [
          "Production-route-sheet"
        ],
        "description": "Delete a production-route-sheet",
        "operationId": "production-route-sheet-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production/route-sheet/get-deleted": {
      "get": {
        "tags": [
          "Production-route-sheet"
        ],
        "description": "Get deleted production-route-sheet ids",
        "operationId": "production-route-sheet-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/profile/getMe": {
      "get": {
        "tags": [
          "Profile"
        ],
        "description": "Get profile",
        "operationId": "profile-get-me",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "User ID"
                    },
                    "user_name": {
                      "type": "string",
                      "description": "User name"
                    },
                    "is_demo": {
                      "type": "boolean",
                      "description": "User demo status"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "blocked",
                        "warning"
                      ],
                      "default": "active",
                      "description": "User status"
                    },
                    "expiration_date": {
                      "type": "string",
                      "format": "date-time",
                      "description": "User expiration date"
                    },
                    "license_count": {
                      "type": "number",
                      "description": "Number of licenses"
                    }
                  },
                  "required": [
                    "id",
                    "user_name",
                    "is_demo",
                    "status",
                    "expiration_date",
                    "license_count"
                  ],
                  "description": "User profile information"
                }
              }
            }
          }
        }
      }
    },
    "/tax/create": {
      "post": {
        "tags": [
          "Tax"
        ],
        "description": "This method allows adding tax into the account.",
        "operationId": "tax-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1tax~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "type": "string",
                    "example": "VAT"
                  },
                  "rate": {
                    "type": "number",
                    "example": 7.25,
                    "minimum": 0,
                    "maximum": 100
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "included",
                      "added"
                    ],
                    "example": "included"
                  },
                  "to_price": {
                    "type": "boolean",
                    "example": true
                  },
                  "is_manual": {
                    "type": "boolean",
                    "example": false
                  },
                  "organization_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "example": "64e944999f719902a7ff641b"
                    }
                  },
                  "is_all": {
                    "type": "boolean",
                    "example": true
                  },
                  "is_all_categories": {
                    "type": "boolean",
                    "example": false
                  },
                  "is_all_suppliers": {
                    "type": "boolean",
                    "example": true
                  },
                  "supplier_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "example": "64e944999f719902a7ff641c"
                    }
                  },
                  "category_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "example": "64e944999f719902a7ff641d"
                    }
                  },
                  "item_added_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "example": "64e944999f719902a7ff641e"
                    }
                  },
                  "item_removed_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "example": "64e944999f719902a7ff641f"
                    }
                  }
                },
                "type": "object",
                "required": [
                  "name",
                  "rate",
                  "type",
                  "to_price",
                  "is_manual",
                  "organization_ids",
                  "is_all",
                  "is_all_categories",
                  "is_all_suppliers"
                ]
              }
            }
          }
        }
      }
    },
    "/tax/update": {
      "put": {
        "tags": [
          "Tax"
        ],
        "description": "This method allows updating saler-order in the account.",
        "operationId": "tax-update",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "_id": {
                              "type": "string",
                              "example": "64e944999f719902a7ff641b"
                            },
                            "name": {
                              "type": "string"
                            },
                            "rate": {
                              "type": "number"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "included",
                                "added"
                              ]
                            },
                            "is_all": {
                              "type": "boolean"
                            },
                            "is_all_categories": {
                              "type": "boolean"
                            },
                            "is_all_suppliers": {
                              "type": "boolean"
                            },
                            "supplier_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "category_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "item_added_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "item_removed_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "item_count": {
                              "type": "number"
                            },
                            "to_price": {
                              "type": "boolean"
                            },
                            "is_manual": {
                              "type": "boolean"
                            },
                            "organization_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "last_payment_date": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "last_payment_amount": {
                              "type": "number"
                            },
                            "calculated_amount": {
                              "type": "number"
                            },
                            "is_enabled": {
                              "type": "boolean"
                            }
                          },
                          "type": "object",
                          "required": [
                            "name",
                            "rate",
                            "to_price",
                            "is_manual",
                            "is_all",
                            "is_all_categories",
                            "is_all_suppliers"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "64e944999f719902a7ff641b"
                  },
                  "name": {
                    "type": "string",
                    "example": "VAT"
                  },
                  "rate": {
                    "type": "number",
                    "example": 7.25,
                    "minimum": 0,
                    "maximum": 100
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "included",
                      "added"
                    ],
                    "example": "included"
                  },
                  "to_price": {
                    "type": "boolean",
                    "example": true
                  },
                  "is_manual": {
                    "type": "boolean",
                    "example": false
                  },
                  "organization_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "example": "64e944999f719902a7ff641b"
                    }
                  }
                },
                "type": "object",
                "required": [
                  "name",
                  "rate",
                  "type",
                  "to_price",
                  "is_manual"
                ]
              }
            }
          }
        }
      }
    },
    "/tax/delete/{id}": {
      "delete": {
        "tags": [
          "Tax"
        ],
        "description": "Delete a tax",
        "operationId": "tax-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/tax/get-by-id/{id}": {
      "get": {
        "tags": [
          "Tax"
        ],
        "description": "Get tax using its _id",
        "operationId": "tax-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1tax~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/tax/get-all": {
      "post": {
        "tags": [
          "Tax"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "organization_id": {
                    "type": "string",
                    "example": "64e944999f719902a7ff641b"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "included",
                      "added"
                    ],
                    "default": "included"
                  },
                  "is_manual": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "description": "Get all taxs",
        "operationId": "tax-get-all",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1tax~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/tax/get-paging": {
      "post": {
        "tags": [
          "Tax"
        ],
        "description": "Get taxs by paging",
        "operationId": "tax-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string",
                        "example": "64e944999f719902a7ff641b"
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "included",
                          "added"
                        ],
                        "default": "included"
                      },
                      "is_manual": {
                        "type": "boolean",
                        "default": false
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "$ref": "#GetById"
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/tax/get-items": {
      "post": {
        "tags": [
          "Tax"
        ],
        "description": "Get tax-items",
        "operationId": "tax-get-items",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tax_id": {
                    "type": "string",
                    "example": "64e944999f719902a7ff641b"
                  },
                  "page": {
                    "type": "number",
                    "default": 1,
                    "minimum": 1
                  },
                  "limit": {
                    "type": "number",
                    "default": 20,
                    "minimum": 1,
                    "maximum": 200
                  }
                },
                "required": [
                  "tax_id",
                  "page",
                  "limit"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "_id": {
                                "type": "string",
                                "example": "64e944999f719902a7ff641b"
                              },
                              "created_at": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "is_material": {
                                "type": "boolean",
                                "example": true
                              },
                              "is_product": {
                                "type": "boolean",
                                "example": true
                              },
                              "item_id": {
                                "type": "string",
                                "example": "64e944999f719902a7ff641b"
                              },
                              "tax_id": {
                                "type": "string",
                                "example": "64e944999f719902a7ff641b"
                              },
                              "updated_at": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "item": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string",
                                    "example": "64e944999f719902a7ff641b"
                                  },
                                  "name": {
                                    "type": "string",
                                    "example": "Item Name"
                                  },
                                  "measure_id": {
                                    "type": "string",
                                    "example": "64e944999f719902a7ff641b"
                                  },
                                  "barcode": {
                                    "type": "string",
                                    "example": "1234567890123"
                                  }
                                },
                                "required": [
                                  "_id",
                                  "name",
                                  "measure_id"
                                ]
                              }
                            },
                            "required": [
                              "_id",
                              "created_at",
                              "updated_at"
                            ]
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/tax/get-deleted": {
      "get": {
        "tags": [
          "Tax"
        ],
        "description": "Get deleted tax ids",
        "operationId": "tax-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/states/get-all": {
      "post": {
        "tags": [
          "States"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "organization_id": {
                    "type": "string",
                    "example": "64e944999f719902a7ff641b"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "trades",
                      "saleOrders",
                      "deliveryOrders"
                    ],
                    "default": "trades"
                  },
                  "is_default": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "description": "Get all states",
        "operationId": "state-get-all",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1states-settings~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/trade/create": {
      "post": {
        "tags": [
          "Trade"
        ],
        "description": "This method allows adding trade into the account.",
        "operationId": "trade-create",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "allOf": [
                            {
                              "properties": {
                                "created_at": {
                                  "type": "string"
                                },
                                "updated_at": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "uuid": {
                                  "type": "string"
                                },
                                "open_ticket_uuid": {
                                  "type": "string"
                                },
                                "organization_id": {
                                  "type": "string"
                                },
                                "organization": {
                                  "type": "object",
                                  "properties": {
                                    "_id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "warehouse_id": {
                                  "type": "string"
                                },
                                "warehouse": {
                                  "type": "object",
                                  "properties": {
                                    "_id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "customer_id": {
                                  "type": "string"
                                },
                                "customer": {
                                  "type": "object",
                                  "properties": {
                                    "_id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    },
                                    "type": {
                                      "type": "string"
                                    },
                                    "phone_number": {
                                      "type": "string"
                                    },
                                    "inn": {
                                      "type": "string"
                                    },
                                    "address": {
                                      "type": "string"
                                    },
                                    "description": {
                                      "type": "string"
                                    },
                                    "delivery_address": {
                                      "type": "object",
                                      "properties": {
                                        "lat": {
                                          "type": "number"
                                        },
                                        "long": {
                                          "type": "number"
                                        },
                                        "human_address": {
                                          "type": "object",
                                          "properties": {
                                            "address": {
                                              "type": "string"
                                            },
                                            "city": {
                                              "type": "string"
                                            },
                                            "state": {
                                              "type": "string"
                                            },
                                            "zip": {
                                              "type": "string"
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                },
                                "customer_assistant": {
                                  "type": "object",
                                  "properties": {
                                    "_id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    },
                                    "type": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "customer_assistant_hierarchy": {
                                  "type": "string"
                                },
                                "responsible_id": {
                                  "type": "string"
                                },
                                "note": {
                                  "type": "string"
                                },
                                "responsible": {
                                  "type": "object",
                                  "properties": {
                                    "_id": {
                                      "type": "string"
                                    },
                                    "full_name": {
                                      "type": "string"
                                    },
                                    "phone_number": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "created_by": {
                                  "type": "object",
                                  "properties": {
                                    "_id": {
                                      "type": "string"
                                    },
                                    "full_name": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "state": {
                                  "type": "string"
                                },
                                "dynamic_state": {
                                  "type": "string"
                                },
                                "is_refund": {
                                  "type": "boolean"
                                },
                                "is_trash": {
                                  "type": "boolean"
                                },
                                "refund_id": {
                                  "type": "string"
                                },
                                "number": {
                                  "type": "string"
                                },
                                "device": {
                                  "type": "object",
                                  "properties": {
                                    "_id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    },
                                    "device_id": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "currency": {
                                  "type": "object"
                                },
                                "currency_id": {
                                  "type": "string"
                                },
                                "additional_costs": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "cost_id": {
                                        "type": "string"
                                      },
                                      "payment_type_id": {
                                        "type": "string"
                                      },
                                      "payment_type": {
                                        "type": "object"
                                      },
                                      "amount": {
                                        "type": "number"
                                      },
                                      "employee": {
                                        "type": "object"
                                      },
                                      "supplier": {
                                        "type": "object"
                                      },
                                      "customer": {
                                        "type": "object"
                                      },
                                      "person": {
                                        "type": "object"
                                      },
                                      "cost": {
                                        "type": "object"
                                      },
                                      "price_id": {
                                        "type": "string"
                                      },
                                      "employee_assistant_id": {
                                        "type": "string"
                                      },
                                      "employee_assistant_hierarchy": {
                                        "type": "array",
                                        "items": {
                                          "type": "object"
                                        }
                                      },
                                      "supplier_assistant_id": {
                                        "type": "string"
                                      },
                                      "supplier_assistant_hierarchy": {
                                        "type": "array",
                                        "items": {
                                          "type": "object"
                                        }
                                      },
                                      "customer_assistant_id": {
                                        "type": "string"
                                      },
                                      "customer_assistant_hierarchy": {
                                        "type": "array",
                                        "items": {
                                          "type": "object"
                                        }
                                      },
                                      "person_assistant_id": {
                                        "type": "string"
                                      },
                                      "person_assistant_hierarchy": {
                                        "type": "array",
                                        "items": {
                                          "type": "object"
                                        }
                                      },
                                      "is_method_summary_zero": {
                                        "type": "boolean"
                                      },
                                      "item_count": {
                                        "type": "number"
                                      }
                                    }
                                  }
                                },
                                "total_extra_cost": {
                                  "type": "number"
                                },
                                "total_effected_extra_cost": {
                                  "type": "number"
                                },
                                "currency_values": {
                                  "type": "object",
                                  "properties": {
                                    "to_currency_id": {
                                      "type": "string"
                                    },
                                    "numerator": {
                                      "type": "number"
                                    },
                                    "denominator": {
                                      "type": "number"
                                    }
                                  }
                                },
                                "price_id": {
                                  "type": "number"
                                },
                                "price": {
                                  "type": "object",
                                  "properties": {
                                    "_id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    },
                                    "short_name": {
                                      "type": "string"
                                    },
                                    "code": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "invoice": {
                                  "type": "object",
                                  "properties": {
                                    "_id": {
                                      "type": "string"
                                    },
                                    "to_be_paid": {
                                      "type": "number"
                                    },
                                    "paid": {
                                      "type": "number"
                                    },
                                    "paid_by_balance": {
                                      "type": "number"
                                    },
                                    "paid_by_cashback": {
                                      "type": "number"
                                    },
                                    "to_be_refunded": {
                                      "type": "number"
                                    },
                                    "refunded": {
                                      "type": "number"
                                    },
                                    "number": {
                                      "type": "string"
                                    },
                                    "paid_state": {
                                      "type": "string"
                                    },
                                    "installment_plan_interval": {
                                      "type": "string"
                                    },
                                    "period": {
                                      "type": "number"
                                    },
                                    "trade_id": {
                                      "type": "string"
                                    },
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "_id": {
                                          "type": "string"
                                        },
                                        "to_be_paid": {
                                          "type": "number"
                                        },
                                        "paid": {
                                          "type": "number"
                                        },
                                        "paid_by_balance": {
                                          "type": "number"
                                        },
                                        "paid_by_cashback": {
                                          "type": "number"
                                        },
                                        "to_be_refunded": {
                                          "type": "number"
                                        },
                                        "refunded": {
                                          "type": "number"
                                        },
                                        "is_initial_payment": {
                                          "type": "boolean"
                                        },
                                        "number": {
                                          "type": "string"
                                        },
                                        "paid_state": {
                                          "type": "string"
                                        },
                                        "date": {
                                          "type": "string"
                                        }
                                      }
                                    },
                                    "currency_id": {
                                      "type": "string"
                                    },
                                    "payment_type_id": {
                                      "type": "string"
                                    },
                                    "is_refund": {
                                      "type": "boolean"
                                    },
                                    "type": {
                                      "type": "string"
                                    },
                                    "payment_type": {
                                      "type": "object",
                                      "properties": {
                                        "_id": {
                                          "type": "string"
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      }
                                    }
                                  }
                                },
                                "payments": {
                                  "type": "object",
                                  "properties": {
                                    "payment_method": {
                                      "type": "object",
                                      "properties": {
                                        "_id": {
                                          "type": "string"
                                        },
                                        "type": {
                                          "type": "string"
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      }
                                    },
                                    "amount": {
                                      "type": "number"
                                    },
                                    "paid": {
                                      "type": "number"
                                    },
                                    "currency": {
                                      "type": "object",
                                      "properties": {
                                        "_id": {
                                          "type": "string"
                                        },
                                        "uuid": {
                                          "type": "number"
                                        },
                                        "name": {
                                          "type": "string"
                                        },
                                        "value": {
                                          "type": "number"
                                        },
                                        "symbol": {
                                          "type": "string"
                                        },
                                        "side": {
                                          "type": "string"
                                        }
                                      }
                                    },
                                    "base_currency": {
                                      "type": "object",
                                      "properties": {
                                        "numerator": {
                                          "type": "number"
                                        },
                                        "denominator": {
                                          "type": "number"
                                        }
                                      }
                                    },
                                    "base_currency_value": {
                                      "type": "number"
                                    }
                                  }
                                },
                                "applied_cashbacks": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "amount": {
                                        "type": "number"
                                      },
                                      "currency": {
                                        "type": "object",
                                        "properties": {
                                          "_id": {
                                            "type": "string"
                                          },
                                          "to_currency_id": {
                                            "type": "string"
                                          },
                                          "uuid": {
                                            "type": "number"
                                          },
                                          "name": {
                                            "type": "string"
                                          },
                                          "value": {
                                            "type": "number"
                                          },
                                          "symbol": {
                                            "type": "string"
                                          },
                                          "side": {
                                            "type": "string"
                                          },
                                          "numerator": {
                                            "type": "number"
                                          },
                                          "denominator": {
                                            "type": "number"
                                          },
                                          "round_type": {
                                            "type": "string"
                                          },
                                          "precision": {
                                            "type": "number"
                                          }
                                        }
                                      },
                                      "paid": {
                                        "type": "number"
                                      },
                                      "base_currency": {
                                        "type": "object",
                                        "properties": {
                                          "numerator": {
                                            "type": "number"
                                          },
                                          "denominator": {
                                            "type": "number"
                                          }
                                        }
                                      },
                                      "installment_plan_changes": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "invoice_id": {
                                              "type": "string"
                                            },
                                            "amount": {
                                              "type": "number"
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                },
                                "earned_cashback": {
                                  "type": "object",
                                  "properties": {
                                    "_id": {
                                      "type": "string"
                                    },
                                    "amount": {
                                      "type": "number"
                                    },
                                    "currency": {
                                      "type": "object",
                                      "properties": {
                                        "_id": {
                                          "type": "string"
                                        },
                                        "to_currency_id": {
                                          "type": "string"
                                        },
                                        "uuid": {
                                          "type": "number"
                                        },
                                        "name": {
                                          "type": "string"
                                        },
                                        "value": {
                                          "type": "number"
                                        },
                                        "symbol": {
                                          "type": "string"
                                        },
                                        "side": {
                                          "type": "string"
                                        },
                                        "numerator": {
                                          "type": "number"
                                        },
                                        "denominator": {
                                          "type": "number"
                                        },
                                        "round_type": {
                                          "type": "string"
                                        },
                                        "precision": {
                                          "type": "number"
                                        }
                                      }
                                    },
                                    "base_currency": {
                                      "type": "object",
                                      "properties": {
                                        "numerator": {
                                          "type": "number"
                                        },
                                        "denominator": {
                                          "type": "number"
                                        }
                                      }
                                    }
                                  }
                                },
                                "changes": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "payment_method": {
                                        "type": "object",
                                        "properties": {
                                          "_id": {
                                            "type": "string"
                                          },
                                          "type": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          }
                                        }
                                      },
                                      "amount": {
                                        "type": "number"
                                      },
                                      "paid": {
                                        "type": "number"
                                      },
                                      "currency": {
                                        "type": "object",
                                        "properties": {
                                          "_id": {
                                            "type": "string"
                                          },
                                          "to_currency_id": {
                                            "type": "string"
                                          },
                                          "uuid": {
                                            "type": "number"
                                          },
                                          "name": {
                                            "type": "string"
                                          },
                                          "value": {
                                            "type": "number"
                                          },
                                          "symbol": {
                                            "type": "string"
                                          },
                                          "side": {
                                            "type": "string"
                                          },
                                          "numerator": {
                                            "type": "number"
                                          },
                                          "denominator": {
                                            "type": "number"
                                          },
                                          "round_type": {
                                            "type": "string"
                                          },
                                          "precision": {
                                            "type": "number"
                                          }
                                        }
                                      },
                                      "base_currency": {
                                        "type": "object",
                                        "properties": {
                                          "numerator": {
                                            "type": "number"
                                          },
                                          "denominator": {
                                            "type": "number"
                                          }
                                        }
                                      },
                                      "base_currency_value": {
                                        "type": "number"
                                      }
                                    }
                                  }
                                },
                                "total_amount": {
                                  "type": "number"
                                },
                                "total_refunded_amount": {
                                  "type": "number"
                                },
                                "total_to_pay": {
                                  "type": "number"
                                },
                                "total_to_refund": {
                                  "type": "number"
                                },
                                "debt": {
                                  "type": "number"
                                },
                                "total_price": {
                                  "type": "number"
                                },
                                "total_added_tax": {
                                  "type": "number"
                                },
                                "total_included_tax": {
                                  "type": "number"
                                },
                                "discount": {
                                  "type": "number"
                                },
                                "total_discount": {
                                  "type": "number"
                                },
                                "discounts": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "is_custom": {
                                        "type": "boolean",
                                        "default": false
                                      },
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "apply_type": {
                                        "type": "string",
                                        "enum": [
                                          "percent",
                                          "cash"
                                        ]
                                      },
                                      "currency_id": {
                                        "type": "string"
                                      },
                                      "value_in_percent": {
                                        "type": "number",
                                        "default": 0
                                      }
                                    }
                                  }
                                },
                                "change": {
                                  "type": "number"
                                },
                                "delivery_date": {
                                  "type": "string"
                                },
                                "sold_at": {
                                  "type": "string"
                                },
                                "is_report_saved": {
                                  "type": "boolean"
                                },
                                "products": {
                                  "type": "object"
                                },
                                "installment_plan": {
                                  "type": "object",
                                  "properties": {
                                    "date": {
                                      "type": "string"
                                    },
                                    "amount": {
                                      "type": "number"
                                    }
                                  }
                                },
                                "is_installment_plan": {
                                  "type": "boolean"
                                },
                                "reason": {
                                  "type": "object",
                                  "properties": {
                                    "_id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    },
                                    "description": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "contract_id": {
                                  "type": "string"
                                },
                                "by_balance": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "amount": {
                                        "type": "number"
                                      },
                                      "paid": {
                                        "type": "number"
                                      },
                                      "currency": {
                                        "type": "object",
                                        "properties": {
                                          "_id": {
                                            "type": "string"
                                          },
                                          "to_currency_id": {
                                            "type": "string"
                                          },
                                          "uuid": {
                                            "type": "number"
                                          },
                                          "name": {
                                            "type": "string"
                                          },
                                          "value": {
                                            "type": "number"
                                          },
                                          "symbol": {
                                            "type": "string"
                                          },
                                          "side": {
                                            "type": "string"
                                          },
                                          "numerator": {
                                            "type": "number"
                                          },
                                          "denominator": {
                                            "type": "number"
                                          },
                                          "round_type": {
                                            "type": "string"
                                          },
                                          "precision": {
                                            "type": "number"
                                          }
                                        }
                                      },
                                      "base_currency": {
                                        "type": "object",
                                        "properties": {
                                          "numerator": {
                                            "type": "number"
                                          },
                                          "denominator": {
                                            "type": "number"
                                          }
                                        }
                                      },
                                      "installment_plan_changes": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "invoice_id": {
                                              "type": "string"
                                            },
                                            "amount": {
                                              "type": "number"
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                },
                                "calc_tax_after_discount": {
                                  "type": "boolean"
                                },
                                "calc_sale_discount_after_product": {
                                  "type": "boolean"
                                },
                                "contract": {
                                  "type": "object",
                                  "properties": {
                                    "_id": {
                                      "type": "string"
                                    },
                                    "created_at": {
                                      "type": "string"
                                    },
                                    "code": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    },
                                    "number": {
                                      "type": "string"
                                    },
                                    "currency_id": {
                                      "type": "string"
                                    },
                                    "organization_id": {
                                      "type": "string"
                                    },
                                    "amount": {
                                      "type": "number"
                                    },
                                    "date": {
                                      "type": "string"
                                    },
                                    "expire_date": {
                                      "type": "string"
                                    },
                                    "person_id": {
                                      "type": "string"
                                    },
                                    "note": {
                                      "type": "string"
                                    },
                                    "is_active": {
                                      "type": "boolean"
                                    },
                                    "contract_number": {
                                      "type": "number"
                                    }
                                  }
                                },
                                "customer_before_balance": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "currency_id": {
                                        "type": "string"
                                      },
                                      "amount": {
                                        "type": "number"
                                      },
                                      "organization_id": {
                                        "type": "string"
                                      },
                                      "payment_method_id": {
                                        "type": "string"
                                      }
                                    }
                                  }
                                },
                                "cashback_before_balance": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "customer_id": {
                                        "type": "string"
                                      },
                                      "person_id": {
                                        "type": "string"
                                      },
                                      "currency_id": {
                                        "type": "string"
                                      },
                                      "amount": {
                                        "type": "number"
                                      }
                                    }
                                  }
                                },
                                "customer_after_balance": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "currency_id": {
                                        "type": "string"
                                      },
                                      "amount": {
                                        "type": "number"
                                      },
                                      "organization_id": {
                                        "type": "string"
                                      },
                                      "payment_method_id": {
                                        "type": "string"
                                      }
                                    }
                                  }
                                },
                                "cashback_after_balance": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "customer_id": {
                                        "type": "string"
                                      },
                                      "person_id": {
                                        "type": "string"
                                      },
                                      "currency_id": {
                                        "type": "string"
                                      },
                                      "amount": {
                                        "type": "number"
                                      }
                                    }
                                  }
                                },
                                "delivery_address": {
                                  "type": "object",
                                  "properties": {
                                    "lat": {
                                      "type": "number"
                                    },
                                    "long": {
                                      "type": "number"
                                    },
                                    "human_address": {
                                      "type": "object",
                                      "properties": {
                                        "address": {
                                          "type": "string"
                                        },
                                        "city": {
                                          "type": "string"
                                        },
                                        "state": {
                                          "type": "string"
                                        },
                                        "zip": {
                                          "type": "string"
                                        }
                                      }
                                    }
                                  }
                                },
                                "order_id": {
                                  "type": "string"
                                },
                                "order": {
                                  "type": "object",
                                  "properties": {
                                    "_id": {
                                      "type": "string"
                                    },
                                    "number": {
                                      "type": "string"
                                    },
                                    "code": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "delivery_order": {
                                  "type": "object",
                                  "properties": {
                                    "_id": {
                                      "type": "string"
                                    },
                                    "number": {
                                      "type": "string"
                                    },
                                    "code": {
                                      "type": "string"
                                    },
                                    "state": {
                                      "type": "string"
                                    }
                                  }
                                }
                              },
                              "type": "object",
                              "required": [
                                "created_at",
                                "updated_at",
                                "uuid",
                                "number",
                                "currency",
                                "calc_tax_after_discount",
                                "_id"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "refund": {
                                  "type": "object",
                                  "$ref": "#/paths/~1trade~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data/allOf/0"
                                },
                                "refunds": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "$ref": "#/paths/~1trade~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data/allOf/0"
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "code": {
                    "type": "string",
                    "example": "TRADE-123"
                  },
                  "organization_id": {
                    "type": "string",
                    "example": "64e24f4199a9a3c944444445"
                  },
                  "order_id": {
                    "type": "string",
                    "example": "64e24f4199a9a3c944444446"
                  },
                  "open_ticket_id": {
                    "type": "string",
                    "example": "64e24f4199a9a3c944444447"
                  },
                  "open_ticket_uuid": {
                    "type": "string",
                    "example": "UUID-123"
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "new",
                      "canceled",
                      "done",
                      "draft",
                      "is_progress"
                    ],
                    "example": "new"
                  },
                  "customer_id": {
                    "type": "string",
                    "example": "64e24f4199a9a3c944444448"
                  },
                  "customer_assistant_id": {
                    "type": "string",
                    "example": "64e24f4199a9a3c944444449"
                  },
                  "state_id": {
                    "type": "string",
                    "example": "64e24f4199a9a3c944444450"
                  },
                  "responsible_id": {
                    "type": "string",
                    "example": "64e24f4199a9a3c944444451"
                  },
                  "courier_id": {
                    "type": "string",
                    "example": "64e24f4199a9a3c944444452"
                  },
                  "currency": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "example": "64e24f4199a9a3c944444453"
                      },
                      "name": {
                        "type": "string",
                        "example": "USD"
                      },
                      "value": {
                        "type": "number",
                        "example": 1
                      },
                      "side": {
                        "type": "string",
                        "enum": [
                          "start",
                          "end"
                        ],
                        "example": "start"
                      },
                      "symbol": {
                        "type": "string",
                        "example": "$"
                      }
                    },
                    "required": [
                      "_id",
                      "name",
                      "value"
                    ]
                  },
                  "price_id": {
                    "type": "string",
                    "example": "64e24f4199a9a3c944444453"
                  },
                  "by_balance": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "amount": {
                          "type": "number",
                          "example": 100
                        },
                        "currency": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "example": "64e24f4199a9a3c944444453"
                            },
                            "name": {
                              "type": "string",
                              "example": "USD"
                            },
                            "value": {
                              "type": "number",
                              "example": 1
                            },
                            "side": {
                              "type": "string",
                              "enum": [
                                "start",
                                "end"
                              ],
                              "example": "start"
                            },
                            "symbol": {
                              "type": "string",
                              "example": "$"
                            }
                          },
                          "required": [
                            "_id",
                            "name",
                            "value"
                          ]
                        },
                        "paid": {
                          "type": "number",
                          "example": 50
                        }
                      },
                      "required": [
                        "amount",
                        "currency"
                      ]
                    }
                  },
                  "payments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "external_transaction_id": {
                          "type": "string",
                          "example": "64e24f4199a9a3c944444453"
                        },
                        "amount": {
                          "type": "number",
                          "example": 100
                        },
                        "payment_method": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "example": "64e24f4199a9a3c944444453"
                            },
                            "name": {
                              "type": "string",
                              "example": "Credit Card"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "cash",
                                "cashless",
                                "system",
                                "card",
                                "debt",
                                "transfer",
                                "terminal",
                                "by_balance",
                                "by_cashback",
                                "trade_in",
                                "integration"
                              ],
                              "description": "Copy of the payment method's `type` at the time of sale; send the value `payment-method/get-by-id` returns (`cash` or `cashless`). The older values are still accepted so previously built payloads keep working. `gift` is no longer accepted.",
                              "example": "cashless"
                            }
                          },
                          "required": [
                            "_id",
                            "name"
                          ]
                        },
                        "currency": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "example": "64e24f4199a9a3c944444453"
                            },
                            "name": {
                              "type": "string",
                              "example": "USD"
                            },
                            "value": {
                              "type": "number",
                              "example": 1
                            },
                            "side": {
                              "type": "string",
                              "enum": [
                                "start",
                                "end"
                              ],
                              "example": "start"
                            },
                            "symbol": {
                              "type": "string",
                              "example": "$"
                            }
                          },
                          "required": [
                            "_id",
                            "name",
                            "value"
                          ]
                        },
                        "paid": {
                          "type": "number",
                          "example": 50
                        }
                      },
                      "required": [
                        "amount",
                        "payment_method",
                        "currency"
                      ]
                    }
                  },
                  "applied_cashbacks": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "amount": {
                          "type": "number",
                          "example": 100
                        },
                        "currency": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "example": "64e24f4199a9a3c944444453"
                            },
                            "name": {
                              "type": "string",
                              "example": "USD"
                            },
                            "value": {
                              "type": "number",
                              "example": 1
                            },
                            "side": {
                              "type": "string",
                              "enum": [
                                "start",
                                "end"
                              ],
                              "example": "start"
                            },
                            "symbol": {
                              "type": "string",
                              "example": "$"
                            }
                          },
                          "required": [
                            "_id",
                            "name",
                            "value"
                          ]
                        },
                        "paid": {
                          "type": "number",
                          "example": 50
                        }
                      },
                      "required": [
                        "amount",
                        "paid"
                      ]
                    }
                  },
                  "changes": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "external_transaction_id": {
                          "type": "string",
                          "example": "64e24f4199a9a3c944444453"
                        },
                        "amount": {
                          "type": "number",
                          "example": 100
                        },
                        "payment_method": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "example": "64e24f4199a9a3c944444453"
                            },
                            "name": {
                              "type": "string",
                              "example": "Credit Card"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "cash",
                                "cashless",
                                "system",
                                "card",
                                "debt",
                                "transfer",
                                "terminal",
                                "by_balance",
                                "by_cashback",
                                "trade_in",
                                "integration"
                              ],
                              "description": "Copy of the payment method's `type` at the time of sale; send the value `payment-method/get-by-id` returns (`cash` or `cashless`). The older values are still accepted so previously built payloads keep working. `gift` is no longer accepted.",
                              "example": "cashless"
                            }
                          },
                          "required": [
                            "_id",
                            "name"
                          ]
                        },
                        "currency": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "example": "64e24f4199a9a3c944444453"
                            },
                            "name": {
                              "type": "string",
                              "example": "USD"
                            },
                            "value": {
                              "type": "number",
                              "example": 1
                            },
                            "side": {
                              "type": "string",
                              "enum": [
                                "start",
                                "end"
                              ],
                              "example": "start"
                            },
                            "symbol": {
                              "type": "string",
                              "example": "$"
                            }
                          },
                          "required": [
                            "_id",
                            "name",
                            "value"
                          ]
                        },
                        "paid": {
                          "type": "number",
                          "example": 50
                        }
                      },
                      "required": [
                        "amount",
                        "payment_method",
                        "currency"
                      ]
                    }
                  },
                  "note": {
                    "type": "string",
                    "example": "This is a note.",
                    "maxLength": 512
                  },
                  "products": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "product_id": {
                          "type": "string",
                          "example": "64e24f4199a9a3c944444453"
                        },
                        "order_item_id": {
                          "type": "string",
                          "example": "64e24f4199a9a3c944444454"
                        },
                        "amount": {
                          "type": "number",
                          "example": 2
                        },
                        "box_count": {
                          "type": "number",
                          "example": 1
                        },
                        "box_item": {
                          "type": "number",
                          "example": 1
                        },
                        "price": {
                          "type": "number",
                          "example": 50
                        },
                        "total_to_pay": {
                          "type": "number",
                          "example": 100
                        },
                        "discounts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "_id": {
                                "type": "string",
                                "example": "64e24f4199a9a3c944444455"
                              },
                              "is_custom": {
                                "type": "boolean",
                                "example": false
                              },
                              "value": {
                                "type": "number",
                                "example": 10
                              },
                              "name": {
                                "type": "string",
                                "example": "Discount 1"
                              },
                              "apply_type": {
                                "type": "string",
                                "enum": [
                                  "percent",
                                  "cash"
                                ],
                                "example": "percent"
                              }
                            },
                            "required": [
                              "_id",
                              "name",
                              "is_custom",
                              "value",
                              "apply_type"
                            ]
                          }
                        },
                        "marks": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "cost": {
                          "type": "number",
                          "example": 40
                        },
                        "tax_ids": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "example": "64e24f4199a9a3c944444456"
                          }
                        },
                        "note": {
                          "type": "string",
                          "example": "This is a product note.",
                          "maxLength": 512
                        },
                        "extra_costs": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "cost_id": {
                                "type": "string",
                                "example": "64e24f4199a9a3c944444457"
                              },
                              "amount": {
                                "type": "number",
                                "example": 5
                              }
                            },
                            "required": [
                              "cost_id",
                              "amount"
                            ]
                          }
                        },
                        "warehouse_id": {
                          "type": "string",
                          "example": "64e24f4199a9a3c944444458"
                        },
                        "price_id": {
                          "type": "string",
                          "example": "64e24f4199a9a3c944444459"
                        }
                      },
                      "required": [
                        "product_id",
                        "amount",
                        "price",
                        "discounts",
                        "marks",
                        "extra_costs",
                        "warehouse_id"
                      ]
                    },
                    "minItems": 1
                  },
                  "date": {
                    "type": "string",
                    "format": "date-time",
                    "example": "2023-10-01T12:00:00Z"
                  },
                  "paying_date": {
                    "type": "string",
                    "format": "date-time",
                    "example": "2023-10-01T12:00:00Z"
                  },
                  "delivery_date": {
                    "type": "string",
                    "format": "date-time",
                    "example": "2023-10-01T12:00:00Z"
                  },
                  "delivery_address": {
                    "type": "object",
                    "properties": {
                      "human_address": {
                        "type": "object",
                        "properties": {
                          "address": {
                            "type": "string",
                            "example": "123 Main St, New York, NY 10001"
                          },
                          "city": {
                            "type": "string",
                            "example": "New York"
                          },
                          "state": {
                            "type": "string",
                            "example": "NY"
                          },
                          "zip": {
                            "type": "string",
                            "example": "10001"
                          }
                        }
                      },
                      "lat": {
                        "type": "number",
                        "example": 40.7128
                      },
                      "long": {
                        "type": "number",
                        "example": -74.006
                      }
                    }
                  },
                  "warehouse_id": {
                    "type": "string",
                    "example": "64e24f4199a9a3c944444460"
                  },
                  "discounts": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string",
                          "example": "64e24f4199a9a3c944444455"
                        },
                        "is_custom": {
                          "type": "boolean",
                          "example": false
                        },
                        "value": {
                          "type": "number",
                          "example": 10
                        },
                        "name": {
                          "type": "string",
                          "example": "Discount 1"
                        },
                        "apply_type": {
                          "type": "string",
                          "enum": [
                            "percent",
                            "cash"
                          ],
                          "example": "percent"
                        }
                      },
                      "required": [
                        "_id",
                        "name",
                        "is_custom",
                        "value",
                        "apply_type"
                      ]
                    }
                  },
                  "cover_by_balance": {
                    "type": "boolean",
                    "example": false
                  },
                  "calc_tax_after_discount": {
                    "type": "boolean",
                    "example": true
                  },
                  "installment_plan_interval": {
                    "type": "string",
                    "enum": [
                      "year",
                      "month"
                    ],
                    "example": "month"
                  },
                  "installment_plan": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "date": {
                          "type": "string",
                          "format": "date-time",
                          "example": "2023-10-01T12:00:00Z"
                        },
                        "amount": {
                          "type": "number",
                          "example": 100
                        }
                      },
                      "required": [
                        "date",
                        "amount"
                      ]
                    }
                  },
                  "additional_costs": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "cost_id": {
                          "type": "string",
                          "example": "64e24f4199a9a3c944444457"
                        },
                        "amount": {
                          "type": "number",
                          "example": 5
                        },
                        "customer_id": {
                          "type": "string",
                          "example": "64e24f4199a9a3c944444457"
                        },
                        "employee_id": {
                          "type": "string",
                          "example": "64e24f4199a9a3c944444457"
                        },
                        "supplier_id": {
                          "type": "string",
                          "example": "64e24f4199a9a3c944444457"
                        },
                        "person_id": {
                          "type": "string",
                          "example": "64e24f4199a9a3c944444457"
                        }
                      },
                      "required": [
                        "cost_id",
                        "amount"
                      ]
                    }
                  },
                  "currency_values": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "to_currency_id": {
                          "type": "string",
                          "example": "64e24f4199a9a3c944444453"
                        },
                        "denominator": {
                          "type": "string",
                          "example": "USD"
                        },
                        "numerator": {
                          "type": "number",
                          "example": 1
                        }
                      },
                      "required": [
                        "to_currency_id",
                        "denominator",
                        "numerator"
                      ]
                    }
                  },
                  "to_send_customer": {
                    "type": "boolean",
                    "example": false
                  },
                  "contract_id": {
                    "type": "string",
                    "example": "64e24f4199a9a3c944444461"
                  }
                },
                "type": "object",
                "required": [
                  "organization_id",
                  "state",
                  "responsible_id",
                  "currency",
                  "by_balance",
                  "payments",
                  "applied_cashbacks",
                  "changes",
                  "products",
                  "date",
                  "discounts",
                  "installment_plan_interval",
                  "additional_costs",
                  "currency_values"
                ]
              }
            }
          }
        }
      }
    },
    "/trade/get-by-id/{id}": {
      "get": {
        "tags": [
          "Trade"
        ],
        "description": "Get trade using its _id",
        "operationId": "trade-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1trade~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/trade/get-paging": {
      "post": {
        "tags": [
          "Trade"
        ],
        "description": "Get trades by paging",
        "operationId": "trade-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "product_id": {
                        "type": "string",
                        "example": "64e24f4199a9a3c944444453"
                      },
                      "total_from": {
                        "type": "number",
                        "example": 100
                      },
                      "total_to": {
                        "type": "number",
                        "example": 200
                      },
                      "customer_id": {
                        "type": "string",
                        "example": "64e24f4199a9a3c944444458"
                      },
                      "currency_id": {
                        "type": "string",
                        "example": "64e24f4199a9a3c944444453"
                      },
                      "is_fully_refunded": {
                        "type": "boolean",
                        "example": false
                      },
                      "responsible_id": {
                        "type": "string",
                        "example": "64e24f4199a9a3c944444451"
                      },
                      "states": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "example": "new"
                        }
                      },
                      "state_id": {
                        "type": "string",
                        "example": "64e24f4199a9a3c944444450"
                      },
                      "is_refund": {
                        "type": "boolean",
                        "example": false
                      },
                      "organization_id": {
                        "type": "string",
                        "example": "64e24f4199a9a3c944444445"
                      },
                      "search": {
                        "type": "string",
                        "example": "search string"
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "b2b",
                          "b2c"
                        ],
                        "example": "trade"
                      },
                      "contract_id": {
                        "type": "string",
                        "example": "64e24f4199a9a3c944444461"
                      },
                      "updated_at": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2023-10-01T12:00:00Z"
                      },
                      "created_by": {
                        "type": "string",
                        "example": "64e24f4199a9a3c944444451"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "properties": {
                                  "created_at": {
                                    "type": "string"
                                  },
                                  "updated_at": {
                                    "type": "string"
                                  },
                                  "code": {
                                    "type": "string"
                                  },
                                  "uuid": {
                                    "type": "string"
                                  },
                                  "organization": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "customer": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "note": {
                                    "type": "string"
                                  },
                                  "responsible": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "created_by": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "state": {
                                    "type": "string"
                                  },
                                  "state_id": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "string"
                                  },
                                  "currency_id": {
                                    "type": "string"
                                  },
                                  "earned_cashback": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "amount": {
                                        "type": "number"
                                      },
                                      "currency": {
                                        "type": "object",
                                        "properties": {
                                          "_id": {
                                            "type": "string"
                                          },
                                          "to_currency_id": {
                                            "type": "string"
                                          },
                                          "uuid": {
                                            "type": "number"
                                          },
                                          "name": {
                                            "type": "string"
                                          },
                                          "value": {
                                            "type": "number"
                                          },
                                          "symbol": {
                                            "type": "string"
                                          },
                                          "side": {
                                            "type": "string"
                                          },
                                          "numerator": {
                                            "type": "number"
                                          },
                                          "denominator": {
                                            "type": "number"
                                          },
                                          "round_type": {
                                            "type": "string"
                                          },
                                          "precision": {
                                            "type": "number"
                                          }
                                        }
                                      },
                                      "base_currency": {
                                        "type": "object",
                                        "properties": {
                                          "numerator": {
                                            "type": "number"
                                          },
                                          "denominator": {
                                            "type": "number"
                                          }
                                        }
                                      }
                                    }
                                  },
                                  "total_amount": {
                                    "type": "number"
                                  },
                                  "total_refunded_amount": {
                                    "type": "number"
                                  },
                                  "total_to_pay": {
                                    "type": "number"
                                  },
                                  "total_discount": {
                                    "type": "number"
                                  },
                                  "debt": {
                                    "type": "number"
                                  },
                                  "total_price": {
                                    "type": "number"
                                  },
                                  "total_added_tax": {
                                    "type": "number"
                                  },
                                  "contract": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "code": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "number": {
                                        "type": "string"
                                      },
                                      "currency_id": {
                                        "type": "string"
                                      },
                                      "organization_id": {
                                        "type": "string"
                                      },
                                      "amount": {
                                        "type": "number"
                                      },
                                      "date": {
                                        "type": "string"
                                      },
                                      "expire_date": {
                                        "type": "string"
                                      },
                                      "person_id": {
                                        "type": "string"
                                      },
                                      "note": {
                                        "type": "string"
                                      },
                                      "is_active": {
                                        "type": "boolean"
                                      },
                                      "contract_number": {
                                        "type": "number"
                                      }
                                    }
                                  },
                                  "position": {
                                    "type": "number"
                                  },
                                  "order_id": {
                                    "type": "string"
                                  },
                                  "date": {
                                    "type": "string"
                                  },
                                  "sold_at": {
                                    "type": "string"
                                  }
                                },
                                "type": "object",
                                "required": [
                                  "created_at",
                                  "updated_at",
                                  "uuid",
                                  "number",
                                  "_id"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/trade/set-state": {
      "put": {
        "tags": [
          "Trade"
        ],
        "description": "setState trade",
        "operationId": "trade-cancel",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "canceled",
                      "new",
                      "done",
                      "in_progress",
                      "draft"
                    ],
                    "example": "new"
                  },
                  "canceled_reason_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "with_transactions": {
                    "type": "boolean",
                    "default": false
                  },
                  "with_cashbacks": {
                    "type": "boolean",
                    "default": false
                  }
                },
                "type": "object",
                "required": [
                  "state",
                  "_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1trade~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/trade/set-state-id": {
      "put": {
        "tags": [
          "Trade"
        ],
        "description": "setState trade by id",
        "operationId": "trade-set-state-by-id",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "state_id": {
                    "type": "string"
                  },
                  "with_transactions": {
                    "type": "boolean",
                    "default": false
                  },
                  "with_cashbacks": {
                    "type": "boolean",
                    "default": false
                  }
                },
                "type": "object",
                "required": [
                  "state_id",
                  "_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1trade~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/transaction/income": {
      "post": {
        "tags": [
          "Transaction"
        ],
        "description": "This method allows adding transaction into the account.",
        "operationId": "transaction-create-income",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "number": {
                              "type": "string",
                              "description": "Transaction number"
                            },
                            "type": {
                              "type": "string",
                              "description": "Transaction type"
                            },
                            "balance_changes": {
                              "type": "array",
                              "description": "Balance changes",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "currency_id": {
                                    "type": "string",
                                    "description": "Currency ID"
                                  },
                                  "amount": {
                                    "type": "number",
                                    "description": "Amount"
                                  },
                                  "value": {
                                    "type": "number",
                                    "description": "Value"
                                  },
                                  "user_type": {
                                    "type": "string",
                                    "description": "User type"
                                  }
                                },
                                "required": [
                                  "currency_id",
                                  "amount",
                                  "value",
                                  "user_type"
                                ]
                              }
                            },
                            "organization": {
                              "type": "object",
                              "description": "Organization",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Organization ID"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Organization name"
                                }
                              }
                            },
                            "payment_type": {
                              "type": "object",
                              "description": "Payment type",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Payment type ID"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Payment type name"
                                },
                                "payment_type": {
                                  "type": "string",
                                  "description": "Payment type"
                                }
                              }
                            },
                            "contract_number": {
                              "type": "string",
                              "description": "Contract number"
                            },
                            "amount": {
                              "type": "number",
                              "description": "Amount"
                            },
                            "state": {
                              "type": "string",
                              "description": "State"
                            },
                            "currency_id": {
                              "type": "string",
                              "description": "Currency ID"
                            },
                            "exchange_amount": {
                              "type": "number",
                              "description": "Exchange amount"
                            },
                            "cashbox_id": {
                              "type": "string",
                              "description": "Cashbox ID"
                            },
                            "cashbox": {
                              "type": "object",
                              "description": "Cashbox",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Cashbox ID"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Cashbox name"
                                }
                              }
                            },
                            "destination_cashbox_id": {
                              "type": "string",
                              "description": "Destination cashbox ID"
                            },
                            "destination_cashbox": {
                              "type": "object",
                              "description": "Destination cashbox",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Destination cashbox ID"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Destination cashbox name"
                                }
                              }
                            },
                            "source_cashbox_id": {
                              "type": "string",
                              "description": "Source cashbox ID"
                            },
                            "source_cashbox": {
                              "type": "object",
                              "description": "Source cashbox",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Source cashbox ID"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Source cashbox name"
                                }
                              }
                            },
                            "exchange_currency": {
                              "type": "object",
                              "description": "Exchange currency",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Exchange currency ID"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Exchange currency name"
                                },
                                "value": {
                                  "type": "number",
                                  "description": "Exchange currency value"
                                }
                              }
                            },
                            "employee": {
                              "type": "object",
                              "description": "Employee",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Employee ID"
                                },
                                "full_name": {
                                  "type": "string",
                                  "description": "Employee full name"
                                },
                                "phone_number": {
                                  "type": "string",
                                  "description": "Employee phone number"
                                }
                              }
                            },
                            "supplier": {
                              "type": "object",
                              "description": "Supplier",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Supplier ID"
                                },
                                "full_name": {
                                  "type": "string",
                                  "description": "Supplier full name"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Supplier name"
                                },
                                "phone_number": {
                                  "type": "string",
                                  "description": "Supplier phone number"
                                }
                              }
                            },
                            "customer": {
                              "type": "object",
                              "description": "Customer",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Customer ID"
                                },
                                "full_name": {
                                  "type": "string",
                                  "description": "Customer full name"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Customer name"
                                },
                                "phone_number": {
                                  "type": "string",
                                  "description": "Customer phone number"
                                }
                              }
                            },
                            "person": {
                              "type": "object",
                              "description": "Person",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Person ID"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Person name"
                                },
                                "full_name": {
                                  "type": "string",
                                  "description": "Person full name"
                                },
                                "phone_number": {
                                  "type": "string",
                                  "description": "Person phone number"
                                },
                                "type": {
                                  "type": "string",
                                  "description": "Person type"
                                }
                              }
                            },
                            "parent": {
                              "type": "object",
                              "description": "Parent",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Parent ID"
                                },
                                "amount": {
                                  "type": "number",
                                  "description": "Amount"
                                },
                                "currency_id": {
                                  "type": "string",
                                  "description": "Currency ID"
                                },
                                "payment_method_id": {
                                  "type": "string",
                                  "description": "Payment method ID"
                                },
                                "payment_method": {
                                  "type": "string",
                                  "description": "Payment method"
                                },
                                "cashbox_id": {
                                  "type": "string",
                                  "description": "Cashbox ID"
                                },
                                "type": {
                                  "type": "string",
                                  "description": "Type"
                                },
                                "custom_id": {
                                  "type": "string",
                                  "description": "Custom ID"
                                }
                              }
                            },
                            "destination": {
                              "type": "object",
                              "description": "Destination",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Destination ID"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Name"
                                }
                              }
                            },
                            "payment_method": {
                              "type": "object",
                              "description": "Payment method",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Payment method ID"
                                },
                                "type": {
                                  "type": "string",
                                  "description": "Type"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Name"
                                }
                              }
                            },
                            "created_at": {
                              "type": "string",
                              "description": "Created at"
                            },
                            "date": {
                              "type": "string",
                              "description": "Date"
                            },
                            "updated_at": {
                              "type": "string",
                              "description": "Updated at"
                            },
                            "is_deleted": {
                              "type": "boolean",
                              "description": "Is deleted"
                            },
                            "completely_deleted": {
                              "type": "boolean",
                              "description": "Completely deleted"
                            },
                            "balance_list": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              },
                              "description": "Balance list"
                            },
                            "created_by": {
                              "type": "object",
                              "description": "Created by",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Created by ID"
                                },
                                "full_name": {
                                  "type": "string",
                                  "description": "Full name"
                                }
                              }
                            },
                            "to_customer": {
                              "type": "string",
                              "description": "To customer"
                            },
                            "to_supplier": {
                              "type": "string",
                              "description": "To supplier"
                            },
                            "to_employee": {
                              "type": "string",
                              "description": "To employee"
                            },
                            "to_person": {
                              "type": "string",
                              "description": "To person"
                            },
                            "description": {
                              "type": "string",
                              "description": "Description"
                            },
                            "receipt": {
                              "type": "string",
                              "description": "Receipt"
                            },
                            "cashbox_before_balance": {
                              "type": "object",
                              "required": [
                                "amount",
                                "organization_id"
                              ],
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "organization_id": {
                                  "type": "integer",
                                  "description": "Organization ID"
                                },
                                "payment_method_id": {
                                  "type": "string",
                                  "description": "Payment method ID"
                                },
                                "currency_id": {
                                  "type": "string",
                                  "description": "Currency ID"
                                },
                                "amount": {
                                  "type": "number"
                                }
                              },
                              "description": "Cashbox before balance"
                            },
                            "cashbox_after_balance": {
                              "type": "object",
                              "required": [
                                "amount",
                                "organization_id"
                              ],
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "organization_id": {
                                  "type": "integer",
                                  "description": "Organization ID"
                                },
                                "payment_method_id": {
                                  "type": "string",
                                  "description": "Payment method ID"
                                },
                                "currency_id": {
                                  "type": "string",
                                  "description": "Currency ID"
                                },
                                "amount": {
                                  "type": "number"
                                }
                              },
                              "description": "Cashbox after balance"
                            },
                            "human_before_balance": {
                              "type": "object",
                              "required": [
                                "amount",
                                "organization_id"
                              ],
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "organization_id": {
                                  "type": "integer",
                                  "description": "Organization ID"
                                },
                                "payment_method_id": {
                                  "type": "string",
                                  "description": "Payment method ID"
                                },
                                "currency_id": {
                                  "type": "string",
                                  "description": "Currency ID"
                                },
                                "amount": {
                                  "type": "number"
                                }
                              },
                              "description": "Human before balance"
                            },
                            "human_after_balance": {
                              "type": "object",
                              "required": [
                                "amount",
                                "organization_id"
                              ],
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "organization_id": {
                                  "type": "integer",
                                  "description": "Organization ID"
                                },
                                "payment_method_id": {
                                  "type": "string",
                                  "description": "Payment method ID"
                                },
                                "currency_id": {
                                  "type": "string",
                                  "description": "Currency ID"
                                },
                                "amount": {
                                  "type": "number"
                                }
                              },
                              "description": "Human after balance"
                            },
                            "attachments": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "description": "Attachments"
                            },
                            "invoice": {
                              "type": "object",
                              "required": [
                                "_id",
                                "number",
                                "currency_id",
                                "currency_value",
                                "paid",
                                "main_id"
                              ],
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Invoice ID"
                                },
                                "number": {
                                  "type": "string",
                                  "description": "Invoice number"
                                },
                                "currency_id": {
                                  "type": "string",
                                  "description": "Currency ID"
                                },
                                "currency_value": {
                                  "type": "number",
                                  "description": "Currency value"
                                },
                                "paid": {
                                  "type": "number",
                                  "description": "Paid amount"
                                },
                                "main_id": {
                                  "type": "string",
                                  "description": "Main invoice ID"
                                }
                              },
                              "description": "Invoice"
                            },
                            "can_be_canceled": {
                              "type": "boolean",
                              "description": "Can be canceled"
                            },
                            "done_at": {
                              "type": "string",
                              "description": "Done at"
                            },
                            "rejected_at": {
                              "type": "string",
                              "description": "Rejected at"
                            },
                            "canceled_at": {
                              "type": "string",
                              "description": "Canceled at"
                            },
                            "device": {
                              "type": "object",
                              "required": [
                                "_id",
                                "name",
                                "device_id"
                              ],
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Device ID"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Device name"
                                },
                                "device_id": {
                                  "type": "string",
                                  "description": "Device ID"
                                }
                              },
                              "description": "Device"
                            },
                            "trade": {
                              "type": "object",
                              "description": "Trade",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Trade ID"
                                },
                                "number": {
                                  "type": "string",
                                  "description": "Trade number"
                                },
                                "is_refund": {
                                  "type": "string",
                                  "description": "Is refund"
                                }
                              }
                            },
                            "responsible": {
                              "type": "object",
                              "description": "Responsible",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Responsible ID"
                                },
                                "full_name": {
                                  "type": "string",
                                  "description": "Full name"
                                }
                              }
                            },
                            "customer_assistant": {
                              "type": "object",
                              "description": "Customer assistant",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Customer assistant ID"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Customer assistant name"
                                },
                                "type": {
                                  "type": "string",
                                  "description": "Customer assistant type"
                                }
                              }
                            },
                            "supplier_assistant": {
                              "type": "object",
                              "description": "Supplier assistant",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Supplier assistant ID"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Supplier assistant name"
                                },
                                "type": {
                                  "type": "string",
                                  "description": "Supplier assistant type"
                                }
                              }
                            },
                            "employee_assistant": {
                              "type": "object",
                              "description": "Employee assistant",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Employee assistant ID"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Employee assistant name"
                                },
                                "type": {
                                  "type": "string",
                                  "description": "Employee assistant type"
                                }
                              }
                            },
                            "person_assistant": {
                              "type": "object",
                              "description": "Person assistant",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Person assistant ID"
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Person assistant name"
                                },
                                "type": {
                                  "type": "string",
                                  "description": "Person assistant type"
                                }
                              }
                            }
                          },
                          "type": "object",
                          "required": [
                            "to_customer",
                            "to_supplier",
                            "to_employee",
                            "to_person",
                            "number",
                            "type",
                            "state",
                            "amount",
                            "cashbox"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "invoice_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                  },
                  "payment_type_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                  },
                  "employee_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d800"
                  },
                  "employee_assistant_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d801"
                  },
                  "supplier_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d802"
                  },
                  "supplier_assistant_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d803"
                  },
                  "customer_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d804"
                  },
                  "customer_assistant_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d805"
                  },
                  "person_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d806"
                  },
                  "person_assistant_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d807"
                  },
                  "user_type": {
                    "type": "string",
                    "enum": [
                      "supplier",
                      "employee",
                      "customer",
                      "person",
                      "other"
                    ],
                    "example": "customer"
                  },
                  "amount": {
                    "type": "number",
                    "default": 10
                  },
                  "atachments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "path"
                      ],
                      "properties": {
                        "path": {
                          "type": "string",
                          "default": ""
                        }
                      }
                    }
                  },
                  "paid": {
                    "type": "number",
                    "default": 10
                  },
                  "payment_method_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d806"
                  },
                  "currency_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d806"
                  }
                },
                "type": "object",
                "required": [
                  "payment_type_id",
                  "employee_id",
                  "supplier_id",
                  "customer_id",
                  "person_id",
                  "user_type",
                  "amount",
                  "atachments",
                  "payment_method_id",
                  "currency_id"
                ]
              }
            }
          }
        }
      }
    },
    "/transaction/expense": {
      "post": {
        "tags": [
          "Transaction"
        ],
        "description": "This method allows adding transaction into the account.",
        "operationId": "transaction-create-invoice",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1transaction~1income/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1transaction~1income/post/requestBody/content/application~1json/schema"
              }
            }
          }
        }
      }
    },
    "/transaction/transfer": {
      "post": {
        "tags": [
          "Transaction"
        ],
        "description": "This method allows adding transaction into the account.",
        "operationId": "transaction-create-transfer",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1transaction~1income/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "destination_cashbox_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                  },
                  "user_type": {
                    "type": "string",
                    "enum": [
                      "supplier",
                      "employee",
                      "customer",
                      "person",
                      "other"
                    ],
                    "example": "customer"
                  },
                  "amount": {
                    "type": "number",
                    "default": 10
                  },
                  "atachments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "path"
                      ],
                      "properties": {
                        "path": {
                          "type": "string",
                          "default": ""
                        }
                      }
                    }
                  },
                  "paid": {
                    "type": "number",
                    "default": 10
                  },
                  "payment_method_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d806"
                  },
                  "currency_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d806"
                  }
                },
                "type": "object",
                "required": [
                  "destination_cashbox_id",
                  "user_type",
                  "amount",
                  "atachments",
                  "payment_method_id",
                  "currency_id"
                ]
              }
            }
          }
        }
      }
    },
    "/transaction/exchange": {
      "post": {
        "tags": [
          "Transaction"
        ],
        "description": "This method allows adding transaction into the account.",
        "operationId": "transaction-create-exchange",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1transaction~1income/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "exchange_currency_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                  },
                  "exchange_amount": {
                    "type": "number",
                    "default": 10
                  },
                  "destination_cashbox_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                  },
                  "user_type": {
                    "type": "string",
                    "enum": [
                      "supplier",
                      "employee",
                      "customer",
                      "person",
                      "other"
                    ],
                    "example": "customer"
                  },
                  "amount": {
                    "type": "number",
                    "default": 10
                  },
                  "atachments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "path"
                      ],
                      "properties": {
                        "path": {
                          "type": "string",
                          "default": ""
                        }
                      }
                    }
                  },
                  "paid": {
                    "type": "number",
                    "default": 10
                  },
                  "payment_method_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d806"
                  },
                  "currency_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d806"
                  }
                },
                "type": "object",
                "required": [
                  "destination_cashbox_id",
                  "exchange_currency_id",
                  "exchange_amount",
                  "user_type",
                  "amount",
                  "atachments",
                  "payment_method_id",
                  "currency_id"
                ]
              }
            }
          }
        }
      }
    },
    "/transaction/exchange-method": {
      "post": {
        "tags": [
          "Transaction"
        ],
        "description": "This method allows adding transaction into the account.",
        "operationId": "transaction-create-exchange-method",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1transaction~1income/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "destination_payment_method_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                  },
                  "exchange_amount": {
                    "type": "number",
                    "default": 10
                  },
                  "user_type": {
                    "type": "string",
                    "enum": [
                      "supplier",
                      "employee",
                      "customer",
                      "person",
                      "other"
                    ],
                    "example": "customer"
                  },
                  "amount": {
                    "type": "number",
                    "default": 10
                  },
                  "atachments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "path"
                      ],
                      "properties": {
                        "path": {
                          "type": "string",
                          "default": ""
                        }
                      }
                    }
                  },
                  "paid": {
                    "type": "number",
                    "default": 10
                  },
                  "payment_method_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d806"
                  },
                  "currency_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d806"
                  }
                },
                "type": "object",
                "required": [
                  "destination_payment_method_id",
                  "exchange_amount",
                  "user_type",
                  "amount",
                  "atachments",
                  "payment_method_id",
                  "currency_id"
                ]
              }
            }
          }
        }
      }
    },
    "/transaction/set-state": {
      "put": {
        "tags": [
          "Transaction"
        ],
        "description": "This method allows setting transaction state.",
        "operationId": "transaction-set-state",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1transaction~1income/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "canceled",
                      "pending",
                      "done",
                      "rejected"
                    ],
                    "example": "pending"
                  }
                },
                "type": "object",
                "required": [
                  "state"
                ]
              }
            }
          }
        }
      }
    },
    "/transaction/expense/approve": {
      "put": {
        "tags": [
          "Transaction"
        ],
        "description": "Approve a pending expense transaction.",
        "operationId": "transaction-expense-approve",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "_id"
                ],
                "properties": {
                  "_id": {
                    "type": "string",
                    "description": "Expense transaction ObjectId to approve",
                    "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The approved expense transaction",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1transaction~1income/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/transaction/expense/reject": {
      "put": {
        "tags": [
          "Transaction"
        ],
        "description": "Reject a pending expense transaction with a reason.",
        "operationId": "transaction-expense-reject",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "_id",
                  "approval_rejected_reason"
                ],
                "properties": {
                  "_id": {
                    "type": "string",
                    "description": "Expense transaction ObjectId to reject",
                    "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                  },
                  "approval_rejected_reason": {
                    "type": "string",
                    "minLength": 10,
                    "description": "Reason for rejecting the expense (at least 10 characters)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The rejected expense transaction",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1transaction~1income/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/transaction/expense/redirect": {
      "put": {
        "tags": [
          "Transaction"
        ],
        "description": "Redirect a pending expense transaction to another approver.",
        "operationId": "transaction-expense-redirect",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "_id",
                  "approver_id"
                ],
                "properties": {
                  "_id": {
                    "type": "string",
                    "description": "Expense transaction ObjectId to redirect",
                    "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                  },
                  "approver_id": {
                    "type": "string",
                    "description": "Employee ObjectId of the new approver",
                    "example": "64b7f4d9e2b3b6a0b7c5d800"
                  },
                  "approval_redirect_comment": {
                    "type": "string",
                    "description": "Optional comment explaining the redirect"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The redirected expense transaction",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1transaction~1income/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/transaction/get-by-id/{id}": {
      "get": {
        "tags": [
          "Transaction"
        ],
        "description": "Get transaction using its _id",
        "operationId": "transaction-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1transaction~1income/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/transaction/get-paging": {
      "post": {
        "tags": [
          "Transaction"
        ],
        "description": "Get transactions by paging",
        "operationId": "transaction-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "example": "income"
                      },
                      "states": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "example": "pending"
                        }
                      },
                      "payment_type_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                      },
                      "payment_type_ids": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                        }
                      },
                      "sort_by": {
                        "type": "string",
                        "example": "created_at"
                      },
                      "date_from": {
                        "type": "string",
                        "example": "2023-07-20T12:34:56.789Z"
                      },
                      "date_to": {
                        "type": "string",
                        "example": "2023-07-21T12:34:56.789Z"
                      },
                      "payment_method_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                      },
                      "payment_method_ids": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                        }
                      },
                      "cashbox_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                      },
                      "organization_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                      },
                      "customer_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                      },
                      "supplier_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                      },
                      "person_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                      },
                      "employee_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                      },
                      "is_deleted": {
                        "type": "boolean",
                        "example": true
                      },
                      "employee_ids": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                        }
                      },
                      "cashbox_ids": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d7ff"
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "properties": {
                                  "number": {
                                    "type": "string",
                                    "description": "Transaction number"
                                  },
                                  "type": {
                                    "type": "string",
                                    "description": "Transaction type"
                                  },
                                  "balance_changes": {
                                    "type": "array",
                                    "description": "Balance changes",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "currency_id": {
                                          "type": "string",
                                          "description": "Currency ID"
                                        },
                                        "amount": {
                                          "type": "number",
                                          "description": "Amount"
                                        },
                                        "value": {
                                          "type": "number",
                                          "description": "Value"
                                        },
                                        "user_type": {
                                          "type": "string",
                                          "description": "User type"
                                        }
                                      },
                                      "required": [
                                        "currency_id",
                                        "amount",
                                        "value",
                                        "user_type"
                                      ]
                                    }
                                  },
                                  "organization_id": {
                                    "type": "string",
                                    "description": "Organization ID"
                                  },
                                  "payment_type": {
                                    "type": "object",
                                    "description": "Payment type",
                                    "properties": {
                                      "_id": {
                                        "type": "string",
                                        "description": "Payment type ID"
                                      },
                                      "name": {
                                        "type": "string",
                                        "description": "Payment type name"
                                      },
                                      "payment_type": {
                                        "type": "string",
                                        "description": "Payment type"
                                      }
                                    }
                                  },
                                  "contract_number": {
                                    "type": "string",
                                    "description": "Contract number"
                                  },
                                  "amount": {
                                    "type": "number",
                                    "description": "Amount"
                                  },
                                  "state": {
                                    "type": "string",
                                    "description": "State"
                                  },
                                  "currency": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string",
                                        "description": "Currency ID"
                                      },
                                      "name": {
                                        "type": "string",
                                        "description": "Currency name"
                                      },
                                      "value": {
                                        "type": "number",
                                        "description": "Currency value"
                                      }
                                    },
                                    "description": "Currency"
                                  },
                                  "exchange_amount": {
                                    "type": "number",
                                    "description": "Exchange amount"
                                  },
                                  "cashbox_id": {
                                    "type": "string",
                                    "description": "Cashbox ID"
                                  },
                                  "destination_cashbox_id": {
                                    "type": "string",
                                    "description": "Destination cashbox ID"
                                  },
                                  "exchange_currency": {
                                    "type": "object",
                                    "description": "Exchange currency",
                                    "properties": {
                                      "_id": {
                                        "type": "string",
                                        "description": "Exchange currency ID"
                                      },
                                      "name": {
                                        "type": "string",
                                        "description": "Exchange currency name"
                                      },
                                      "value": {
                                        "type": "number",
                                        "description": "Exchange currency value"
                                      }
                                    }
                                  },
                                  "employee": {
                                    "type": "object",
                                    "description": "Employee",
                                    "properties": {
                                      "_id": {
                                        "type": "string",
                                        "description": "Employee ID"
                                      },
                                      "full_name": {
                                        "type": "string",
                                        "description": "Employee full name"
                                      },
                                      "phone_number": {
                                        "type": "string",
                                        "description": "Employee phone number"
                                      }
                                    }
                                  },
                                  "supplier": {
                                    "type": "object",
                                    "description": "Supplier",
                                    "properties": {
                                      "_id": {
                                        "type": "string",
                                        "description": "Supplier ID"
                                      },
                                      "full_name": {
                                        "type": "string",
                                        "description": "Supplier full name"
                                      },
                                      "name": {
                                        "type": "string",
                                        "description": "Supplier name"
                                      },
                                      "phone_number": {
                                        "type": "string",
                                        "description": "Supplier phone number"
                                      }
                                    }
                                  },
                                  "customer": {
                                    "type": "object",
                                    "description": "Customer",
                                    "properties": {
                                      "_id": {
                                        "type": "string",
                                        "description": "Customer ID"
                                      },
                                      "full_name": {
                                        "type": "string",
                                        "description": "Customer full name"
                                      },
                                      "name": {
                                        "type": "string",
                                        "description": "Customer name"
                                      },
                                      "phone_number": {
                                        "type": "string",
                                        "description": "Customer phone number"
                                      }
                                    }
                                  },
                                  "person": {
                                    "type": "object",
                                    "description": "Person",
                                    "properties": {
                                      "_id": {
                                        "type": "string",
                                        "description": "Person ID"
                                      },
                                      "name": {
                                        "type": "string",
                                        "description": "Person name"
                                      },
                                      "full_name": {
                                        "type": "string",
                                        "description": "Person full name"
                                      },
                                      "phone_number": {
                                        "type": "string",
                                        "description": "Person phone number"
                                      },
                                      "type": {
                                        "type": "string",
                                        "description": "Person type"
                                      }
                                    }
                                  },
                                  "parent": {
                                    "type": "object",
                                    "description": "Parent",
                                    "properties": {
                                      "_id": {
                                        "type": "string",
                                        "description": "Parent ID"
                                      },
                                      "amount": {
                                        "type": "number",
                                        "description": "Amount"
                                      },
                                      "currency_id": {
                                        "type": "string",
                                        "description": "Currency ID"
                                      },
                                      "payment_method_id": {
                                        "type": "string",
                                        "description": "Payment method ID"
                                      },
                                      "payment_method": {
                                        "type": "string",
                                        "description": "Payment method"
                                      },
                                      "cashbox_id": {
                                        "type": "string",
                                        "description": "Cashbox ID"
                                      },
                                      "type": {
                                        "type": "string",
                                        "description": "Type"
                                      },
                                      "custom_id": {
                                        "type": "string",
                                        "description": "Custom ID"
                                      }
                                    }
                                  },
                                  "destination": {
                                    "type": "object",
                                    "description": "Destination",
                                    "properties": {
                                      "_id": {
                                        "type": "string",
                                        "description": "Destination ID"
                                      },
                                      "name": {
                                        "type": "string",
                                        "description": "Name"
                                      }
                                    }
                                  },
                                  "payment_method": {
                                    "type": "object",
                                    "description": "Payment method",
                                    "properties": {
                                      "_id": {
                                        "type": "string",
                                        "description": "Payment method ID"
                                      },
                                      "type": {
                                        "type": "string",
                                        "description": "Type"
                                      },
                                      "name": {
                                        "type": "string",
                                        "description": "Name"
                                      }
                                    }
                                  },
                                  "created_at": {
                                    "type": "string",
                                    "description": "Created at"
                                  },
                                  "date": {
                                    "type": "string",
                                    "description": "Date"
                                  },
                                  "updated_at": {
                                    "type": "string",
                                    "description": "Updated at"
                                  },
                                  "is_deleted": {
                                    "type": "boolean",
                                    "description": "Is deleted"
                                  },
                                  "completely_deleted": {
                                    "type": "boolean",
                                    "description": "Completely deleted"
                                  },
                                  "balance_list": {
                                    "type": "array",
                                    "items": {
                                      "type": "object"
                                    },
                                    "description": "Balance list"
                                  },
                                  "created_by": {
                                    "type": "object",
                                    "description": "Created by",
                                    "properties": {
                                      "_id": {
                                        "type": "string",
                                        "description": "Created by ID"
                                      },
                                      "full_name": {
                                        "type": "string",
                                        "description": "Full name"
                                      }
                                    }
                                  },
                                  "description": {
                                    "type": "string",
                                    "description": "Description"
                                  },
                                  "receipt": {
                                    "type": "string",
                                    "description": "Receipt"
                                  },
                                  "cashbox_before_balance": {
                                    "type": "object",
                                    "required": [
                                      "amount",
                                      "organization_id"
                                    ],
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "organization_id": {
                                        "type": "integer",
                                        "description": "Organization ID"
                                      },
                                      "payment_method_id": {
                                        "type": "string",
                                        "description": "Payment method ID"
                                      },
                                      "currency_id": {
                                        "type": "string",
                                        "description": "Currency ID"
                                      },
                                      "amount": {
                                        "type": "number"
                                      }
                                    },
                                    "description": "Cashbox before balance"
                                  },
                                  "cashbox_after_balance": {
                                    "type": "object",
                                    "required": [
                                      "amount",
                                      "organization_id"
                                    ],
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "organization_id": {
                                        "type": "integer",
                                        "description": "Organization ID"
                                      },
                                      "payment_method_id": {
                                        "type": "string",
                                        "description": "Payment method ID"
                                      },
                                      "currency_id": {
                                        "type": "string",
                                        "description": "Currency ID"
                                      },
                                      "amount": {
                                        "type": "number"
                                      }
                                    },
                                    "description": "Cashbox after balance"
                                  },
                                  "human_before_balance": {
                                    "type": "object",
                                    "required": [
                                      "amount",
                                      "organization_id"
                                    ],
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "organization_id": {
                                        "type": "integer",
                                        "description": "Organization ID"
                                      },
                                      "payment_method_id": {
                                        "type": "string",
                                        "description": "Payment method ID"
                                      },
                                      "currency_id": {
                                        "type": "string",
                                        "description": "Currency ID"
                                      },
                                      "amount": {
                                        "type": "number"
                                      }
                                    },
                                    "description": "Human before balance"
                                  },
                                  "human_after_balance": {
                                    "type": "object",
                                    "required": [
                                      "amount",
                                      "organization_id"
                                    ],
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "organization_id": {
                                        "type": "integer",
                                        "description": "Organization ID"
                                      },
                                      "payment_method_id": {
                                        "type": "string",
                                        "description": "Payment method ID"
                                      },
                                      "currency_id": {
                                        "type": "string",
                                        "description": "Currency ID"
                                      },
                                      "amount": {
                                        "type": "number"
                                      }
                                    },
                                    "description": "Human after balance"
                                  },
                                  "attachments": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    },
                                    "description": "Attachments"
                                  },
                                  "invoice": {
                                    "type": "object",
                                    "required": [
                                      "_id",
                                      "number",
                                      "currency_id",
                                      "currency_value",
                                      "paid",
                                      "main_id"
                                    ],
                                    "properties": {
                                      "_id": {
                                        "type": "string",
                                        "description": "Invoice ID"
                                      },
                                      "number": {
                                        "type": "string",
                                        "description": "Invoice number"
                                      },
                                      "currency_id": {
                                        "type": "string",
                                        "description": "Currency ID"
                                      },
                                      "currency_value": {
                                        "type": "number",
                                        "description": "Currency value"
                                      },
                                      "paid": {
                                        "type": "number",
                                        "description": "Paid amount"
                                      },
                                      "main_id": {
                                        "type": "string",
                                        "description": "Main invoice ID"
                                      }
                                    },
                                    "description": "Invoice"
                                  },
                                  "can_be_canceled": {
                                    "type": "boolean",
                                    "description": "Can be canceled"
                                  },
                                  "amount_in_main": {
                                    "type": "number",
                                    "description": "Amount in main currency"
                                  }
                                },
                                "type": "object",
                                "required": [
                                  "number",
                                  "type",
                                  "state",
                                  "amount",
                                  "cashbox",
                                  "currency",
                                  "cashbox_id",
                                  "organization_id"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/task/create": {
      "post": {
        "tags": [
          "Task"
        ],
        "description": "Create a task. attached_to selects which FK array is required (trade_uuids/trade_ids, order_ids, customer_ids, supplier_ids, employee_ids).",
        "operationId": "task-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type_id",
                  "date",
                  "responsible_id"
                ],
                "properties": {
                  "organization_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "type_id": {
                    "type": "string",
                    "description": "Task-type id (see /task-type/get-paging)",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Date the task is scheduled for. When time_type=range, the value is rewritten to start_of_day(date)+start_time using the boss's UTC offset.",
                    "example": {
                      "$ref": "#/paths/~1task~1update/put/requestBody/content/application~1json/schema/properties/date/example"
                    }
                  },
                  "time_type": {
                    "type": "string",
                    "enum": [
                      "full_day",
                      "range"
                    ],
                    "default": "full_day"
                  },
                  "start_time": {
                    "type": "string",
                    "description": "Required when time_type=range. 24h HH:MM.",
                    "example": "09:00"
                  },
                  "end_time": {
                    "type": "string",
                    "description": "Required when time_type=range. 24h HH:MM.",
                    "example": "10:30"
                  },
                  "responsible_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "description": {
                    "type": "string"
                  },
                  "attached_to": {
                    "type": "string",
                    "enum": [
                      "trade",
                      "order",
                      "customer",
                      "supplier",
                      "employee"
                    ]
                  },
                  "trade_uuids": {
                    "type": "array",
                    "description": "Used when attached_to=trade. Preferred over trade_ids; first non-empty wins.",
                    "items": {
                      "type": "string"
                    }
                  },
                  "trade_ids": {
                    "type": "array",
                    "description": "Used when attached_to=trade.",
                    "items": {
                      "type": "string",
                      "example": {
                        "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                      }
                    }
                  },
                  "order_ids": {
                    "type": "array",
                    "description": "Required when attached_to=order.",
                    "items": {
                      "type": "string",
                      "example": {
                        "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                      }
                    }
                  },
                  "customer_ids": {
                    "type": "array",
                    "description": "Required when attached_to=customer.",
                    "items": {
                      "type": "string",
                      "example": {
                        "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                      }
                    }
                  },
                  "supplier_ids": {
                    "type": "array",
                    "description": "Required when attached_to=supplier.",
                    "items": {
                      "type": "string",
                      "example": {
                        "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                      }
                    }
                  },
                  "employee_ids": {
                    "type": "array",
                    "description": "Required when attached_to=employee.",
                    "items": {
                      "type": "string",
                      "example": {
                        "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1task~1move/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/task/update": {
      "put": {
        "tags": [
          "Task"
        ],
        "description": "Update a task. Rejects when state=completed. Only the creator or boss/additional-boss can update.",
        "operationId": "task-update",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "_id"
                ],
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "organization_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "type_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "date": {
                    "type": "string",
                    "format": "date-time",
                    "example": "2023-10-01T12:00:00Z"
                  },
                  "time_type": {
                    "type": "string",
                    "enum": [
                      "full_day",
                      "range"
                    ]
                  },
                  "start_time": {
                    "type": "string",
                    "example": "09:00"
                  },
                  "end_time": {
                    "type": "string",
                    "example": "10:30"
                  },
                  "responsible_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "description": {
                    "type": "string"
                  },
                  "attached_to": {
                    "type": "string",
                    "enum": [
                      "trade",
                      "order",
                      "customer",
                      "supplier",
                      "employee"
                    ]
                  },
                  "trade_uuids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "trade_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "order_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "customer_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "supplier_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "employee_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1task~1move/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/task/get-by-id/{id}": {
      "get": {
        "tags": [
          "Task"
        ],
        "description": "Get a task by _id.",
        "operationId": "task-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1task~1move/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/task/paging": {
      "get": {
        "tags": [
          "Task"
        ],
        "description": "Paginated task list. By default hides completed tasks unless `state` is set or `date_type=completed_at`. `time` and `times` filter by date-buckets (overdue/today/tomorrow/week/month/future) using the boss's UTC offset.",
        "operationId": "task-paging",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 20
            }
          },
          {
            "name": "updated_at",
            "in": "query",
            "description": "Sync cursor — only returns rows with updated_at >= this value.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "time",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "overdue",
                "today",
                "tomorrow",
                "week",
                "month",
                "future"
              ]
            }
          },
          {
            "name": "times",
            "in": "query",
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "overdue",
                  "today",
                  "tomorrow",
                  "week",
                  "month",
                  "future"
                ]
              }
            }
          },
          {
            "name": "date_type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "created_at",
                "date",
                "completed_at"
              ]
            }
          },
          {
            "name": "responsible_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type_ids",
            "in": "query",
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "attached_to",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "trade",
                "order",
                "customer",
                "supplier",
                "employee"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Defaults to non-completed when omitted.",
            "schema": {
              "type": "string",
              "enum": [
                "created",
                "completed"
              ]
            }
          },
          {
            "name": "trade_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "supplier_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "employee_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "purchase_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "organization_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1task~1move/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/task/delete/{id}": {
      "delete": {
        "tags": [
          "Task"
        ],
        "description": "Soft-delete a task (sets is_deleted=true). Rejects when state=completed.",
        "operationId": "task-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "description": "_id of the deleted task",
                          "example": "67b486d242ed76693cd2cc59"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/task/get-deleted": {
      "get": {
        "tags": [
          "Task"
        ],
        "description": "Returns ids of tasks deleted on or after `deleted_at` (also matches updated_at >= deleted_at).",
        "operationId": "task-get-deleted",
        "parameters": [
          {
            "name": "deleted_at",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1tax~1get-deleted/get/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/task/complete": {
      "put": {
        "tags": [
          "Task"
        ],
        "description": "Mark a task as completed. Set is_postponed=true with postponed_date to clone the task at a future date (the original is marked completed; the clone has postponed_id pointing back to it).",
        "operationId": "task-complete",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "_id"
                ],
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": {
                      "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                    }
                  },
                  "result_comment": {
                    "type": "string"
                  },
                  "is_postponed": {
                    "type": "boolean",
                    "default": false
                  },
                  "postponed_date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Required when is_postponed=true. Must be in the future. The original task is marked completed and a clone with postponed_id pointing to the original is created at this date.",
                    "example": {
                      "$ref": "#/paths/~1task~1update/put/requestBody/content/application~1json/schema/properties/date/example"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1task~1move/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/task/move": {
      "put": {
        "tags": [
          "Task"
        ],
        "description": "Move a task into a time-frame bucket. Sets `date` to the bucket's start (today/tomorrow/week/month) or month_end+1s for future. `overdue` is rejected.",
        "operationId": "task-move",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "_id",
                  "time"
                ],
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "67b486d242ed76693cd2cc59"
                  },
                  "time": {
                    "type": "string",
                    "description": "Target time-frame bucket. overdue is rejected.",
                    "enum": [
                      "today",
                      "tomorrow",
                      "week",
                      "month",
                      "future"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "type_id": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "type": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "icon": {
                                  "type": "string"
                                },
                                "svg": {
                                  "type": "string"
                                },
                                "color": {
                                  "type": "string"
                                }
                              }
                            },
                            "organization_id": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "date": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "time_type": {
                              "type": "string",
                              "enum": [
                                "full_day",
                                "range"
                              ]
                            },
                            "start_time": {
                              "type": "string",
                              "example": "09:00"
                            },
                            "end_time": {
                              "type": "string",
                              "example": "10:30"
                            },
                            "created_by": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "created_by_info": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                },
                                "phone_number": {
                                  "type": "string"
                                }
                              }
                            },
                            "responsible_id": {
                              "type": "string",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "responsible": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                },
                                "phone_number": {
                                  "type": "string"
                                }
                              }
                            },
                            "description": {
                              "type": "string"
                            },
                            "attached_to": {
                              "type": "string",
                              "enum": [
                                "trade",
                                "order",
                                "customer",
                                "supplier",
                                "employee"
                              ]
                            },
                            "trade_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "order_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "customer_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "supplier_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "employee_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "purchase_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "created",
                                "completed"
                              ]
                            },
                            "result_comment": {
                              "type": "string"
                            },
                            "is_postponed": {
                              "type": "boolean"
                            },
                            "postponed_id": {
                              "type": "string",
                              "description": "On a postponed clone, points back to the original task.",
                              "example": {
                                "$ref": "#/paths/~1task~1move/put/requestBody/content/application~1json/schema/properties/_id/example"
                              }
                            },
                            "completed_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/balance/get-by-customer": {
      "get": {
        "tags": [
          "Balance"
        ],
        "description": "Get the current balance of a customer in a specific currency. Used by chat bots and external dashboards.",
        "operationId": "balance-get-by-customer",
        "parameters": [
          {
            "name": "customer_id",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "example": "64b7f4d9e2b3b6a0b7c5d80a"
          },
          {
            "name": "currency_id",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "example": "64b7f4d9e2b3b6a0b7c5d80a"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "customer_id": {
                              "type": "string"
                            },
                            "currency_id": {
                              "type": "string"
                            },
                            "balance": {
                              "type": "number",
                              "example": 125000.5
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cashback/get-by-customer": {
      "get": {
        "tags": [
          "Cashback"
        ],
        "description": "Get the accrued cashback amount available for a specific customer.",
        "operationId": "cashback-get-by-customer",
        "parameters": [
          {
            "name": "customer_id",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "example": "64b7f4d9e2b3b6a0b7c5d80a"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "customer_id": {
                              "type": "string"
                            },
                            "cashback": {
                              "type": "number",
                              "example": 5000
                            },
                            "currency_id": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/custom-field/get-all": {
      "get": {
        "tags": [
          "Custom-field"
        ],
        "description": "List custom fields, optionally filtered by the target collection (table_name).",
        "operationId": "custom-field-get-all",
        "parameters": [
          {
            "name": "table_name",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter by target collection (e.g. customers, products, trades)."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1custom-field~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/custom-field/create": {
      "post": {
        "tags": [
          "Custom-field"
        ],
        "description": "Create a custom field on a target collection.",
        "operationId": "custom-field-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "table_name",
                  "type",
                  "name",
                  "is_required"
                ],
                "properties": {
                  "table_name": {
                    "type": "string",
                    "description": "Target collection (e.g. customers, products, trades, saleOrders).",
                    "example": "customers"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "text",
                      "number",
                      "date",
                      "boolean",
                      "select",
                      "multi_select",
                      "radio_button",
                      "textarea"
                    ],
                    "example": "text"
                  },
                  "name": {
                    "type": "string",
                    "example": "Loyalty tier"
                  },
                  "code": {
                    "type": "string",
                    "example": "loyalty_tier"
                  },
                  "regex": {
                    "type": "string",
                    "description": "Optional regex for client-side validation."
                  },
                  "error_message": {
                    "type": "string",
                    "description": "Error message shown when regex fails."
                  },
                  "is_required": {
                    "type": "boolean",
                    "default": false
                  },
                  "is_api_only": {
                    "type": "boolean",
                    "default": false,
                    "description": "Hide from UI; only available via API."
                  },
                  "is_visible": {
                    "type": "boolean",
                    "default": true
                  },
                  "order": {
                    "type": "number",
                    "example": 1
                  },
                  "organization_specs": {
                    "type": "array",
                    "description": "Per-organization required-state overrides.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "organization_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d80a"
                        },
                        "required_state_id": {
                          "type": "string",
                          "example": "64b7f4d9e2b3b6a0b7c5d80a"
                        }
                      }
                    }
                  },
                  "accessed_user_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "example": "64b7f4d9e2b3b6a0b7c5d80a"
                    }
                  },
                  "options": {
                    "type": "array",
                    "description": "Required when type is select / multi_select / radio_button.",
                    "items": {
                      "type": "object",
                      "required": [
                        "position",
                        "value"
                      ],
                      "properties": {
                        "position": {
                          "type": "number",
                          "example": 1
                        },
                        "value": {
                          "type": "string",
                          "example": "Gold"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "table_name": {
                              "type": "string"
                            },
                            "type": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "regex": {
                              "type": "string"
                            },
                            "error_message": {
                              "type": "string"
                            },
                            "is_required": {
                              "type": "boolean"
                            },
                            "is_api_only": {
                              "type": "boolean"
                            },
                            "is_visible": {
                              "type": "boolean"
                            },
                            "order": {
                              "type": "number"
                            },
                            "options": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "position": {
                                    "type": "number"
                                  },
                                  "value": {
                                    "type": "string"
                                  }
                                }
                              }
                            },
                            "organization_specs": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "organization_id": {
                                    "type": "string"
                                  },
                                  "required_state_id": {
                                    "type": "string"
                                  }
                                }
                              }
                            },
                            "accessed_user_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/task-type/get-by-id": {
      "post": {
        "tags": [
          "Task-type"
        ],
        "description": "Get a task type by its _id.",
        "operationId": "task-type-get-by-id",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "_id"
                ],
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string",
                              "example": "Follow-up call"
                            },
                            "color": {
                              "type": "string",
                              "example": "#FF9800"
                            },
                            "is_default": {
                              "type": "boolean"
                            },
                            "is_deleted": {
                              "type": "boolean"
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/task-type/paging": {
      "post": {
        "tags": [
          "Task-type"
        ],
        "description": "Paginated list of task types.",
        "operationId": "task-type-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string",
                        "description": "Search by name."
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1task-type~1get-by-id/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            },
                            "total": {
                              "type": "number",
                              "example": 42
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/recon-act/get-by-id/{id}": {
      "get": {
        "tags": [
          "Recon-act"
        ],
        "description": "Get a reconciliation act by its _id.",
        "operationId": "recon-act-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "number": {
                              "type": "string"
                            },
                            "organization_id": {
                              "type": "string"
                            },
                            "customer_id": {
                              "type": "string"
                            },
                            "supplier_id": {
                              "type": "string"
                            },
                            "employee_id": {
                              "type": "string"
                            },
                            "person_id": {
                              "type": "string"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "debt",
                                "credit"
                              ]
                            },
                            "balance_action": {
                              "type": "string",
                              "enum": [
                                "separated",
                                "merged"
                              ]
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "new",
                                "done",
                                "canceled"
                              ]
                            },
                            "amount": {
                              "type": "number"
                            },
                            "currency_id": {
                              "type": "string"
                            },
                            "after_balance": {
                              "type": "object",
                              "description": "Per-currency balance snapshot map."
                            },
                            "invoice": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "number": {
                                  "type": "string"
                                }
                              }
                            },
                            "payment_type": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/recon-act/get-all": {
      "post": {
        "tags": [
          "Recon-act"
        ],
        "description": "Get reconciliation acts for a customer / supplier / employee / person within a date range.",
        "operationId": "recon-act-get-all",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string",
                        "example": "64b7f4d9e2b3b6a0b7c5d80a"
                      },
                      "customer_id": {
                        "type": "string",
                        "description": "One of customer_id / supplier_id / employee_id / person_id must be set."
                      },
                      "supplier_id": {
                        "type": "string"
                      },
                      "employee_id": {
                        "type": "string"
                      },
                      "person_id": {
                        "type": "string"
                      },
                      "date_from": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "date_to": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "states": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "new",
                            "done",
                            "canceled"
                          ]
                        }
                      },
                      "locale": {
                        "type": "string",
                        "enum": [
                          "uz",
                          "ru",
                          "en",
                          "kk",
                          "ky",
                          "tg"
                        ],
                        "example": "uz"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "data": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1recon-act~1get-by-id~1%7Bid%7D/get/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            },
                            "before_balance": {
                              "type": "object",
                              "description": "Per-currency balance at date_from."
                            },
                            "after_balance": {
                              "type": "object",
                              "description": "Per-currency balance at date_to."
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/recon-act/get-all/export": {
      "post": {
        "tags": [
          "Recon-act"
        ],
        "description": "Export reconciliation acts as XLSX/CSV. Returns a download path.",
        "operationId": "recon-act-get-all-export",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1recon-act~1get-all/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "ext_type": {
                        "type": "string",
                        "enum": [
                          "xlsx",
                          "csv"
                        ],
                        "example": "xlsx"
                      }
                    },
                    "required": [
                      "ext_type"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "description": "URL or path of the generated file."
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/purchase-order/get-by-id/{id}": {
      "get": {
        "tags": [
          "Purchase-order"
        ],
        "description": "Get a purchase order by its _id (detailed view).",
        "operationId": "purchase-order-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1purchase-order~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/purchase-order/get-paging": {
      "post": {
        "tags": [
          "Purchase-order"
        ],
        "description": "Paginated list of purchase orders with optional filters.",
        "operationId": "purchase-order-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "states": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "new",
                            "in_progress",
                            "done",
                            "canceled",
                            "draft"
                          ]
                        }
                      },
                      "organization_id": {
                        "type": "string"
                      },
                      "supplier_id": {
                        "type": "string"
                      },
                      "responsible_id": {
                        "type": "string"
                      },
                      "currency_id": {
                        "type": "string"
                      },
                      "is_fully_purchased": {
                        "type": "boolean"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1purchase-order~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            },
                            "total": {
                              "type": "number"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/purchase-return/get-paging": {
      "post": {
        "tags": [
          "Purchase-return"
        ],
        "description": "Paginated list of purchase returns with optional filters.",
        "operationId": "purchase-return-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "states": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "new",
                            "done",
                            "canceled"
                          ]
                        }
                      },
                      "organization_id": {
                        "type": "string"
                      },
                      "supplier_id": {
                        "type": "string"
                      },
                      "purchase_id": {
                        "type": "string"
                      },
                      "responsible_id": {
                        "type": "string"
                      },
                      "currency_id": {
                        "type": "string"
                      },
                      "date_from": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "date_to": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1purchase-return~1get-by-id~1%7Bid%7D/get/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            },
                            "total": {
                              "type": "number"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/purchase-return/get-by-id/{id}": {
      "get": {
        "tags": [
          "Purchase-return"
        ],
        "description": "Get a purchase return by its _id (detailed view).",
        "operationId": "purchase-return-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "number": {
                              "type": "string"
                            },
                            "organization_id": {
                              "type": "string"
                            },
                            "supplier_id": {
                              "type": "string"
                            },
                            "purchase_id": {
                              "type": "string"
                            },
                            "responsible_id": {
                              "type": "string"
                            },
                            "warehouse_id": {
                              "type": "string"
                            },
                            "currency_id": {
                              "type": "string"
                            },
                            "date": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "new",
                                "done",
                                "canceled"
                              ]
                            },
                            "total": {
                              "type": "number"
                            },
                            "note": {
                              "type": "string"
                            },
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "product_id": {
                                    "type": "string"
                                  },
                                  "amount": {
                                    "type": "number"
                                  },
                                  "cost": {
                                    "type": "number"
                                  }
                                }
                              }
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/customer/get-by-phone-number": {
      "get": {
        "tags": [
          "Customer"
        ],
        "description": "Find a customer by phone number.",
        "operationId": "customer-get-by-phone-number",
        "parameters": [
          {
            "name": "phone_number",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string",
              "example": "+998901234567"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1customer~1update/put/responses/200/content/application~1json/schema"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/currency/get-main": {
      "get": {
        "tags": [
          "Currency"
        ],
        "description": "Get the main (default) currency of the tenant.",
        "operationId": "currency-get-main",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "completely_deleted": {
                              "type": "boolean"
                            },
                            "code": {
                              "type": "string"
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "is_deleted": {
                              "type": "boolean"
                            },
                            "is_main": {
                              "type": "boolean"
                            },
                            "name": {
                              "type": "string"
                            },
                            "side": {
                              "type": "string",
                              "enum": [
                                "start",
                                "end"
                              ]
                            },
                            "symbol": {
                              "type": "string"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "values": {
                              "type": "object",
                              "properties": {
                                "to_currency_id": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "number"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "numerator": {
                                  "type": "number"
                                },
                                "denominator": {
                                  "type": "number"
                                }
                              }
                            }
                          },
                          "type": "object",
                          "required": [
                            "code",
                            "name"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/currency/get-by-id/{id}": {
      "get": {
        "tags": [
          "Currency"
        ],
        "description": "Get a currency by its _id.",
        "operationId": "currency-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1currency~1get-main/get/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/currency/get-to-local": {
      "get": {
        "tags": [
          "Currency"
        ],
        "description": "Get the conversion rate from a source currency to the local (main) currency.",
        "operationId": "currency-get-to-local",
        "parameters": [
          {
            "name": "currency_id",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "amount",
            "required": false,
            "in": "query",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "from_currency_id": {
                              "type": "string"
                            },
                            "to_currency_id": {
                              "type": "string"
                            },
                            "rate": {
                              "type": "number"
                            },
                            "converted_amount": {
                              "type": "number"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/price/get-by-id/{id}": {
      "get": {
        "tags": [
          "Price"
        ],
        "description": "Get a price by its _id.",
        "operationId": "price-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "required": [
                            "currency_id",
                            "name",
                            "_id"
                          ],
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "The ID of the price"
                            },
                            "code": {
                              "type": "string",
                              "description": "The code of the price"
                            },
                            "short_name": {
                              "type": "string",
                              "description": "The short name of the price"
                            },
                            "name": {
                              "type": "string",
                              "description": "The name of the price"
                            },
                            "currency_id": {
                              "type": "string",
                              "description": "The currency ID of the price"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "inactive"
                              ],
                              "description": "The status of the price"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "sale",
                                "income"
                              ],
                              "description": "The type of the price"
                            },
                            "updated_by": {
                              "type": "string",
                              "description": "The ID of the user who updated the price"
                            },
                            "is_default": {
                              "type": "boolean",
                              "description": "Whether the price is the default price"
                            },
                            "can_be_updated": {
                              "type": "boolean",
                              "description": "Whether the price can be updated"
                            },
                            "is_main": {
                              "type": "boolean",
                              "description": "Whether the price is the main price"
                            },
                            "has_access": {
                              "type": "boolean",
                              "description": "Whether the price has access"
                            },
                            "employee_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "description": "The IDs of the employees who have access to the price"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/product/get-paging/by-price": {
      "post": {
        "tags": [
          "Product"
        ],
        "description": "Paginated list of products with prices for a specific price list.",
        "operationId": "product-get-paging-by-price",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "price_id": {
                        "type": "string",
                        "description": "Price list to fetch prices from."
                      },
                      "search": {
                        "type": "string"
                      },
                      "category_ids": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "price_id"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1product~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            },
                            "total": {
                              "type": "number"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/product/get-by-name": {
      "post": {
        "tags": [
          "Product"
        ],
        "description": "Find a product by its exact name.",
        "operationId": "product-get-by-name",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1product~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/product/get-by-barcode": {
      "post": {
        "tags": [
          "Product"
        ],
        "description": "Find a product by its barcode within an organization.",
        "operationId": "product-get-by-barcode",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "barcode",
                  "organization_id"
                ],
                "properties": {
                  "barcode": {
                    "type": "string",
                    "description": "barcode of product to look up"
                  },
                  "organization_id": {
                    "type": "string",
                    "description": "organization ObjectId to scope the lookup"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1product~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/product/get-by-sku": {
      "post": {
        "tags": [
          "Product"
        ],
        "description": "Find a product by its SKU within an organization.",
        "operationId": "product-get-by-sku",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "sku",
                  "organization_id"
                ],
                "properties": {
                  "sku": {
                    "type": "string",
                    "description": "local unique id (SKU) of product to look up"
                  },
                  "organization_id": {
                    "type": "string",
                    "description": "organization ObjectId to scope the lookup"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1product~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/category/get-by-name": {
      "get": {
        "tags": [
          "Category"
        ],
        "description": "Get a category by its exact name.",
        "operationId": "category-get-by-name",
        "parameters": [
          {
            "name": "name",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1category~1update/put/responses/200/content/application~1json/schema"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/organization/get-by-id/{id}": {
      "get": {
        "tags": [
          "Organization"
        ],
        "description": "Get an organization by its _id.",
        "operationId": "organization-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "id": {
                              "type": "string",
                              "description": "organization ID"
                            },
                            "name": {
                              "type": "string",
                              "description": "organization name"
                            },
                            "is_default": {
                              "type": "boolean",
                              "description": "Is this organization the default?"
                            },
                            "director_id": {
                              "type": "string",
                              "description": "Director ID"
                            },
                            "phone_number": {
                              "type": "string",
                              "description": "Phone number"
                            },
                            "address": {
                              "type": "string",
                              "description": "organization balance"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "main",
                                "ordinary",
                                "b2b"
                              ],
                              "description": "organization type"
                            },
                            "description": {
                              "type": "string",
                              "description": "organization description"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/supplier/update": {
      "post": {
        "tags": [
          "Supplier"
        ],
        "description": "Update a supplier.",
        "operationId": "supplier-update",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "_id"
                ],
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "name": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "legal",
                      "natural"
                    ]
                  },
                  "phone_number": {
                    "type": "string"
                  },
                  "phone_numbers": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "email": {
                    "type": "string"
                  },
                  "inn": {
                    "type": "string"
                  },
                  "address": {
                    "type": "string"
                  },
                  "note": {
                    "type": "string"
                  },
                  "category_id": {
                    "type": "string"
                  },
                  "responsible_id": {
                    "type": "string"
                  },
                  "organization_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "number": {
                              "type": "number"
                            },
                            "type": {
                              "type": "string"
                            },
                            "parent_id": {
                              "type": "string"
                            }
                          },
                          "type": "object",
                          "required": [
                            "name",
                            "number",
                            "type",
                            "parent_id"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/supplier/get-by-phone/{phone_number}": {
      "get": {
        "tags": [
          "Supplier"
        ],
        "description": "Find a supplier by phone number.",
        "operationId": "supplier-get-by-phone",
        "parameters": [
          {
            "name": "phone_number",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "example": "+998901234567"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1supplier~1update/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/invoice/get-initial-payment/by-trade-id": {
      "get": {
        "tags": [
          "Invoice"
        ],
        "description": "Get the initial payment for a trade. Returns the prepayment / down-payment invoice tied to a trade.",
        "operationId": "invoice-get-initial-payment-by-trade-id",
        "parameters": [
          {
            "name": "trade_id",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string",
              "example": "64b7f4d9e2b3b6a0b7c5d80a"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1invoice~1set-state/put/responses/200/content/application~1json/schema"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sale-order/accept/{id}": {
      "put": {
        "tags": [
          "Sale-order"
        ],
        "description": "Accept a sale order (mark as accepted by the responsible party).",
        "operationId": "sale-order-accept",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1sale-order~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sale-order/get-by-customer/for-bot": {
      "post": {
        "tags": [
          "Sale-order"
        ],
        "description": "List sale orders for a given customer, formatted for bot/external consumption.",
        "operationId": "sale-order-get-by-customer-for-bot",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "required": [
                      "customer_id"
                    ],
                    "properties": {
                      "customer_id": {
                        "type": "string"
                      },
                      "states": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "new",
                            "in_progress",
                            "done",
                            "canceled"
                          ]
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1sale-order~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            },
                            "total": {
                              "type": "number"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sale-order/get-by-id/for-bot/{id}": {
      "get": {
        "tags": [
          "Sale-order"
        ],
        "description": "Get a sale order by _id, formatted for bot/external consumption.",
        "operationId": "sale-order-get-by-id-for-bot",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1sale-order~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/trade/refund": {
      "post": {
        "tags": [
          "Trade"
        ],
        "description": "Refund a trade (full or partial).",
        "operationId": "trade-refund",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "trade_id",
                  "items"
                ],
                "properties": {
                  "trade_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "product_id",
                        "amount"
                      ],
                      "properties": {
                        "product_id": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "number"
                        },
                        "cost": {
                          "type": "number"
                        }
                      }
                    }
                  },
                  "note": {
                    "type": "string"
                  },
                  "with_transactions": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1trade~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/trade/get-by-id/for-bot/{id}": {
      "get": {
        "tags": [
          "Trade"
        ],
        "description": "Get a trade by _id, formatted for bot/external consumption.",
        "operationId": "trade-get-by-id-for-bot",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1trade~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/trade/get-items/{id}": {
      "get": {
        "tags": [
          "Trade"
        ],
        "description": "Get the line items of a trade.",
        "operationId": "trade-get-items",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "product_id": {
                                "type": "string"
                              },
                              "amount": {
                                "type": "number"
                              },
                              "cost": {
                                "type": "number"
                              },
                              "price": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/trade/export-by-xls-template": {
      "post": {
        "tags": [
          "Trade"
        ],
        "description": "Export filtered trades using a configured XLS template. Returns a download path.",
        "operationId": "trade-export-by-xls-template",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "template_id"
                ],
                "properties": {
                  "template_id": {
                    "type": "string",
                    "description": "ID of the configured XLS template."
                  },
                  "date_from": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "date_to": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "organization_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "customer_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "states": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "description": "Download URL or path."
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/trade/custom-fields/set": {
      "post": {
        "tags": [
          "Trade"
        ],
        "description": "Set / update the _custom_fields map on a trade.",
        "operationId": "trade-custom-fields-set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "_id",
                  "_custom_fields"
                ],
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a"
                  },
                  "_custom_fields": {
                    "type": "object",
                    "description": "Map of custom-field codes to their values.",
                    "additionalProperties": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1trade~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/summary/chart-pagin": {
      "post": {
        "tags": [
          "Report"
        ],
        "description": "Report summary chart paging",
        "operationId": "report-chart-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "sale_type": {
                        "type": "string",
                        "description": "Type of sale report. Optional for GET requests.",
                        "enum": [
                          "receipt",
                          "sale_contract",
                          "trade"
                        ]
                      },
                      "from_date": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Start date for the report in ISO 8601 format. Optional for GET requests."
                      },
                      "to_date": {
                        "type": "string",
                        "format": "date-time",
                        "description": "End date for the report in ISO 8601 format. Optional for GET requests."
                      },
                      "custom": {
                        "type": "boolean",
                        "description": "Indicates if custom time ranges are used. Optional for GET requests."
                      },
                      "from_time": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0,
                        "maximum": 24,
                        "description": "Start hour for custom time range (0-24). Required if 'custom' is true for GET requests."
                      },
                      "to_time": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0,
                        "maximum": 24,
                        "description": "End hour for custom time range (0-24). Required if 'custom' is true for GET requests."
                      },
                      "organizations": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "format": "mongo-id"
                        },
                        "description": "List of organization IDs. Optional for GET requests."
                      },
                      "employees": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "format": "mongo-id"
                        },
                        "description": "List of employee IDs. Optional for GET requests."
                      },
                      "divider": {
                        "type": "string",
                        "enum": [
                          "hour",
                          "day",
                          "week",
                          "month",
                          "quarter",
                          "year"
                        ],
                        "default": "day",
                        "description": "Specifies how data should be divided in the chart. Defaults to 'day'."
                      },
                      "field": {
                        "type": "string",
                        "enum": [
                          "gross_sales",
                          "refund",
                          "discount",
                          "gift",
                          "net_sales",
                          "profit"
                        ],
                        "default": "gross_sales",
                        "description": "Specifies the field to be displayed in the chart. Defaults to 'gross_sales'."
                      },
                      "limit": {
                        "type": "number",
                        "format": "int32",
                        "description": "Maximum number of items to return for pagination."
                      },
                      "page": {
                        "type": "number",
                        "format": "int32",
                        "description": "Page number for pagination."
                      },
                      "organization_id": {
                        "type": "string",
                        "format": "mongo-id",
                        "description": "ID of the organization."
                      },
                      "sort_by": {
                        "type": "string",
                        "description": "Field to sort the results by."
                      },
                      "price_id": {
                        "type": "string",
                        "format": "mongo-id",
                        "description": "ID of the price list."
                      },
                      "category_id": {
                        "type": "string",
                        "format": "mongo-id",
                        "description": "ID of the product category."
                      },
                      "customer_category_id": {
                        "type": "string",
                        "format": "mongo-id",
                        "description": "ID of the customer category."
                      },
                      "supplier_id": {
                        "type": "string",
                        "format": "mongo-id",
                        "description": "ID of the supplier."
                      },
                      "supplier_category_id": {
                        "type": "string",
                        "format": "mongo-id",
                        "description": "ID of the supplier category."
                      },
                      "asc": {
                        "type": "integer",
                        "enum": [
                          1,
                          -1
                        ],
                        "default": -1,
                        "description": "Sort order: 1 for ascending, -1 for descending. Defaults to descending."
                      },
                      "cashbox_id": {
                        "type": "string",
                        "format": "mongo-id",
                        "description": "ID of the cashbox."
                      },
                      "income_type": {
                        "type": "string",
                        "enum": [
                          "product_income",
                          "material_income"
                        ],
                        "description": "Type of income for the report."
                      },
                      "product_id": {
                        "type": "string",
                        "format": "mongo-id",
                        "description": "ID of the product."
                      },
                      "customer_id": {
                        "type": "string",
                        "format": "mongo-id",
                        "description": "ID of the customer."
                      },
                      "date_from": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Start date for the report in ISO 8601 format."
                      },
                      "date_to": {
                        "type": "string",
                        "format": "date-time",
                        "description": "End date for the report in ISO 8601 format."
                      },
                      "sort": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "integer",
                            "enum": [
                              1,
                              -1
                            ],
                            "description": "Sort order for 'name' field: 1 for ascending, -1 for descending."
                          }
                        },
                        "description": "Sorting parameters for the report."
                      },
                      "report_by": {
                        "type": "string",
                        "enum": [
                          "created_by",
                          "responsible"
                        ],
                        "description": "Criteria to report employees by."
                      },
                      "is_product": {
                        "type": "boolean",
                        "description": "Indicates if the report includes products."
                      },
                      "is_material": {
                        "type": "boolean",
                        "description": "Indicates if the report includes materials."
                      },
                      "is_semi_product": {
                        "type": "boolean",
                        "description": "Indicates if the report includes semi-products."
                      },
                      "search": {
                        "type": "string",
                        "description": "Search string for filtering results. Optional."
                      },
                      "trade_state": {
                        "type": "string",
                        "enum": [
                          "new",
                          "draft",
                          "in_progress",
                          "canceled",
                          "done"
                        ],
                        "description": "Current state of the trade."
                      },
                      "trade_states": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "new",
                            "draft",
                            "in_progress",
                            "canceled",
                            "done"
                          ]
                        },
                        "description": "List of trade states to filter by."
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "product",
                          "customer",
                          "employee",
                          "payment",
                          "category"
                        ],
                        "description": "Type of summary report."
                      },
                      "state": {
                        "type": "string",
                        "enum": [
                          "canceled",
                          "done"
                        ],
                        "description": "State of the income."
                      },
                      "min_items_sold": {
                        "type": "number",
                        "format": "int32",
                        "description": "Minimum number of items sold."
                      },
                      "min_gross_sales": {
                        "type": "number",
                        "format": "float",
                        "description": "Minimum gross sales amount."
                      }
                    },
                    "required": [
                      "limit",
                      "page",
                      "from_time",
                      "to_time"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "description": "The total number of data entries."
                        },
                        "data": {
                          "type": "array",
                          "description": "An array of individual report entries.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "date": {
                                "type": "string",
                                "format": "date-time",
                                "description": "The date of the report entry in ISO 8601 format."
                              },
                              "_id": {
                                "type": "object",
                                "description": "Optional breakdown of the date components, present when grouping.",
                                "properties": {
                                  "year": {
                                    "type": "integer",
                                    "description": "The year of the report entry."
                                  },
                                  "month": {
                                    "type": "integer",
                                    "description": "The month of the report entry."
                                  },
                                  "day": {
                                    "type": "integer",
                                    "description": "The day of the report entry."
                                  }
                                },
                                "nullable": true
                              },
                              "gross_sales": {
                                "type": "number",
                                "format": "float",
                                "description": "Total gross sales for the period."
                              },
                              "refund": {
                                "type": "number",
                                "format": "float",
                                "description": "Total refunds for the period."
                              },
                              "discount": {
                                "type": "number",
                                "format": "float",
                                "description": "Total discounts applied for the period."
                              },
                              "gift": {
                                "type": "number",
                                "format": "float",
                                "description": "Total value of gifts for the period."
                              },
                              "tax": {
                                "type": "number",
                                "format": "float",
                                "description": "Total tax amount for the period."
                              },
                              "cost": {
                                "type": "number",
                                "format": "float",
                                "description": "Total cost of goods sold for the period."
                              },
                              "net_sales": {
                                "type": "number",
                                "format": "float",
                                "description": "Total net sales for the period."
                              },
                              "profit": {
                                "type": "number",
                                "format": "float",
                                "description": "Total profit for the period."
                              },
                              "included_tax": {
                                "type": "number",
                                "format": "float",
                                "description": "Total included tax for the period."
                              },
                              "added_tax": {
                                "type": "number",
                                "format": "float",
                                "description": "Total added tax for the period."
                              },
                              "receipts": {
                                "type": "integer",
                                "description": "Number of receipts for the period."
                              },
                              "refunds": {
                                "type": "integer",
                                "description": "Number of refunds for the period."
                              },
                              "items_sold": {
                                "type": "number",
                                "description": "Total number of items sold for the period."
                              },
                              "items_refunded": {
                                "type": "integer",
                                "description": "Total number of items refunded for the period."
                              },
                              "average_receipt": {
                                "type": "number",
                                "format": "float",
                                "description": "Average receipt value for the period."
                              }
                            },
                            "required": [
                              "date",
                              "gross_sales",
                              "refund",
                              "discount",
                              "gift",
                              "tax",
                              "cost",
                              "net_sales",
                              "profit",
                              "included_tax",
                              "added_tax"
                            ]
                          }
                        },
                        "total_amounts": {
                          "type": "object",
                          "description": "Aggregated totals for all report entries.",
                          "properties": {
                            "_id": {
                              "type": "object",
                              "description": "Placeholder for aggregation ID, typically null for overall totals.",
                              "nullable": true
                            },
                            "gross_sales": {
                              "type": "number",
                              "format": "float",
                              "description": "Total gross sales across all entries."
                            },
                            "refund": {
                              "type": "number",
                              "format": "float",
                              "description": "Total refunds across all entries."
                            },
                            "discount": {
                              "type": "number",
                              "format": "float",
                              "description": "Total discounts across all entries."
                            },
                            "gift": {
                              "type": "number",
                              "format": "float",
                              "description": "Total value of gifts across all entries."
                            },
                            "cost": {
                              "type": "number",
                              "format": "float",
                              "description": "Total cost of goods sold across all entries."
                            },
                            "net_sales": {
                              "type": "number",
                              "format": "float",
                              "description": "Total net sales across all entries."
                            },
                            "profit": {
                              "type": "number",
                              "format": "float",
                              "description": "Total profit across all entries."
                            },
                            "receipts": {
                              "type": "integer",
                              "description": "Total number of receipts across all entries."
                            },
                            "refunds": {
                              "type": "integer",
                              "description": "Total number of refunds across all entries."
                            },
                            "included_tax": {
                              "type": "number",
                              "format": "float",
                              "description": "Total included tax across all entries."
                            },
                            "added_tax": {
                              "type": "number",
                              "format": "float",
                              "description": "Total added tax across all entries."
                            },
                            "items_sold": {
                              "type": "number",
                              "description": "Total number of items sold across all entries."
                            },
                            "items_refunded": {
                              "type": "integer",
                              "description": "Total number of items refunded across all entries."
                            },
                            "tax": {
                              "type": "number",
                              "format": "float",
                              "description": "Total tax across all entries. Can be null."
                            },
                            "average_receipt": {
                              "type": "number",
                              "format": "float",
                              "description": "Average receipt value across all entries."
                            }
                          },
                          "required": [
                            "_id",
                            "gross_sales",
                            "refund",
                            "discount",
                            "gift",
                            "cost",
                            "net_sales",
                            "profit",
                            "receipts",
                            "refunds",
                            "included_tax",
                            "added_tax",
                            "items_sold",
                            "items_refunded",
                            "average_receipt"
                          ]
                        },
                        "forecast": {
                          "type": "object",
                          "description": "Forecasted values for various metrics.",
                          "properties": {
                            "gross_sales": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted gross sales."
                            },
                            "refund": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted refunds."
                            },
                            "discount": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted discounts."
                            },
                            "gift": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted gift value."
                            },
                            "cost": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted cost of goods sold."
                            },
                            "net_sales": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted net sales."
                            },
                            "profit": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted profit."
                            },
                            "receipts": {
                              "type": "integer",
                              "description": "Forecasted number of receipts."
                            },
                            "refunds": {
                              "type": "integer",
                              "description": "Forecasted number of refunds."
                            },
                            "included_tax": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted included tax."
                            },
                            "added_tax": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted added tax."
                            },
                            "items_sold": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted number of items sold."
                            },
                            "items_refunded": {
                              "type": "integer",
                              "description": "Forecasted number of items refunded."
                            },
                            "average_receipt": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted average receipt value."
                            }
                          },
                          "required": [
                            "gross_sales",
                            "refund",
                            "discount",
                            "gift",
                            "cost",
                            "net_sales",
                            "profit",
                            "receipts",
                            "refunds",
                            "included_tax",
                            "added_tax",
                            "items_sold",
                            "items_refunded",
                            "average_receipt"
                          ]
                        }
                      },
                      "required": [
                        "total",
                        "data",
                        "total_amounts",
                        "forecast"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/summary/chart": {
      "post": {
        "tags": [
          "Report"
        ],
        "description": "Report summary chart",
        "operationId": "report-chart",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "type": "object",
                    "properties": {
                      "sale_type": {
                        "type": "string",
                        "description": "Type of sale report. Optional for GET requests.",
                        "enum": [
                          "receipt",
                          "sale_contract",
                          "trade"
                        ]
                      },
                      "from_date": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Start date for the report in ISO 8601 format. Optional for GET requests."
                      },
                      "to_date": {
                        "type": "string",
                        "format": "date-time",
                        "description": "End date for the report in ISO 8601 format. Optional for GET requests."
                      },
                      "custom": {
                        "type": "boolean",
                        "description": "Indicates if custom time ranges are used. Optional for GET requests."
                      },
                      "from_time": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0,
                        "maximum": 24,
                        "description": "Start hour for custom time range (0-24). Required if 'custom' is true for GET requests."
                      },
                      "to_time": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0,
                        "maximum": 24,
                        "description": "End hour for custom time range (0-24). Required if 'custom' is true for GET requests."
                      },
                      "organizations": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "format": "mongo-id"
                        },
                        "description": "List of organization IDs. Optional for GET requests."
                      },
                      "employees": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "format": "mongo-id"
                        },
                        "description": "List of employee IDs. Optional for GET requests."
                      },
                      "divider": {
                        "type": "string",
                        "enum": [
                          "hour",
                          "day",
                          "week",
                          "month",
                          "quarter",
                          "year"
                        ],
                        "default": "day",
                        "description": "Specifies how data should be divided in the chart. Defaults to 'day'."
                      },
                      "field": {
                        "type": "string",
                        "enum": [
                          "gross_sales",
                          "refund",
                          "discount",
                          "gift",
                          "net_sales",
                          "profit"
                        ],
                        "default": "gross_sales",
                        "description": "Specifies the field to be displayed in the chart. Defaults to 'gross_sales'."
                      },
                      "organization_id": {
                        "type": "string",
                        "format": "mongo-id",
                        "description": "ID of the organization."
                      },
                      "sort_by": {
                        "type": "string",
                        "description": "Field to sort the results by."
                      },
                      "price_id": {
                        "type": "string",
                        "format": "mongo-id",
                        "description": "ID of the price list."
                      },
                      "category_id": {
                        "type": "string",
                        "format": "mongo-id",
                        "description": "ID of the product category."
                      },
                      "customer_category_id": {
                        "type": "string",
                        "format": "mongo-id",
                        "description": "ID of the customer category."
                      },
                      "supplier_id": {
                        "type": "string",
                        "format": "mongo-id",
                        "description": "ID of the supplier."
                      },
                      "supplier_category_id": {
                        "type": "string",
                        "format": "mongo-id",
                        "description": "ID of the supplier category."
                      },
                      "asc": {
                        "type": "integer",
                        "enum": [
                          1,
                          -1
                        ],
                        "default": -1,
                        "description": "Sort order: 1 for ascending, -1 for descending. Defaults to descending."
                      },
                      "cashbox_id": {
                        "type": "string",
                        "format": "mongo-id",
                        "description": "ID of the cashbox."
                      },
                      "income_type": {
                        "type": "string",
                        "enum": [
                          "product_income",
                          "material_income"
                        ],
                        "description": "Type of income for the report."
                      },
                      "report_by": {
                        "type": "string",
                        "enum": [
                          "created_by",
                          "responsible"
                        ],
                        "description": "Criteria to report employees by."
                      },
                      "search": {
                        "type": "string",
                        "description": "Search string for filtering results. Optional."
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "product",
                          "customer",
                          "employee",
                          "payment",
                          "category"
                        ],
                        "description": "Type of summary report."
                      }
                    },
                    "required": [
                      "from_time",
                      "to_time"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "object",
                              "description": "Total aggregated sales data for the current period.",
                              "properties": {
                                "gross_sales": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total gross sales."
                                },
                                "refund": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total refunds."
                                },
                                "discount": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total discounts applied."
                                },
                                "gift": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total value of gifts."
                                },
                                "tax": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total tax amount."
                                },
                                "included_tax": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total included tax."
                                },
                                "added_tax": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total added tax."
                                },
                                "cost": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total cost of goods sold."
                                },
                                "net_sales": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total net sales."
                                },
                                "profit": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total profit."
                                },
                                "receipts": {
                                  "type": "integer",
                                  "description": "Total number of receipts."
                                },
                                "items_sold": {
                                  "type": "integer",
                                  "description": "Total number of items sold."
                                },
                                "refunds": {
                                  "type": "integer",
                                  "description": "Total number of refunds."
                                }
                              },
                              "required": [
                                "gross_sales",
                                "refund",
                                "discount",
                                "gift",
                                "tax",
                                "included_tax",
                                "added_tax",
                                "cost",
                                "net_sales",
                                "profit",
                                "receipts",
                                "items_sold",
                                "refunds"
                              ]
                            },
                            "total_prev": {
                              "type": "object",
                              "description": "Total aggregated sales data for the previous period.",
                              "properties": {
                                "gross_sales": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total gross sales for the previous period."
                                },
                                "refund": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total refunds for the previous period."
                                },
                                "discount": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total discounts applied for the previous period."
                                },
                                "gift": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total value of gifts for the previous period."
                                },
                                "tax": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total tax amount for the previous period."
                                },
                                "included_tax": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total included tax for the previous period."
                                },
                                "added_tax": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total added tax for the previous period."
                                },
                                "cost": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total cost of goods sold for the previous period."
                                },
                                "net_sales": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total net sales for the previous period."
                                },
                                "profit": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "Total profit for the previous period."
                                },
                                "receipts": {
                                  "type": "integer",
                                  "description": "Total number of receipts for the previous period."
                                },
                                "items_sold": {
                                  "type": "integer",
                                  "description": "Total number of items sold for the previous period."
                                },
                                "refunds": {
                                  "type": "integer",
                                  "description": "Total number of refunds for the previous period."
                                }
                              },
                              "required": [
                                "gross_sales",
                                "refund",
                                "discount",
                                "gift",
                                "tax",
                                "included_tax",
                                "added_tax",
                                "cost",
                                "net_sales",
                                "profit",
                                "receipts",
                                "items_sold",
                                "refunds"
                              ]
                            },
                            "chart": {
                              "type": "array",
                              "description": "Data points for the sales chart.",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "date": {
                                    "type": "string",
                                    "format": "date-time",
                                    "description": "Date of the chart data point."
                                  },
                                  "value": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "The value for the chart data point (e.g., gross sales)."
                                  }
                                },
                                "required": [
                                  "date",
                                  "value"
                                ]
                              }
                            },
                            "plan": {
                              "type": "object",
                              "nullable": true,
                              "description": "Sales plan data, can be null."
                            }
                          },
                          "required": [
                            "total",
                            "total_prev",
                            "chart",
                            "plan"
                          ]
                        }
                      },
                      "required": [
                        "data"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/summary/income/chart": {
      "post": {
        "tags": [
          "Report"
        ],
        "description": "Report summary income chart",
        "operationId": "report-income chart",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1summary~1chart/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "chart": {
                              "type": "array",
                              "description": "An array of data points for the chart, typically representing values over time.",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "date": {
                                    "type": "string",
                                    "format": "date-time",
                                    "description": "The date and time for the chart data point in ISO 8601 format."
                                  },
                                  "value": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "The numerical value for the given date."
                                  }
                                },
                                "required": [
                                  "date",
                                  "value"
                                ]
                              }
                            },
                            "total": {
                              "type": "object",
                              "description": "Aggregated total data for the report.",
                              "properties": {
                                "total": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "The grand total amount."
                                },
                                "data": {
                                  "type": "array",
                                  "description": "An array containing details of various payment types and their amounts.",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string",
                                        "format": "mongo-id",
                                        "description": "The unique identifier for the payment type."
                                      },
                                      "payment_type": {
                                        "type": "object",
                                        "description": "Details of the payment type.",
                                        "properties": {
                                          "_id": {
                                            "type": "string",
                                            "format": "mongo-id",
                                            "description": "The unique identifier for the payment type."
                                          },
                                          "name": {
                                            "type": "string",
                                            "description": "The name of the payment type (e.g., 'Savdo (mahsulot sotish)')."
                                          }
                                        },
                                        "required": [
                                          "_id",
                                          "name"
                                        ]
                                      },
                                      "amount": {
                                        "type": "number",
                                        "format": "float",
                                        "description": "The amount associated with this payment type."
                                      }
                                    },
                                    "required": [
                                      "_id",
                                      "payment_type",
                                      "amount"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "total",
                                "data"
                              ]
                            },
                            "divider": {
                              "type": "string",
                              "description": "The time unit by which the data is divided in the chart (e.g., 'week')."
                            },
                            "currency": {
                              "type": "object",
                              "description": "Information about the currency used in the report.",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "format": "mongo-id",
                                  "description": "The unique identifier for the currency."
                                },
                                "name": {
                                  "type": "string",
                                  "description": "The name of the currency (e.g., 'US Dollar')."
                                },
                                "symbol": {
                                  "type": "string",
                                  "description": "The symbol of the currency (e.g., '$')."
                                },
                                "side": {
                                  "type": "string",
                                  "description": "Indicates where the currency symbol should be placed ('start' or 'end')."
                                }
                              },
                              "required": [
                                "_id",
                                "name",
                                "symbol",
                                "side"
                              ]
                            }
                          },
                          "required": [
                            "chart",
                            "total",
                            "divider",
                            "currency"
                          ]
                        }
                      },
                      "required": [
                        "data"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/summary/expense/chart": {
      "post": {
        "tags": [
          "Report"
        ],
        "description": "Report summary expense chart",
        "operationId": "report-expense chart",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1summary~1chart/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "chart": {
                              "type": "array",
                              "description": "Historical data points for the report, typically representing values over time.",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "date": {
                                    "type": "string",
                                    "format": "date-time",
                                    "description": "The date and time for the data point in ISO 8601 format."
                                  },
                                  "value": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "The numerical value for the given date."
                                  }
                                },
                                "required": [
                                  "date",
                                  "value"
                                ]
                              }
                            },
                            "total": {
                              "type": "object",
                              "description": "Aggregated total data for the report.",
                              "properties": {
                                "total": {
                                  "type": "number",
                                  "format": "float",
                                  "description": "The grand total amount."
                                },
                                "data": {
                                  "type": "array",
                                  "description": "An array containing details of various payment types and their amounts.",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string",
                                        "format": "mongo-id",
                                        "description": "The unique identifier for the payment type."
                                      },
                                      "payment_type": {
                                        "type": "object",
                                        "description": "Details of the payment type.",
                                        "properties": {
                                          "_id": {
                                            "type": "string",
                                            "format": "mongo-id",
                                            "description": "The unique identifier for the payment type."
                                          },
                                          "name": {
                                            "type": "string",
                                            "description": "The name of the payment type (e.g., 'Mijozdan mahsulot qaytarib olish')."
                                          }
                                        },
                                        "required": [
                                          "_id",
                                          "name"
                                        ]
                                      },
                                      "amount": {
                                        "type": "number",
                                        "format": "float",
                                        "description": "The amount associated with this payment type."
                                      }
                                    },
                                    "required": [
                                      "_id",
                                      "payment_type",
                                      "amount"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "total",
                                "data"
                              ]
                            },
                            "divider": {
                              "type": "string",
                              "description": "The time unit by which the data is divided in the chart (e.g., 'day')."
                            },
                            "currency": {
                              "type": "object",
                              "description": "Information about the currency used in the report.",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "format": "mongo-id",
                                  "description": "The unique identifier for the currency."
                                },
                                "name": {
                                  "type": "string",
                                  "description": "The name of the currency (e.g., 'usd')."
                                },
                                "symbol": {
                                  "type": "string",
                                  "description": "The symbol of the currency (e.g., '$')."
                                },
                                "side": {
                                  "type": "string",
                                  "description": "Indicates where the currency symbol should be placed ('start' or 'end')."
                                }
                              },
                              "required": [
                                "_id",
                                "name",
                                "symbol",
                                "side"
                              ]
                            }
                          },
                          "required": [
                            "chart",
                            "total",
                            "divider",
                            "currency"
                          ]
                        }
                      },
                      "required": [
                        "data"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/sales/by-item-pagin": {
      "post": {
        "tags": [
          "Report"
        ],
        "description": "Report summary by-item-pagin",
        "operationId": "report-by-item-pagin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1summary~1chart-pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "description": "The total number of product entries."
                        },
                        "data": {
                          "type": "array",
                          "description": "An array of individual product report entries.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "_id": {
                                "type": "string",
                                "format": "mongo-id",
                                "description": "The unique identifier of the report entry (e.g., product ID)."
                              },
                              "date": {
                                "type": "string",
                                "format": "date-time",
                                "description": "The date of the report entry in ISO 8601 format."
                              },
                              "product_id": {
                                "type": "string",
                                "format": "mongo-id",
                                "description": "The ID of the product."
                              },
                              "category_id": {
                                "type": "string",
                                "format": "mongo-id",
                                "description": "The ID of the product category."
                              },
                              "gross_sales": {
                                "type": "number",
                                "format": "float",
                                "description": "Total gross sales for the product."
                              },
                              "refund": {
                                "type": "number",
                                "format": "float",
                                "description": "Total refunds for the product."
                              },
                              "discount": {
                                "type": "number",
                                "format": "float",
                                "description": "Total discounts applied to the product."
                              },
                              "gift": {
                                "type": "number",
                                "format": "float",
                                "description": "Total value of gifts associated with the product."
                              },
                              "tax": {
                                "type": "number",
                                "format": "float",
                                "description": "Total tax amount for the product."
                              },
                              "included_tax": {
                                "type": "number",
                                "format": "float",
                                "description": "Total included tax for the product."
                              },
                              "added_tax": {
                                "type": "number",
                                "format": "float",
                                "description": "Total added tax for the product."
                              },
                              "cost": {
                                "type": "number",
                                "format": "float",
                                "description": "Total cost of the product sold."
                              },
                              "net_sales": {
                                "type": "number",
                                "format": "float",
                                "description": "Total net sales for the product."
                              },
                              "profit": {
                                "type": "number",
                                "format": "float",
                                "description": "Total profit from the product."
                              },
                              "items_sold": {
                                "type": "integer",
                                "description": "Total number of items of this product sold."
                              },
                              "items_refunded": {
                                "type": "integer",
                                "description": "Total number of items of this product refunded."
                              },
                              "product_name": {
                                "type": "string",
                                "description": "The name of the product."
                              },
                              "dimension": {
                                "type": "object",
                                "description": "Dimensional properties of the product.",
                                "properties": {
                                  "shape": {
                                    "type": "string",
                                    "description": "The shape of the product."
                                  },
                                  "netto_weight": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "The net weight of the product."
                                  },
                                  "gross_weight": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "The gross weight of the product."
                                  },
                                  "height": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "The height of the product."
                                  },
                                  "volume": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "The volume of the product."
                                  },
                                  "diameter": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "The diameter of the product."
                                  },
                                  "width": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "The width of the product."
                                  },
                                  "length": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "The length of the product."
                                  },
                                  "_id": {
                                    "type": "string",
                                    "format": "mongo-id",
                                    "description": "The ID of the dimension entry."
                                  }
                                },
                                "required": [
                                  "shape",
                                  "netto_weight",
                                  "gross_weight",
                                  "height",
                                  "volume",
                                  "diameter",
                                  "width",
                                  "length",
                                  "_id"
                                ]
                              },
                              "measure": {
                                "type": "object",
                                "description": "Measurement unit details for the product.",
                                "properties": {
                                  "system_code": {
                                    "type": "string",
                                    "description": "The system code for the measure unit."
                                  },
                                  "code": {
                                    "type": "string",
                                    "description": "The code for the measure unit."
                                  },
                                  "short_name": {
                                    "type": "string",
                                    "description": "The short name for the measure unit."
                                  },
                                  "name": {
                                    "type": "string",
                                    "description": "The full name of the measure unit."
                                  },
                                  "decimal_count": {
                                    "type": "integer",
                                    "description": "The decimal count for the measure unit."
                                  },
                                  "_id": {
                                    "type": "string",
                                    "format": "mongo-id",
                                    "description": "The ID of the measure unit."
                                  }
                                },
                                "required": [
                                  "system_code",
                                  "code",
                                  "short_name",
                                  "name",
                                  "decimal_count",
                                  "_id"
                                ]
                              },
                              "category_name": {
                                "type": "string",
                                "description": "The name of the product category."
                              }
                            },
                            "required": [
                              "_id",
                              "date",
                              "product_id",
                              "category_id",
                              "gross_sales",
                              "refund",
                              "discount",
                              "gift",
                              "tax",
                              "included_tax",
                              "added_tax",
                              "cost",
                              "net_sales",
                              "profit",
                              "items_sold",
                              "items_refunded",
                              "product_name",
                              "dimension",
                              "measure",
                              "category_name"
                            ]
                          }
                        },
                        "total_data": {
                          "type": "object",
                          "description": "Aggregated total data for all products in the report.",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date-time",
                              "description": "Date associated with the total data."
                            },
                            "gross_sales": {
                              "type": "number",
                              "format": "float",
                              "description": "Total gross sales."
                            },
                            "refund": {
                              "type": "number",
                              "format": "float",
                              "description": "Total refunds."
                            },
                            "discount": {
                              "type": "number",
                              "format": "float",
                              "description": "Total discounts applied."
                            },
                            "gift": {
                              "type": "number",
                              "format": "float",
                              "description": "Total value of gifts."
                            },
                            "tax": {
                              "type": "number",
                              "format": "float",
                              "description": "Total tax amount."
                            },
                            "included_tax": {
                              "type": "number",
                              "format": "float",
                              "description": "Total included tax."
                            },
                            "added_tax": {
                              "type": "number",
                              "format": "float",
                              "description": "Total added tax."
                            },
                            "cost": {
                              "type": "number",
                              "format": "float",
                              "description": "Total cost of goods sold."
                            },
                            "net_sales": {
                              "type": "number",
                              "format": "float",
                              "description": "Total net sales."
                            },
                            "profit": {
                              "type": "number",
                              "format": "float",
                              "description": "Total profit."
                            },
                            "items_sold": {
                              "type": "integer",
                              "description": "Total number of items sold."
                            },
                            "items_refunded": {
                              "type": "integer",
                              "description": "Total number of items refunded."
                            },
                            "sold_netto_weight": {
                              "type": "number",
                              "format": "float",
                              "description": "Total netto weight of items sold."
                            },
                            "sold_gross_weight": {
                              "type": "number",
                              "format": "float",
                              "description": "Total gross weight of items sold."
                            },
                            "refunded_netto_weight": {
                              "type": "number",
                              "format": "float",
                              "description": "Total netto weight of items refunded."
                            },
                            "refunded_gross_weight": {
                              "type": "number",
                              "format": "float",
                              "description": "Total gross weight of items refunded."
                            }
                          },
                          "required": [
                            "date",
                            "gross_sales",
                            "refund",
                            "discount",
                            "gift",
                            "tax",
                            "included_tax",
                            "added_tax",
                            "cost",
                            "net_sales",
                            "profit",
                            "items_sold",
                            "items_refunded",
                            "sold_netto_weight",
                            "sold_gross_weight",
                            "refunded_netto_weight",
                            "refunded_gross_weight"
                          ]
                        },
                        "forecast": {
                          "type": "object",
                          "description": "Forecasted values for various metrics.",
                          "properties": {
                            "date": {
                              "type": "integer",
                              "description": "Date placeholder for the forecast."
                            },
                            "gross_sales": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted gross sales."
                            },
                            "refund": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted refunds."
                            },
                            "discount": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted discounts."
                            },
                            "gift": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted gift value."
                            },
                            "tax": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted tax amount."
                            },
                            "included_tax": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted included tax."
                            },
                            "added_tax": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted added tax."
                            },
                            "cost": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted cost of goods sold."
                            },
                            "net_sales": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted net sales."
                            },
                            "profit": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted profit."
                            },
                            "items_sold": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted number of items sold."
                            },
                            "items_refunded": {
                              "type": "integer",
                              "description": "Forecasted number of items refunded."
                            }
                          },
                          "required": [
                            "date",
                            "gross_sales",
                            "refund",
                            "discount",
                            "gift",
                            "tax",
                            "included_tax",
                            "added_tax",
                            "cost",
                            "net_sales",
                            "profit",
                            "items_sold",
                            "items_refunded"
                          ]
                        }
                      },
                      "required": [
                        "total",
                        "data",
                        "total_data",
                        "forecast"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/sales/by-item": {
      "post": {
        "tags": [
          "Report"
        ],
        "description": "Report summary by-item",
        "operationId": "report-by-item",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1summary~1chart/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "description": "An array of product sales report entries.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "_id": {
                                "type": "string",
                                "format": "mongo-id",
                                "description": "The unique identifier of the product."
                              },
                              "product": {
                                "type": "object",
                                "description": "Details about the product.",
                                "properties": {
                                  "name": {
                                    "type": "string",
                                    "description": "The name of the product."
                                  },
                                  "sku": {
                                    "type": "string",
                                    "description": "The Stock Keeping Unit (SKU) of the product."
                                  }
                                },
                                "required": [
                                  "name",
                                  "sku"
                                ]
                              },
                              "net_sales": {
                                "type": "number",
                                "format": "float",
                                "description": "The total net sales for this product."
                              },
                              "chart": {
                                "type": "array",
                                "description": "Historical sales data points for the product.",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "date": {
                                      "type": "string",
                                      "format": "date-time",
                                      "description": "The date of the sales data point in ISO 8601 format."
                                    },
                                    "value": {
                                      "type": "number",
                                      "format": "float",
                                      "description": "The sales value for that specific date."
                                    }
                                  },
                                  "required": [
                                    "date",
                                    "value"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "_id",
                              "product",
                              "net_sales",
                              "chart"
                            ]
                          }
                        }
                      },
                      "required": [
                        "data"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/sales/by-customer-pagin": {
      "post": {
        "tags": [
          "Report"
        ],
        "description": "Report summary by-customer-pagin",
        "operationId": "report-by-customer-pagin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1summary~1chart-pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "description": "The total number of customer entries in the report."
                        },
                        "data": {
                          "type": "array",
                          "description": "An array of individual customer report entries.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "_id": {
                                "type": "string",
                                "format": "mongo-id",
                                "description": "The unique identifier of the customer report entry."
                              },
                              "customer_id": {
                                "type": "string",
                                "format": "mongo-id",
                                "description": "The ID of the customer."
                              },
                              "customer_category_id": {
                                "type": "string",
                                "format": "mongo-id",
                                "description": "The ID of the customer's category."
                              },
                              "gross_sales": {
                                "type": "number",
                                "format": "float",
                                "description": "Total gross sales from this customer."
                              },
                              "refund": {
                                "type": "number",
                                "format": "float",
                                "description": "Total refunds for this customer."
                              },
                              "discount": {
                                "type": "number",
                                "format": "float",
                                "description": "Total discounts given to this customer."
                              },
                              "included_tax": {
                                "type": "number",
                                "format": "float",
                                "description": "Total included tax from this customer's sales."
                              },
                              "added_tax": {
                                "type": "number",
                                "format": "float",
                                "description": "Total added tax from this customer's sales."
                              },
                              "gift": {
                                "type": "number",
                                "format": "float",
                                "description": "Total value of gifts given to this customer."
                              },
                              "net_sales": {
                                "type": "number",
                                "format": "float",
                                "description": "Total net sales from this customer."
                              },
                              "profit": {
                                "type": "number",
                                "format": "float",
                                "description": "Total profit from this customer."
                              },
                              "receipts": {
                                "type": "integer",
                                "description": "Total number of receipts for this customer."
                              },
                              "refunds": {
                                "type": "integer",
                                "description": "Total number of refunds for this customer."
                              },
                              "sale_contracts": {
                                "type": "integer",
                                "description": "Total number of sales contracts with this customer."
                              },
                              "customer": {
                                "type": "object",
                                "description": "Detailed information about the customer.",
                                "properties": {
                                  "_id": {
                                    "type": "string",
                                    "format": "mongo-id",
                                    "description": "The unique identifier of the customer."
                                  },
                                  "is_deleted": {
                                    "type": "boolean",
                                    "description": "Indicates if the customer is marked as deleted."
                                  },
                                  "is_archived": {
                                    "type": "boolean",
                                    "description": "Indicates if the customer is archived."
                                  },
                                  "created_at": {
                                    "type": "string",
                                    "format": "date-time",
                                    "description": "Timestamp when the customer record was created."
                                  },
                                  "updated_at": {
                                    "type": "string",
                                    "format": "date-time",
                                    "description": "Timestamp when the customer record was last updated."
                                  },
                                  "completely_deleted": {
                                    "type": "boolean",
                                    "description": "Indicates if the customer is completely deleted."
                                  },
                                  "type": {
                                    "type": "string",
                                    "description": "Type of customer (e.g., 'natural')."
                                  },
                                  "number": {
                                    "type": "string",
                                    "description": "Customer number."
                                  },
                                  "state": {
                                    "type": "string",
                                    "description": "Current state of the customer (e.g., 'new')."
                                  },
                                  "name": {
                                    "type": "string",
                                    "description": "Name of the customer."
                                  },
                                  "phone_number": {
                                    "type": "string",
                                    "description": "Primary phone number of the customer."
                                  },
                                  "phone_numbers": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    },
                                    "description": "Additional phone numbers of the customer."
                                  },
                                  "organization_ids": {
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "format": "mongo-id"
                                    },
                                    "description": "List of organization IDs associated with the customer."
                                  },
                                  "total_sale": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "Total sales amount for the customer."
                                  },
                                  "avg_sale": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "Average sale amount for the customer."
                                  },
                                  "avg_product": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "Average product count per sale for the customer."
                                  },
                                  "total_spent": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "Total amount spent by the customer."
                                  },
                                  "point": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "Loyalty points of the customer."
                                  },
                                  "balance": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "Current balance of the customer."
                                  },
                                  "refund": {
                                    "type": "number",
                                    "format": "float",
                                    "description": "Total refund amount for the customer."
                                  },
                                  "queue_status": {
                                    "type": "string",
                                    "description": "Queue status of the customer."
                                  },
                                  "person_id": {
                                    "type": "string",
                                    "format": "mongo-id",
                                    "description": "Person ID associated with the customer."
                                  },
                                  "used_count": {
                                    "type": "integer",
                                    "description": "Number of times the customer record has been used."
                                  },
                                  "created_from_bot": {
                                    "type": "boolean",
                                    "description": "Indicates if the customer was created from a bot."
                                  },
                                  "balance_action": {
                                    "type": "string",
                                    "description": "Action related to customer balance (e.g., 'separated')."
                                  },
                                  "custom_fields": {
                                    "type": "array",
                                    "items": {},
                                    "description": "Custom fields for the customer."
                                  },
                                  "__v": {
                                    "type": "integer",
                                    "description": "Version key."
                                  },
                                  "telegram_id": {
                                    "type": "integer",
                                    "description": "Telegram ID of the customer."
                                  },
                                  "locale": {
                                    "type": "string",
                                    "description": "Locale of the customer (e.g., 'uz')."
                                  },
                                  "balance_currency_id": {
                                    "type": "string",
                                    "format": "mongo-id",
                                    "description": "Currency ID for the customer's balance."
                                  },
                                  "balances": {
                                    "type": "object",
                                    "description": "Balances across different organizations.",
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "balance": {
                                          "type": "number",
                                          "format": "float"
                                        },
                                        "balance_currency_id": {
                                          "type": "string",
                                          "format": "mongo-id"
                                        }
                                      },
                                      "required": [
                                        "balance",
                                        "balance_currency_id"
                                      ]
                                    }
                                  },
                                  "first_sale_at": {
                                    "type": "string",
                                    "format": "date-time",
                                    "description": "Timestamp of the first sale to this customer."
                                  },
                                  "first_sale_id": {
                                    "type": "string",
                                    "format": "mongo-id",
                                    "description": "ID of the first sale to this customer."
                                  },
                                  "first_sale_uuid": {
                                    "type": "string",
                                    "description": "UUID of the first sale to this customer."
                                  },
                                  "last_sale_at": {
                                    "type": "string",
                                    "format": "date-time",
                                    "description": "Timestamp of the last sale to this customer."
                                  },
                                  "last_sale_id": {
                                    "type": "string",
                                    "format": "mongo-id",
                                    "description": "ID of the last sale to this customer."
                                  },
                                  "last_sale_uuid": {
                                    "type": "string",
                                    "description": "UUID of the last sale to this customer."
                                  },
                                  "organizations": {
                                    "type": "object",
                                    "description": "Sales data grouped by organization for this customer.",
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "first_sale_at": {
                                          "type": "string",
                                          "format": "date-time"
                                        },
                                        "first_sale_id": {
                                          "type": "string",
                                          "format": "mongo-id"
                                        },
                                        "first_sale_uuid": {
                                          "type": "string"
                                        },
                                        "last_sale_at": {
                                          "type": "string",
                                          "format": "date-time"
                                        },
                                        "last_sale_id": {
                                          "type": "string",
                                          "format": "mongo-id"
                                        },
                                        "last_sale_uuid": {
                                          "type": "string"
                                        },
                                        "total_sale": {
                                          "type": "number",
                                          "format": "float"
                                        }
                                      },
                                      "required": [
                                        "first_sale_at",
                                        "first_sale_id",
                                        "first_sale_uuid",
                                        "last_sale_at",
                                        "last_sale_id",
                                        "last_sale_uuid",
                                        "total_sale"
                                      ]
                                    }
                                  },
                                  "updated_by": {
                                    "type": "string",
                                    "format": "mongo-id",
                                    "description": "ID of the user who last updated the customer record."
                                  },
                                  "category_id": {
                                    "type": "string",
                                    "format": "mongo-id",
                                    "description": "Category ID of the customer."
                                  },
                                  "send_notification": {
                                    "type": "boolean",
                                    "description": "Indicates if notifications are sent to this customer."
                                  },
                                  "created_by": {
                                    "type": "string",
                                    "format": "mongo-id",
                                    "description": "ID of the user who created the customer record."
                                  },
                                  "delivery_address": {
                                    "type": "object",
                                    "description": "Delivery address details for the customer.",
                                    "properties": {
                                      "long": {
                                        "type": "number",
                                        "format": "float",
                                        "description": "Longitude of the delivery address."
                                      },
                                      "lat": {
                                        "type": "number",
                                        "format": "float",
                                        "description": "Latitude of the delivery address."
                                      },
                                      "human_address": {
                                        "type": "object",
                                        "properties": {
                                          "address": {
                                            "type": "string"
                                          },
                                          "city": {
                                            "type": "string"
                                          },
                                          "state": {
                                            "type": "string"
                                          },
                                          "zip": {
                                            "type": "string"
                                          },
                                          "_id": {
                                            "type": "string",
                                            "format": "mongo-id"
                                          }
                                        },
                                        "required": [
                                          "address",
                                          "city",
                                          "state",
                                          "zip",
                                          "_id"
                                        ]
                                      },
                                      "_id": {
                                        "type": "string",
                                        "format": "mongo-id"
                                      }
                                    },
                                    "required": [
                                      "long",
                                      "lat",
                                      "human_address",
                                      "_id"
                                    ]
                                  },
                                  "responsible_id": {
                                    "type": "string",
                                    "format": "mongo-id",
                                    "description": "ID of the responsible person for this customer."
                                  }
                                },
                                "required": [
                                  "_id",
                                  "is_deleted",
                                  "is_archived",
                                  "created_at",
                                  "updated_at",
                                  "completely_deleted",
                                  "type",
                                  "number",
                                  "state",
                                  "name",
                                  "phone_number",
                                  "phone_numbers",
                                  "organization_ids",
                                  "total_sale",
                                  "avg_sale",
                                  "avg_product",
                                  "total_spent",
                                  "point",
                                  "balance",
                                  "refund",
                                  "queue_status",
                                  "person_id",
                                  "used_count",
                                  "created_from_bot",
                                  "balance_action",
                                  "custom_fields",
                                  "__v",
                                  "telegram_id",
                                  "locale",
                                  "balance_currency_id",
                                  "balances",
                                  "first_sale_at",
                                  "first_sale_id",
                                  "first_sale_uuid",
                                  "last_sale_at",
                                  "last_sale_id",
                                  "last_sale_uuid",
                                  "organizations",
                                  "updated_by",
                                  "category_id",
                                  "send_notification",
                                  "created_by",
                                  "delivery_address",
                                  "responsible_id"
                                ]
                              },
                              "customer_category": {
                                "type": "object",
                                "description": "Details about the customer's category.",
                                "properties": {
                                  "_id": {
                                    "type": "string",
                                    "format": "mongo-id",
                                    "description": "The unique identifier of the customer category."
                                  },
                                  "is_deleted": {
                                    "type": "boolean",
                                    "description": "Indicates if the category is marked as deleted."
                                  },
                                  "is_archived": {
                                    "type": "boolean",
                                    "description": "Indicates if the category is archived."
                                  },
                                  "created_by": {
                                    "type": "string",
                                    "format": "mongo-id",
                                    "description": "ID of the user who created the category."
                                  },
                                  "created_at": {
                                    "type": "string",
                                    "format": "date-time",
                                    "description": "Timestamp when the category was created."
                                  },
                                  "updated_at": {
                                    "type": "string",
                                    "format": "date-time",
                                    "description": "Timestamp when the category was last updated."
                                  },
                                  "completely_deleted": {
                                    "type": "boolean",
                                    "description": "Indicates if the category is completely deleted."
                                  },
                                  "name": {
                                    "type": "string",
                                    "description": "Name of the customer category."
                                  },
                                  "organization_ids": {
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "format": "mongo-id"
                                    },
                                    "description": "List of organization IDs associated with this category."
                                  },
                                  "child_count": {
                                    "type": "integer",
                                    "description": "Number of child categories."
                                  },
                                  "item_count": {
                                    "type": "integer",
                                    "description": "Number of items in this category."
                                  },
                                  "__v": {
                                    "type": "integer",
                                    "description": "Version key."
                                  }
                                },
                                "required": [
                                  "_id",
                                  "is_deleted",
                                  "is_archived",
                                  "created_by",
                                  "created_at",
                                  "updated_at",
                                  "completely_deleted",
                                  "name",
                                  "organization_ids",
                                  "child_count",
                                  "item_count",
                                  "__v"
                                ]
                              },
                              "average_sale": {
                                "type": "number",
                                "format": "float",
                                "description": "Average sale amount per receipt for this customer."
                              }
                            },
                            "required": [
                              "_id",
                              "customer_id",
                              "customer_category_id",
                              "gross_sales",
                              "refund",
                              "discount",
                              "included_tax",
                              "added_tax",
                              "gift",
                              "net_sales",
                              "profit",
                              "receipts",
                              "refunds",
                              "sale_contracts",
                              "customer",
                              "customer_category",
                              "average_sale"
                            ]
                          }
                        },
                        "forecast": {
                          "type": "object",
                          "description": "Forecasted sales data for customers.",
                          "properties": {
                            "gross_sales": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted gross sales."
                            },
                            "refund": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted refunds."
                            },
                            "discount": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted discounts."
                            },
                            "included_tax": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted included tax."
                            },
                            "added_tax": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted added tax."
                            },
                            "gift": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted gift value."
                            },
                            "net_sales": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted net sales."
                            },
                            "profit": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted profit."
                            },
                            "receipts": {
                              "type": "integer",
                              "description": "Forecasted number of receipts."
                            },
                            "refunds": {
                              "type": "integer",
                              "description": "Forecasted number of refunds."
                            },
                            "sale_contracts": {
                              "type": "integer",
                              "description": "Forecasted number of sales contracts."
                            },
                            "average_sale": {
                              "type": "number",
                              "format": "float",
                              "description": "Forecasted average sale amount."
                            }
                          },
                          "required": [
                            "gross_sales",
                            "refund",
                            "discount",
                            "included_tax",
                            "added_tax",
                            "gift",
                            "net_sales",
                            "profit",
                            "receipts",
                            "refunds",
                            "sale_contracts",
                            "average_sale"
                          ]
                        },
                        "total_amounts": {
                          "type": "object",
                          "description": "Aggregated total sales data for all customers.",
                          "properties": {
                            "_id": {
                              "type": "object",
                              "nullable": true,
                              "description": "Placeholder for aggregation ID, typically null for overall totals."
                            },
                            "gross_sales": {
                              "type": "number",
                              "format": "float",
                              "description": "Total gross sales across all customers."
                            },
                            "refund": {
                              "type": "number",
                              "format": "float",
                              "description": "Total refunds across all customers."
                            },
                            "discount": {
                              "type": "number",
                              "format": "float",
                              "description": "Total discounts across all customers."
                            },
                            "included_tax": {
                              "type": "number",
                              "format": "float",
                              "description": "Total included tax across all customers."
                            },
                            "added_tax": {
                              "type": "number",
                              "format": "float",
                              "description": "Total added tax across all customers."
                            },
                            "gift": {
                              "type": "number",
                              "format": "float",
                              "description": "Total value of gifts across all customers."
                            },
                            "net_sales": {
                              "type": "number",
                              "format": "float",
                              "description": "Total net sales across all customers."
                            },
                            "profit": {
                              "type": "number",
                              "format": "float",
                              "description": "Total profit across all customers."
                            },
                            "receipts": {
                              "type": "integer",
                              "description": "Total number of receipts across all customers."
                            },
                            "refunds": {
                              "type": "integer",
                              "description": "Total number of refunds across all customers."
                            },
                            "sale_contracts": {
                              "type": "integer",
                              "description": "Total number of sales contracts across all customers."
                            },
                            "average_sale": {
                              "type": "number",
                              "format": "float",
                              "description": "Average sale amount per receipt across all customers."
                            }
                          },
                          "required": [
                            "gross_sales",
                            "refund",
                            "discount",
                            "included_tax",
                            "added_tax",
                            "gift",
                            "net_sales",
                            "profit",
                            "receipts",
                            "refunds",
                            "sale_contracts",
                            "average_sale"
                          ]
                        }
                      },
                      "required": [
                        "total",
                        "data",
                        "forecast",
                        "total_amounts"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/reports/trade/pagin": {
      "post": {
        "tags": [
          "Report-sales"
        ],
        "description": "Paginated list of trades for the reporting window.",
        "operationId": "report-sales-trade-pagin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "list": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "description": "Row shape depends on the specific report endpoint.",
                                "additionalProperties": true
                              }
                            },
                            "total": {
                              "type": "number"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/reports/trade/by-product/pagin": {
      "post": {
        "tags": [
          "Report-sales"
        ],
        "description": "Trade aggregation grouped by product.",
        "operationId": "report-sales-trade-by-product-pagin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/trade/by-customer/pagin": {
      "post": {
        "tags": [
          "Report-sales"
        ],
        "description": "Trade aggregation grouped by customer.",
        "operationId": "report-sales-trade-by-customer-pagin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/trade/items/pagin": {
      "post": {
        "tags": [
          "Report-sales"
        ],
        "description": "Paginated list of individual trade line items.",
        "operationId": "report-sales-trade-items-pagin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/sales/items/unsold-paging": {
      "post": {
        "tags": [
          "Report-sales"
        ],
        "description": "Products that have not been sold in the reporting window.",
        "operationId": "report-sales-items-unsold-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/sales/by-employee-pagin": {
      "post": {
        "tags": [
          "Report-sales"
        ],
        "description": "Sales aggregated by employee (salesperson).",
        "operationId": "report-sales-by-employee-pagin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/sales/by-payment-method-pagin": {
      "post": {
        "tags": [
          "Report-sales"
        ],
        "description": "Sales aggregated by payment method.",
        "operationId": "report-sales-by-payment-method-pagin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/sales/by-category-pagin": {
      "post": {
        "tags": [
          "Report-sales"
        ],
        "description": "Sales aggregated by product category.",
        "operationId": "report-sales-by-category-pagin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/sales/by-category-all": {
      "post": {
        "tags": [
          "Report-sales"
        ],
        "description": "Sales aggregated by category (full / non-paged variant).",
        "operationId": "report-sales-by-category-all",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/sales/by-mediator-pagin": {
      "post": {
        "tags": [
          "Report-sales"
        ],
        "description": "Sales aggregated by mediator (broker / referrer).",
        "operationId": "report-sales-by-mediator-pagin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/sales/by-supplier-pagin": {
      "post": {
        "tags": [
          "Report-sales"
        ],
        "description": "Sales aggregated by supplier (for products sourced from each supplier).",
        "operationId": "report-sales-by-supplier-pagin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/sales/settlements": {
      "post": {
        "tags": [
          "Report-sales"
        ],
        "description": "Sales settlements report (cash-vs-bank / settlement reconciliation).",
        "operationId": "report-sales-settlements",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/balance/get": {
      "post": {
        "tags": [
          "Report-finance"
        ],
        "description": "Current cashbox / account balance snapshot.",
        "operationId": "report-finance-balance-get",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "date_from": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Start of the reporting window."
                  },
                  "date_to": {
                    "type": "string",
                    "format": "date-time",
                    "description": "End of the reporting window."
                  },
                  "organization_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "example": "64b7f4d9e2b3b6a0b7c5d80a"
                    }
                  },
                  "warehouse_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "currency_id": {
                    "type": "string"
                  },
                  "responsible_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "customer_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "supplier_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "product_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "category_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "payment_method_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "sort_by": {
                    "type": "string",
                    "description": "Field name to sort by."
                  },
                  "sort_order": {
                    "type": "string",
                    "enum": [
                      "asc",
                      "desc"
                    ],
                    "default": "desc"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "description": "Aggregated metrics. Shape depends on the specific report endpoint.",
                          "additionalProperties": true
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/reports/balance/get-at": {
      "post": {
        "tags": [
          "Report-finance"
        ],
        "description": "Balance at a specific point in time.",
        "operationId": "report-finance-balance-get-at",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "at": {
                        "type": "string",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "at"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/balance/items": {
      "post": {
        "tags": [
          "Report-finance"
        ],
        "description": "Per-currency / per-account balance breakdown.",
        "operationId": "report-finance-balance-items",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/cashflow/get": {
      "post": {
        "tags": [
          "Report-finance"
        ],
        "description": "Cashflow report for the reporting window (in + out + net).",
        "operationId": "report-finance-cashflow-get",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/customer-debt/get": {
      "post": {
        "tags": [
          "Report-finance"
        ],
        "description": "Aggregate of outstanding customer debt.",
        "operationId": "report-finance-customer-debt-get",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/profit-loss/get": {
      "post": {
        "tags": [
          "Report-finance"
        ],
        "description": "P&L report (revenue, COGS, expenses, net profit).",
        "operationId": "report-finance-profit-loss-get",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/finance/installment-plan/get-summary": {
      "post": {
        "tags": [
          "Report-finance"
        ],
        "description": "Summary of installment-plan installments (debt, paid, due).",
        "operationId": "report-finance-installment-plan-get-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/finance/installment-plan/get-paging": {
      "post": {
        "tags": [
          "Report-finance"
        ],
        "description": "Paginated list of installment plans.",
        "operationId": "report-finance-installment-plan-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/finance/installment-plan/completed": {
      "post": {
        "tags": [
          "Report-finance"
        ],
        "description": "Completed installment plans within the reporting window.",
        "operationId": "report-finance-installment-plan-completed",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/finance/customers-payment-overview/get-summary": {
      "post": {
        "tags": [
          "Report-finance"
        ],
        "description": "Aggregate payment-overview metrics per customer.",
        "operationId": "report-finance-customers-payment-overview-get-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/finance/customers-payment-overview/get-paging": {
      "post": {
        "tags": [
          "Report-finance"
        ],
        "description": "Paginated payment-overview rows per customer.",
        "operationId": "report-finance-customers-payment-overview-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/finance/customers-payment-overview/completed": {
      "post": {
        "tags": [
          "Report-finance"
        ],
        "description": "Customers whose payment plan completed in the window.",
        "operationId": "report-finance-customers-payment-overview-completed",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/summary/income/pagin": {
      "post": {
        "tags": [
          "Report-finance"
        ],
        "description": "Paginated income summary rows.",
        "operationId": "report-finance-summary-income-pagin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/summary/income-expense/stats": {
      "post": {
        "tags": [
          "Report-finance"
        ],
        "description": "Aggregate income/expense statistics for the window.",
        "operationId": "report-finance-summary-income-expense-stats",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/production/by-product": {
      "post": {
        "tags": [
          "Report-production"
        ],
        "description": "Manufacturing output aggregated by product.",
        "operationId": "report-production-by-product",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/production/by-responsible": {
      "post": {
        "tags": [
          "Report-production"
        ],
        "description": "Manufacturing output aggregated by responsible user.",
        "operationId": "report-production-by-responsible",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/production/by-responsible-and-product": {
      "post": {
        "tags": [
          "Report-production"
        ],
        "description": "Manufacturing output aggregated by (responsible, product) pair.",
        "operationId": "report-production-by-responsible-and-product",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/production/recommended-to-be-used": {
      "post": {
        "tags": [
          "Report-production"
        ],
        "description": "Recommended raw-materials to use for upcoming production based on stock + open orders.",
        "operationId": "report-production-recommended-to-be-used",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/distribution/get-summary": {
      "post": {
        "tags": [
          "Report-distribution"
        ],
        "description": "Aggregate distribution KPIs for the window (orders, deliveries, revenue).",
        "operationId": "report-distribution-get-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/distribution/get-by-product-category": {
      "post": {
        "tags": [
          "Report-distribution"
        ],
        "description": "Distribution volume grouped by product category.",
        "operationId": "report-distribution-get-by-product-category",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/distribution/get-by-agent-and-type": {
      "post": {
        "tags": [
          "Report-distribution"
        ],
        "description": "Distribution metrics grouped by (agent, distribution type).",
        "operationId": "report-distribution-get-by-agent-and-type",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/distribution/get-by-agent": {
      "post": {
        "tags": [
          "Report-distribution"
        ],
        "description": "Distribution metrics aggregated by agent (sales rep).",
        "operationId": "report-distribution-get-by-agent",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/summary/debt/paging": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Paginated debt rows for the dashboard summary card.",
        "operationId": "report-dashboard-summary-debt-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/summary/credit/paging": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Paginated credit rows for the dashboard summary card.",
        "operationId": "report-dashboard-summary-credit-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/customers/health-score/charts": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Customer health-score time series for charts.",
        "operationId": "report-dashboard-customers-health-score-charts",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1dashboard~1chart/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/customers/health-score/summary": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Aggregate customer health-score summary (good / warning / churn-risk counts).",
        "operationId": "report-dashboard-customers-health-score-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/dashboard/summary": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Main dashboard KPI summary (sales, expenses, profit, top-line counters).",
        "operationId": "report-dashboard-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/dashboard/chart": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Main dashboard time-series chart data.",
        "operationId": "report-dashboard-chart",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "label": {
                                "type": "string",
                                "description": "Bucket label (date / category / etc.)."
                              },
                              "value": {
                                "type": "number"
                              }
                            },
                            "additionalProperties": true
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/reports/dashboard/top/{key}": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Top-N entities ranked by the given key (e.g. products / customers / employees).",
        "operationId": "report-dashboard-top",
        "parameters": [
          {
            "name": "key",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "example": "product"
            },
            "description": "Top-N grouping key: product, customer, employee, category, payment_method, etc."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/order/dashboard/summary": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Sale-order dashboard KPI summary.",
        "operationId": "report-dashboard-order-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/order/dashboard/chart": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Sale-order dashboard time-series chart.",
        "operationId": "report-dashboard-order-chart",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1dashboard~1chart/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/order/dashboard/states": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Sale-order count by state (new / in-progress / done / canceled).",
        "operationId": "report-dashboard-order-states",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/order/dashboard/top/{key}": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Top-N for the sale-order dashboard, by the given key.",
        "operationId": "report-dashboard-order-top",
        "parameters": [
          {
            "name": "key",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "example": "product"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/summary/chart": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "POS summary chart (sales + income + expense combined time series).",
        "operationId": "report-pos-summary-chart",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1dashboard~1chart/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/summary/sale/chart": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "POS sales chart over the reporting window.",
        "operationId": "report-pos-summary-sale-chart",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1dashboard~1chart/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/summary/income/chart": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "POS income chart over the reporting window.",
        "operationId": "report-pos-summary-income-chart",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1dashboard~1chart/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/summary/expense/chart": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "POS expense chart over the reporting window.",
        "operationId": "report-pos-summary-expense-chart",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1dashboard~1chart/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/summary/debt/get-summary": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Aggregate POS-issued customer debt.",
        "operationId": "report-pos-summary-debt-get-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/summary/credit/get-summary": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Aggregate POS-issued customer credit.",
        "operationId": "report-pos-summary-credit-get-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/summary/debt/paging": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Paginated POS debt rows.",
        "operationId": "report-pos-summary-debt-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/summary/credit/paging": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Paginated POS credit rows.",
        "operationId": "report-pos-summary-credit-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/summary/product/get-summary": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Aggregate POS product (finished-goods) summary.",
        "operationId": "report-pos-summary-product-get-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/summary/material/get-summary": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Aggregate POS material (raw-material) summary.",
        "operationId": "report-pos-summary-material-get-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/summary/semi-product/get-summary": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Aggregate POS semi-product (work-in-progress) summary.",
        "operationId": "report-pos-summary-semi-product-get-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/summary/product/chart-paging": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Paginated POS product chart data.",
        "operationId": "report-pos-summary-product-chart-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/summary/material/chart-paging": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Paginated POS material chart data.",
        "operationId": "report-pos-summary-material-chart-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/summary/semi-product/chart-paging": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Paginated POS semi-product chart data.",
        "operationId": "report-pos-summary-semi-product-chart-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/summary/goods/by-price/total": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Total goods valuation grouped by price.",
        "operationId": "report-pos-summary-goods-by-price-total",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/summary/goods/by-price/paging": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Paginated goods rows grouped by price.",
        "operationId": "report-pos-summary-goods-by-price-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/sales/by-payment-method-paging": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "POS sales aggregated by payment method.",
        "operationId": "report-pos-sales-by-payment-method-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/cashbox/income-expense": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Cashbox income vs expense rollup for the POS.",
        "operationId": "report-pos-cashbox-income-expense",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/sale/summary": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "POS sale summary (aggregate KPIs).",
        "operationId": "report-pos-sale-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/sale/summary/chart": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "POS sale summary chart time series.",
        "operationId": "report-pos-sale-summary-chart",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1dashboard~1chart/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/product/top": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Top-N best-selling products in the POS.",
        "operationId": "report-pos-product-top",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/employee/top": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Top-N best-performing employees in the POS.",
        "operationId": "report-pos-employee-top",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/product/stock/summary": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Product stock summary across the POS.",
        "operationId": "report-pos-product-stock-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/production/by-product/produced": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Manufacturing 'produced' totals grouped by product.",
        "operationId": "report-pos-production-by-product-produced",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/production/by-product/used": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Manufacturing 'used' totals grouped by product (raw materials).",
        "operationId": "report-pos-production-by-product-used",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/cashflow/get": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Cashflow report scoped to the POS.",
        "operationId": "report-pos-cashflow-get",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/finance/installment/get-summary": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Installment summary for POS-issued sales.",
        "operationId": "report-pos-finance-installment-get-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/finance/installment/get-paging": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Paginated installment rows for POS-issued sales.",
        "operationId": "report-pos-finance-installment-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/finance/installment/completed": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Installments completed in the reporting window (POS).",
        "operationId": "report-pos-finance-installment-completed",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/dashboard/top/{key}": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "Top-N for the POS dashboard, by the given key.",
        "operationId": "report-pos-dashboard-top",
        "parameters": [
          {
            "name": "key",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "example": "product"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/pos/trade/by-product/pagin": {
      "post": {
        "tags": [
          "Report-pos"
        ],
        "description": "POS trade rollup grouped by product.",
        "operationId": "report-pos-trade-by-product-pagin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/summary/debt/get-summary": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Aggregate customer-debt summary for the dashboard card.",
        "operationId": "report-dashboard-summary-debt-get-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/summary/credit/get-summary": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Aggregate customer-credit summary for the dashboard card.",
        "operationId": "report-dashboard-summary-credit-get-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/summary/goods/by-price/total": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Total goods valuation grouped by price (dashboard card).",
        "operationId": "report-dashboard-summary-goods-by-price-total",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/summary/product/chart-paging": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Paginated product chart rows for the dashboard.",
        "operationId": "report-dashboard-summary-product-chart-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/summary/product/get-summary": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Aggregate product summary for the dashboard card.",
        "operationId": "report-dashboard-summary-product-get-summary",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/summary/sale/chart": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Sale chart time series for the dashboard.",
        "operationId": "report-dashboard-summary-sale-chart",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1dashboard~1chart/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/trade/customer/chart": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Trade-by-customer chart time series for the dashboard.",
        "operationId": "report-dashboard-trade-customer-chart",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1dashboard~1chart/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/trade/customer/health-score": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Customer health-score rollup based on trade history.",
        "operationId": "report-dashboard-trade-customer-health-score",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/trade/price-deviation/paging": {
      "post": {
        "tags": [
          "Report-dashboard"
        ],
        "description": "Paginated rows of trades where the sold price deviates from the configured price list.",
        "operationId": "report-dashboard-trade-price-deviation-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/analysis/abc/by-month": {
      "post": {
        "tags": [
          "Report-analysis"
        ],
        "description": "ABC analysis aggregated by month — classifies products into A/B/C buckets by contribution to revenue.",
        "operationId": "report-analysis-abc-by-month",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/analysis/abc/by-product": {
      "post": {
        "tags": [
          "Report-analysis"
        ],
        "description": "ABC analysis aggregated by product over the reporting window.",
        "operationId": "report-analysis-abc-by-product",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/analysis/customers/abc-xyz": {
      "post": {
        "tags": [
          "Report-analysis"
        ],
        "description": "ABC/XYZ analysis on customers — combines revenue contribution (ABC) with demand variability (XYZ).",
        "operationId": "report-analysis-customers-abc-xyz",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/in-stock/get": {
      "post": {
        "tags": [
          "Report-warehouse"
        ],
        "description": "Current in-stock summary across selected warehouses.",
        "operationId": "report-warehouse-in-stock-get",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1balance~1get/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1balance~1get/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/items/warehouse": {
      "post": {
        "tags": [
          "Report-warehouse"
        ],
        "description": "Per-item stock levels by warehouse.",
        "operationId": "report-warehouse-items-warehouse",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/transfer/get-items": {
      "post": {
        "tags": [
          "Report-warehouse"
        ],
        "description": "Items moved via warehouse transfers in the reporting window.",
        "operationId": "report-warehouse-transfer-get-items",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/transfer/get-paging": {
      "post": {
        "tags": [
          "Report-warehouse"
        ],
        "description": "Paginated list of warehouse transfers.",
        "operationId": "report-warehouse-transfer-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/reports/write-off/by-reason/get-paging": {
      "post": {
        "tags": [
          "Report-warehouse"
        ],
        "description": "Write-offs grouped by reason (damaged, expired, lost, etc.).",
        "operationId": "report-warehouse-write-off-by-reason-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1reports~1trade~1pagin/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1reports~1trade~1pagin/post/responses/200/content/application~1json/schema"
                }
              }
            }
          }
        }
      }
    },
    "/internal-transfer/create": {
      "post": {
        "tags": [
          "Internal-transfer"
        ],
        "description": "Create a new internal transfer between warehouses or production steps.",
        "operationId": "internal-transfer-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "source_organization_id",
                  "type",
                  "date",
                  "shipping_date",
                  "sender_employee_id",
                  "reason_id",
                  "products"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "Optional human-readable reference code"
                  },
                  "request_id": {
                    "type": "string",
                    "description": "Linked transfer-request ObjectId (optional)"
                  },
                  "source_organization_id": {
                    "type": "string",
                    "description": "Organization ObjectId that owns this transfer"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "w2w",
                      "w2p",
                      "p2w",
                      "p2p",
                      "o2o"
                    ],
                    "description": "Transfer type: w2w=warehouse-to-warehouse, w2p=warehouse-to-production, p2w=production-to-warehouse, p2p=production-to-production, o2o=organization-to-organization"
                  },
                  "date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Transfer document date (ISO 8601)"
                  },
                  "shipping_date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Planned shipping date (ISO 8601)"
                  },
                  "sender_warehouse_id": {
                    "type": "string",
                    "description": "Source warehouse ObjectId. Required when type is w2w or w2p."
                  },
                  "receiver_warehouse_id": {
                    "type": "string",
                    "description": "Destination warehouse ObjectId. Required when type is p2w or w2w."
                  },
                  "sender_employee_id": {
                    "type": "string",
                    "description": "Employee ObjectId responsible for sending"
                  },
                  "receiver_employee_id": {
                    "type": "string",
                    "description": "Employee ObjectId responsible for receiving (optional)"
                  },
                  "reason_id": {
                    "type": "string",
                    "description": "Transfer reason ObjectId"
                  },
                  "price_id": {
                    "type": "string",
                    "description": "Price list ObjectId (optional)"
                  },
                  "note": {
                    "type": "string",
                    "description": "Free-text note (optional)"
                  },
                  "products": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": [
                        "product_id",
                        "amount"
                      ],
                      "properties": {
                        "product_id": {
                          "type": "string",
                          "description": "Product ObjectId"
                        },
                        "amount": {
                          "type": "number",
                          "description": "Transfer quantity (must be positive)"
                        },
                        "box_count": {
                          "type": "number",
                          "description": "Number of boxes (integer, defaults to 0)"
                        },
                        "box_item": {
                          "type": "number",
                          "description": "Items per box (optional)"
                        },
                        "marks": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Serial / excise mark codes for marked goods"
                        },
                        "expiration_date": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Expiration date (ISO 8601) for perishable items"
                        },
                        "extra_costs": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          },
                          "description": "Per-product extra cost allocations"
                        },
                        "used_measure": {
                          "type": "object",
                          "description": "Override measure ratio if different from the product default",
                          "properties": {
                            "measure_id": {
                              "type": "string"
                            },
                            "ratio": {
                              "type": "number"
                            }
                          }
                        }
                      }
                    },
                    "description": "List of products to transfer (at least one required)"
                  },
                  "additional_costs": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    },
                    "description": "Additional costs applied to the whole transfer (defaults to [])"
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        }
                      }
                    },
                    "description": "File attachments (optional)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created internal transfer",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "allOf": [
                            {
                              "$ref": "#/paths/~1internal-transfer~1create/post/requestBody/content/application~1json/schema"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Internal transfer ObjectId"
                                },
                                "status": {
                                  "type": "string",
                                  "enum": [
                                    "draft",
                                    "new",
                                    "accepted",
                                    "in_progress",
                                    "done",
                                    "canceled"
                                  ],
                                  "description": "Current transfer state"
                                },
                                "state_id": {
                                  "type": "string",
                                  "description": "Custom kanban state ObjectId (when a custom pipeline column is used)"
                                },
                                "is_deleted": {
                                  "type": "boolean",
                                  "description": "Soft-delete flag"
                                },
                                "created_at": {
                                  "type": "string",
                                  "format": "date-time",
                                  "description": "Creation timestamp (ISO 8601)"
                                },
                                "updated_at": {
                                  "type": "string",
                                  "format": "date-time",
                                  "description": "Last update timestamp (ISO 8601)"
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/internal-transfer/get-by-id/{id}": {
      "get": {
        "tags": [
          "Internal-transfer"
        ],
        "description": "Fetch a single internal transfer by ObjectId.",
        "operationId": "internal-transfer-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Internal-transfer ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The internal transfer",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1internal-transfer~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/internal-transfer/get-paging": {
      "post": {
        "tags": [
          "Internal-transfer"
        ],
        "description": "Paginated list of internal transfers, filterable by organization, warehouse, state, and reason.",
        "operationId": "internal-transfer-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "source_organization_id": {
                        "type": "string",
                        "description": "Filter by source organization ObjectId"
                      },
                      "sender_warehouse_id": {
                        "type": "string",
                        "description": "Filter by sender warehouse ObjectId"
                      },
                      "receiver_warehouse_id": {
                        "type": "string",
                        "description": "Filter by receiver warehouse ObjectId"
                      },
                      "states": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "draft",
                            "new",
                            "accepted",
                            "in_progress",
                            "done",
                            "canceled"
                          ]
                        },
                        "description": "Filter by one or more transfer states"
                      },
                      "reason_id": {
                        "type": "string",
                        "description": "Filter by transfer reason ObjectId"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1internal-transfer~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/internal-transfer/update/{id}": {
      "put": {
        "tags": [
          "Internal-transfer"
        ],
        "description": "Update an existing internal transfer. Only transfers in NEW or DRAFT state may be updated.",
        "operationId": "internal-transfer-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Internal-transfer ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1internal-transfer~1create/post/requestBody/content/application~1json/schema"
                  }
                ],
                "description": "Same body as Create. The transfer ObjectId is supplied as the :id path parameter."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated internal transfer",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1internal-transfer~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/internal-transfer/set-status/{id}": {
      "put": {
        "tags": [
          "Internal-transfer"
        ],
        "description": "Drive a state transition on an internal transfer. Valid transitions: new→draft|canceled|accepted; draft→new; accepted→in_progress|canceled; in_progress→canceled; done→canceled.",
        "operationId": "internal-transfer-set-status",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Internal-transfer ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "status"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "new",
                      "accepted",
                      "in_progress",
                      "done",
                      "canceled"
                    ],
                    "description": "Target state. Valid transitions: new→draft|canceled|accepted; draft→new; accepted→in_progress|canceled; in_progress→canceled; done→canceled."
                  },
                  "reason": {
                    "type": "string",
                    "description": "Optional human-readable reason for the transition (informational only, not persisted)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The transfer after the state change",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1internal-transfer~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/internal-transfer/receive/{id}": {
      "put": {
        "tags": [
          "Internal-transfer"
        ],
        "description": "Post stock for an accepted transfer, marking it DONE. Transfer must be in ACCEPTED or IN_PROGRESS state.",
        "operationId": "internal-transfer-receive",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Internal-transfer ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The transfer after receiving (state becomes DONE)",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1internal-transfer~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/organizational-transfer/create": {
      "post": {
        "tags": [
          "Organizational-transfer"
        ],
        "description": "Create a new organizational transfer (cross-organization stock movement) in DRAFT or NEW state.",
        "operationId": "organizational-transfer-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "source_organization_id",
                  "destination_organization_id",
                  "state",
                  "date",
                  "shipping_date",
                  "sender_warehouse_id",
                  "sender_employee_id",
                  "reason_id",
                  "requests"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "Optional custom transfer code / reference number"
                  },
                  "source_organization_id": {
                    "type": "string",
                    "description": "Sending organization ObjectId"
                  },
                  "destination_organization_id": {
                    "type": "string",
                    "description": "Receiving organization ObjectId"
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "new"
                    ],
                    "description": "Initial state — draft (held) or new (ready to process)"
                  },
                  "invoice_created": {
                    "type": "boolean",
                    "description": "Whether a supplier invoice was created for this transfer",
                    "default": false
                  },
                  "with_price": {
                    "type": "boolean",
                    "description": "Whether product prices are included in the transfer",
                    "default": false
                  },
                  "date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Transfer document date (ISO 8601)"
                  },
                  "shipping_date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Expected shipment date (ISO 8601)"
                  },
                  "sender_warehouse_id": {
                    "type": "string",
                    "description": "Source warehouse ObjectId"
                  },
                  "sender_employee_id": {
                    "type": "string",
                    "description": "Employee responsible for sending ObjectId"
                  },
                  "reason_id": {
                    "type": "string",
                    "description": "Transfer reason ObjectId"
                  },
                  "price_id": {
                    "type": "string",
                    "description": "Price-list ObjectId (optional)"
                  },
                  "note": {
                    "type": "string",
                    "description": "Optional free-text note (max 500 characters)"
                  },
                  "currency": {
                    "type": "object",
                    "description": "Currency snapshot at transfer time (optional)",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "description": "Currency ObjectId"
                      },
                      "name": {
                        "type": "string"
                      },
                      "value": {
                        "type": "number",
                        "description": "Exchange rate value"
                      },
                      "symbol": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "name",
                      "value"
                    ]
                  },
                  "requests": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": [
                        "products"
                      ],
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Linked transfer-request ObjectId (optional)"
                        },
                        "products": {
                          "type": "array",
                          "minItems": 1,
                          "items": {
                            "type": "object",
                            "required": [
                              "product_id",
                              "amount"
                            ],
                            "properties": {
                              "product_id": {
                                "type": "string",
                                "description": "Product ObjectId"
                              },
                              "amount": {
                                "type": "number",
                                "description": "Quantity to transfer (must be positive)"
                              },
                              "price": {
                                "type": "number",
                                "description": "Unit price (optional; required when with_price=true)"
                              },
                              "box_count": {
                                "type": "number",
                                "description": "Number of boxes (integer ≥ 0)",
                                "default": 0
                              },
                              "box_item": {
                                "type": "number",
                                "description": "Items per box"
                              },
                              "marks": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Mark/serial codes for marked goods",
                                "default": []
                              },
                              "expiration_date": {
                                "type": "string",
                                "format": "date-time",
                                "description": "Expiration date (ISO 8601) for perishable goods"
                              },
                              "extra_costs": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "extra_cost_id": {
                                      "type": "string",
                                      "description": "Extra-cost type ObjectId"
                                    },
                                    "amount": {
                                      "type": "number"
                                    }
                                  }
                                },
                                "description": "Per-product additional costs",
                                "default": []
                              }
                            }
                          },
                          "description": "Products included in this request line"
                        }
                      }
                    },
                    "description": "One or more transfer request lines (each may reference a transfer-request document)"
                  },
                  "additional_costs": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "extra_cost_id": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "number"
                        }
                      }
                    },
                    "description": "Transfer-level additional costs",
                    "default": []
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        }
                      }
                    },
                    "description": "Attached files (documents, scans)",
                    "default": []
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The ObjectId of the created organizational transfer",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "description": "ObjectId of the created transfer"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/organizational-transfer/get-by-id/{id}": {
      "get": {
        "tags": [
          "Organizational-transfer"
        ],
        "description": "Fetch a single organizational transfer by ObjectId (aggregated detail view with products and requests).",
        "operationId": "organizational-transfer-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Organizational transfer ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The organizational transfer detail",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "Transfer ObjectId"
                            },
                            "number": {
                              "type": "string",
                              "description": "Auto-generated transfer document number"
                            },
                            "code": {
                              "type": "string",
                              "description": "Custom reference code"
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "draft",
                                "new",
                                "accepted",
                                "in_progress",
                                "done",
                                "canceled"
                              ]
                            },
                            "type": {
                              "type": "string",
                              "description": "Transfer type (o2o for organizational transfers)"
                            },
                            "source_organization_id": {
                              "type": "string"
                            },
                            "destination_organization_id": {
                              "type": "string"
                            },
                            "sender_warehouse_id": {
                              "type": "string"
                            },
                            "receiver_warehouse_id": {
                              "type": "string",
                              "description": "Set after receive; null until received"
                            },
                            "sender_employee_id": {
                              "type": "string"
                            },
                            "reason_id": {
                              "type": "string"
                            },
                            "price_id": {
                              "type": "string"
                            },
                            "date": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "shipping_date": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "invoice_created": {
                              "type": "boolean"
                            },
                            "with_price": {
                              "type": "boolean"
                            },
                            "note": {
                              "type": "string"
                            },
                            "total_amount": {
                              "type": "number",
                              "description": "Total quantity across all products"
                            },
                            "total_cost": {
                              "type": "number"
                            },
                            "total_price": {
                              "type": "number"
                            },
                            "total_extra_cost": {
                              "type": "number"
                            },
                            "requests": {
                              "type": "array",
                              "description": "Transfer request lines with their product details",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "request_id": {
                                    "type": "string"
                                  },
                                  "products": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "product_id": {
                                          "type": "string"
                                        },
                                        "amount": {
                                          "type": "number"
                                        },
                                        "price": {
                                          "type": "number"
                                        },
                                        "box_count": {
                                          "type": "number"
                                        },
                                        "marks": {
                                          "type": "array",
                                          "items": {
                                            "type": "string"
                                          }
                                        },
                                        "expiration_date": {
                                          "type": "string",
                                          "format": "date-time"
                                        },
                                        "sender_stock_before": {
                                          "type": "number",
                                          "description": "Sender warehouse stock before outflow"
                                        },
                                        "sender_stock_after": {
                                          "type": "number",
                                          "description": "Derived: sender_stock_before − amount"
                                        },
                                        "receiver_stock_before": {
                                          "type": "number",
                                          "description": "Receiver warehouse stock before inflow (set after receive)"
                                        },
                                        "receiver_stock_after": {
                                          "type": "number",
                                          "description": "Derived: receiver_stock_before + amount (set after receive)"
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "additional_costs": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            },
                            "attachments": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/organizational-transfer/get-paging": {
      "post": {
        "tags": [
          "Organizational-transfer"
        ],
        "description": "Paginated list of organizational transfers, filterable by organization, warehouse, state, and reason.",
        "operationId": "organizational-transfer-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "source_organization_id": {
                        "type": "string",
                        "description": "Filter by sending organization ObjectId"
                      },
                      "destination_organization_id": {
                        "type": "string",
                        "description": "Filter by receiving organization ObjectId"
                      },
                      "sender_warehouse_id": {
                        "type": "string",
                        "description": "Filter by sender warehouse ObjectId"
                      },
                      "receiver_warehouse_id": {
                        "type": "string",
                        "description": "Filter by receiver warehouse ObjectId"
                      },
                      "states": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "draft",
                            "new",
                            "accepted",
                            "in_progress",
                            "done",
                            "canceled"
                          ]
                        },
                        "description": "Filter by one or more transfer states"
                      },
                      "reason_id": {
                        "type": "string",
                        "description": "Filter by transfer reason ObjectId"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list of organizational transfers",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1organizational-transfer~1get-by-id~1%7Bid%7D/get/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/organizational-transfer/update/{id}": {
      "put": {
        "tags": [
          "Organizational-transfer"
        ],
        "description": "Update an existing organizational transfer. Only allowed in DRAFT or NEW state.",
        "operationId": "organizational-transfer-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Organizational transfer ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1organizational-transfer~1create/post/requestBody/content/application~1json/schema"
                  }
                ],
                "description": "Same fields as Create. The transfer id is supplied as the :id path parameter. Only allowed when the transfer is in DRAFT or NEW state."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The ObjectId of the updated organizational transfer",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "description": "ObjectId of the updated transfer"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/organizational-transfer/set-status/{id}": {
      "put": {
        "tags": [
          "Organizational-transfer"
        ],
        "description": "Transition the transfer through the state machine. Valid transitions: NEW→DRAFT|CANCELED|ACCEPTED; DRAFT→NEW; ACCEPTED→IN_PROGRESS|CANCELED; IN_PROGRESS→CANCELED; DONE→CANCELED. Use `receive` for the ACCEPTED/IN_PROGRESS→DONE transition.",
        "operationId": "organizational-transfer-set-status",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Organizational transfer ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "state"
                ],
                "properties": {
                  "state": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "new",
                      "accepted",
                      "in_progress",
                      "canceled"
                    ],
                    "description": "Target state. Valid transitions: NEW→DRAFT|CANCELED|ACCEPTED; DRAFT→NEW; ACCEPTED→IN_PROGRESS|CANCELED; IN_PROGRESS→CANCELED; DONE→CANCELED. Use the `receive` endpoint to transition to DONE."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The ObjectId of the transfer after state change",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "description": "ObjectId of the transfer"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/organizational-transfer/receive/{id}": {
      "put": {
        "tags": [
          "Organizational-transfer"
        ],
        "description": "Receive an accepted organizational transfer: transitions ACCEPTED or IN_PROGRESS → DONE and applies stock movement into the receiver warehouse.",
        "operationId": "organizational-transfer-receive",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Organizational transfer ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "receiver_warehouse_id"
                ],
                "properties": {
                  "receiver_warehouse_id": {
                    "type": "string",
                    "description": "Destination warehouse ObjectId where stock will be received"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The ObjectId of the completed organizational transfer",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "description": "ObjectId of the received transfer"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/write-off/create": {
      "post": {
        "tags": [
          "Write-off"
        ],
        "description": "Create a new write-off (stock loss). The document is immediately persisted in DONE state; stock is decremented and a linked invoice is created inside the same transaction.",
        "operationId": "write-off-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "write_date",
                  "responsible_id",
                  "reason_id",
                  "action",
                  "products"
                ],
                "properties": {
                  "organization_id": {
                    "type": "string",
                    "description": "Organization ObjectId. Required when the tenant has multiple organizations."
                  },
                  "code": {
                    "type": "string",
                    "description": "Optional external reference code for the write-off"
                  },
                  "write_date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Date the write-off occurred"
                  },
                  "source_warehouse_id": {
                    "type": "string",
                    "description": "Source warehouse ObjectId — the warehouse stock is deducted from"
                  },
                  "responsible_id": {
                    "type": "string",
                    "description": "Employee ObjectId responsible for this write-off"
                  },
                  "reason_id": {
                    "type": "string",
                    "description": "Reason ObjectId explaining why the stock is being written off"
                  },
                  "currency_id": {
                    "type": "string",
                    "description": "Currency ObjectId used for cost values. Defaults to the organization's base currency."
                  },
                  "action": {
                    "type": "string",
                    "enum": [
                      "remove",
                      "defect"
                    ],
                    "description": "Write-off action type. `remove` — permanent stock removal; `defect` — defective goods moved to a destination warehouse."
                  },
                  "destination_warehouse_id": {
                    "type": "string",
                    "description": "Destination warehouse ObjectId. Required when `action` is `defect`."
                  },
                  "note": {
                    "type": "string",
                    "description": "Optional free-text note"
                  },
                  "products": {
                    "type": "array",
                    "minItems": 1,
                    "description": "List of products to write off. At least one item is required.",
                    "items": {
                      "type": "object",
                      "required": [
                        "product_id",
                        "amount"
                      ],
                      "properties": {
                        "product_id": {
                          "type": "string",
                          "description": "Product ObjectId"
                        },
                        "amount": {
                          "type": "number",
                          "description": "Quantity to write off (must be positive)"
                        },
                        "box_count": {
                          "type": "number",
                          "description": "Number of boxes (integer; defaults to 0)"
                        },
                        "marks": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Mark/serial codes for marked goods. Each mark must be unique within the request."
                        },
                        "expiration_date": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Expiration date — required for perishable products that have `has_expiration: true`"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created write-off with full detail",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "number": {
                              "type": "string",
                              "description": "Auto-generated write-off document number"
                            },
                            "code": {
                              "type": "string",
                              "description": "Optional external reference code"
                            },
                            "write_date": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "action": {
                              "type": "string",
                              "enum": [
                                "remove",
                                "defect"
                              ]
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "done",
                                "canceled"
                              ]
                            },
                            "note": {
                              "type": "string"
                            },
                            "total_cost": {
                              "type": "number"
                            },
                            "organization": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "responsible_employee": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                }
                              }
                            },
                            "reason": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "currency": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "source_warehouse": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "destination_warehouse": {
                              "type": "object",
                              "description": "Populated only when action is `defect`",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "products": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "product_id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "barcode": {
                                    "type": "string"
                                  },
                                  "amount": {
                                    "type": "number"
                                  },
                                  "box_count": {
                                    "type": "number"
                                  },
                                  "cost": {
                                    "type": "number"
                                  },
                                  "total_cost": {
                                    "type": "number"
                                  },
                                  "marks": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "expiration_date": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                }
                              }
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          },
                          "required": [
                            "_id",
                            "number",
                            "write_date",
                            "action",
                            "state",
                            "total_cost"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/write-off/set-status/{id}": {
      "put": {
        "tags": [
          "Write-off"
        ],
        "description": "Transition a write-off to CANCELED state. This is the only valid state transition — it reverses stock, cancels the linked invoice, and posts a CREDIT reconciliation act. Only `status: \"canceled\"` is accepted; write-offs are created directly in DONE state.",
        "operationId": "write-off-set-status",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Write-off ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "status"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "canceled"
                    ],
                    "description": "Target status. Only `canceled` is accepted — write-offs are created directly in DONE state and the only permitted transition is DONE → canceled."
                  },
                  "reason": {
                    "type": "string",
                    "description": "Optional free-text reason for the cancellation"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The canceled write-off with full detail",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1write-off~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/write-off/get-by-id/{id}": {
      "get": {
        "tags": [
          "Write-off"
        ],
        "description": "Fetch a single write-off by ObjectId with full detail (products, organization, responsible employee, reason, currency, warehouses, attachments).",
        "operationId": "write-off-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Write-off ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The write-off",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1write-off~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/write-off/get-paging": {
      "post": {
        "tags": [
          "Write-off"
        ],
        "description": "Paginated list of write-offs. Filterable by organization, warehouse, responsible employee, action type, and date range.",
        "operationId": "write-off-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string",
                        "description": "Filter by organization ObjectId"
                      },
                      "warehouse_id": {
                        "type": "string",
                        "description": "Filter by source warehouse ObjectId"
                      },
                      "responsible_id": {
                        "type": "string",
                        "description": "Filter by responsible employee ObjectId"
                      },
                      "action": {
                        "type": "string",
                        "enum": [
                          "remove",
                          "defect"
                        ],
                        "description": "Filter by write-off action type"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list of write-offs",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "string"
                                  },
                                  "code": {
                                    "type": "string"
                                  },
                                  "write_date": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "action": {
                                    "type": "string",
                                    "enum": [
                                      "remove",
                                      "defect"
                                    ]
                                  },
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "done",
                                      "canceled"
                                    ]
                                  },
                                  "total_cost": {
                                    "type": "number"
                                  },
                                  "organization": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "responsible_employee": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "reason": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "source_warehouse": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "created_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                },
                                "required": [
                                  "_id",
                                  "number",
                                  "write_date",
                                  "action",
                                  "state"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/revision/create": {
      "post": {
        "tags": [
          "Revision"
        ],
        "description": "Create a new products revision (stock inventory count). `type` is forced to `products`. `created_by` is set from the integration principal.",
        "operationId": "revision-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "organization_id",
                  "starting_date"
                ],
                "properties": {
                  "organization_id": {
                    "type": "string",
                    "description": "Organization ObjectId the revision belongs to"
                  },
                  "warehouse_id": {
                    "type": "string",
                    "description": "Warehouse ObjectId to count stock in (optional — defaults to org's primary warehouse)"
                  },
                  "responsible_id": {
                    "type": "string",
                    "description": "Employee ObjectId responsible for this revision (optional — defaults to the integration principal)"
                  },
                  "starting_date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Date and time the revision counting period starts (ISO 8601)"
                  },
                  "ending_date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Optional date and time the counting period ends (ISO 8601)"
                  },
                  "description": {
                    "type": "string",
                    "description": "Optional free-text description or notes"
                  },
                  "set_counted": {
                    "type": "boolean",
                    "description": "When true, pre-populates counted quantities from current stock levels"
                  },
                  "category_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Filter products by category ObjectIds (optional)"
                  },
                  "supplier_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Filter products by supplier ObjectIds (optional)"
                  },
                  "additional_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Additional product ObjectIds to include (optional)"
                  },
                  "removed_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Product ObjectIds to exclude from the revision (optional)"
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    },
                    "description": "File attachments (optional)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created revision with full detail (responsible, organization, warehouse, totals, profit_list, loss_list).",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "pending",
                                "in_progress",
                                "canceled",
                                "done"
                              ]
                            },
                            "number": {
                              "type": "string"
                            },
                            "starting_date": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "ending_date": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "description": {
                              "type": "string"
                            },
                            "organization_id": {
                              "type": "string"
                            },
                            "organization": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "warehouse_id": {
                              "type": "string"
                            },
                            "warehouse": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "responsible_id": {
                              "type": "string"
                            },
                            "responsible": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                },
                                "phone_number": {
                                  "type": "string"
                                }
                              }
                            },
                            "currency": {
                              "type": "object"
                            },
                            "total_expected": {
                              "type": "number"
                            },
                            "total_counted": {
                              "type": "number"
                            },
                            "total_profit": {
                              "type": "number"
                            },
                            "total_loss": {
                              "type": "number"
                            },
                            "difference": {
                              "type": "number"
                            },
                            "profit_list": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "currency_id": {
                                    "type": "string"
                                  },
                                  "amount": {
                                    "type": "number"
                                  }
                                }
                              }
                            },
                            "loss_list": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "currency_id": {
                                    "type": "string"
                                  },
                                  "amount": {
                                    "type": "number"
                                  }
                                }
                              }
                            },
                            "attachments": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/revision/get-by-id/{id}": {
      "get": {
        "tags": [
          "Revision"
        ],
        "description": "Fetch a single revision by ObjectId. Returns full detail including responsible, organization, warehouse, totals, profit_list, loss_list.",
        "operationId": "revision-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Revision ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The revision detail",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1revision~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/revision/get-paging": {
      "post": {
        "tags": [
          "Revision"
        ],
        "description": "Paginated list of product revisions (type is forced to `products`). Filterable by organization, warehouse, responsible, and state.",
        "operationId": "revision-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string",
                        "description": "Filter by organization ObjectId"
                      },
                      "warehouse_id": {
                        "type": "string",
                        "description": "Filter by warehouse ObjectId"
                      },
                      "responsible_id": {
                        "type": "string",
                        "description": "Filter by responsible employee ObjectId"
                      },
                      "state": {
                        "type": "string",
                        "enum": [
                          "pending",
                          "in_progress",
                          "canceled",
                          "done"
                        ],
                        "description": "Filter by revision state"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list of revisions",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "pending",
                                      "in_progress",
                                      "canceled",
                                      "done"
                                    ]
                                  },
                                  "number": {
                                    "type": "string"
                                  },
                                  "starting_date": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "ending_date": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "description": {
                                    "type": "string"
                                  },
                                  "organization_id": {
                                    "type": "string"
                                  },
                                  "organization": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "warehouse_id": {
                                    "type": "string"
                                  },
                                  "warehouse": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "responsible": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      },
                                      "phone_number": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "total_expected": {
                                    "type": "number"
                                  },
                                  "total_counted": {
                                    "type": "number"
                                  },
                                  "total_profit": {
                                    "type": "number"
                                  },
                                  "total_loss": {
                                    "type": "number"
                                  },
                                  "total_difference": {
                                    "type": "number"
                                  },
                                  "created_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "updated_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/revision/update/{id}": {
      "put": {
        "tags": [
          "Revision"
        ],
        "description": "Update an existing revision. Only allowed while `state` is `pending`; returns `AlreadyInProgress` otherwise.",
        "operationId": "revision-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Revision ObjectId to update",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "organization_id": {
                    "type": "string",
                    "description": "Organization ObjectId"
                  },
                  "warehouse_id": {
                    "type": "string",
                    "description": "Warehouse ObjectId"
                  },
                  "responsible_id": {
                    "type": "string",
                    "description": "Employee ObjectId responsible for this revision"
                  },
                  "starting_date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Date and time the revision counting period starts (ISO 8601)"
                  },
                  "ending_date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Date and time the counting period ends (ISO 8601)"
                  },
                  "description": {
                    "type": "string",
                    "description": "Free-text description or notes"
                  },
                  "set_counted": {
                    "type": "boolean",
                    "description": "Re-populate counted quantities from current stock levels"
                  },
                  "category_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Filter products by category ObjectIds"
                  },
                  "supplier_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Filter products by supplier ObjectIds"
                  },
                  "additional_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Additional product ObjectIds to include"
                  },
                  "removed_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Product ObjectIds to exclude"
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    },
                    "description": "File attachments"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated revision with full detail",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1revision~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/revision/set-status/{id}": {
      "put": {
        "tags": [
          "Revision"
        ],
        "description": "Transition a revision to a new state. Valid transitions: pending→in_progress|canceled; in_progress→done|canceled; done→canceled (blocked for products type). DONE triggers stock reconciliation and invoice creation.",
        "operationId": "revision-set-status",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Revision ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "status"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "pending",
                      "in_progress",
                      "canceled",
                      "done"
                    ],
                    "description": "Target state. Transitions: pending→in_progress|canceled; in_progress→done|canceled; done→canceled (blocked for products revisions)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated revision after state transition",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1revision~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-order/create": {
      "post": {
        "tags": [
          "Production-order"
        ],
        "description": "Create a new production order with its line items.",
        "operationId": "production-order-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "organization_id",
                  "date",
                  "items"
                ],
                "properties": {
                  "organization_id": {
                    "type": "string",
                    "description": "Organization ObjectId the production order belongs to"
                  },
                  "date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Production order date (ISO 8601)"
                  },
                  "code": {
                    "type": "string",
                    "description": "Optional human-readable order code"
                  },
                  "note": {
                    "type": "string",
                    "description": "Optional free-text note"
                  },
                  "items": {
                    "type": "array",
                    "minItems": 1,
                    "description": "Line items — each references a product and a tech-map",
                    "items": {
                      "type": "object",
                      "required": [
                        "product_id",
                        "tech_map_id",
                        "amount"
                      ],
                      "properties": {
                        "product_id": {
                          "type": "string",
                          "description": "Product ObjectId to be produced"
                        },
                        "tech_map_id": {
                          "type": "string",
                          "description": "Technical map (recipe/BOM) ObjectId to use"
                        },
                        "amount": {
                          "type": "number",
                          "description": "Planned production quantity"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created production order",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "allOf": [
                            {
                              "$ref": "#/paths/~1production-order~1create/post/requestBody/content/application~1json/schema"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Production order ObjectId"
                                },
                                "status": {
                                  "type": "string",
                                  "description": "Current production order state"
                                },
                                "is_deleted": {
                                  "type": "boolean",
                                  "description": "Soft-delete flag"
                                },
                                "created_at": {
                                  "type": "string",
                                  "format": "date-time",
                                  "description": "Creation timestamp (ISO 8601)"
                                },
                                "updated_at": {
                                  "type": "string",
                                  "format": "date-time",
                                  "description": "Last update timestamp (ISO 8601)"
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-order/get-by-id/{id}": {
      "get": {
        "tags": [
          "Production-order"
        ],
        "description": "Fetch a single production order by ObjectId.",
        "operationId": "production-order-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Production-order ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The production order",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-order~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-order/get-paging": {
      "post": {
        "tags": [
          "Production-order"
        ],
        "description": "Paginated list of production orders, filterable by organization.",
        "operationId": "production-order-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string",
                        "description": "Filter by organization ObjectId"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1production-order~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/production-order/update/{id}": {
      "put": {
        "tags": [
          "Production-order"
        ],
        "description": "Update an existing production order and its line items.",
        "operationId": "production-order-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Production-order ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "organization_id",
                  "date",
                  "items"
                ],
                "properties": {
                  "organization_id": {
                    "type": "string",
                    "description": "Organization ObjectId the production order belongs to"
                  },
                  "date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Production order date (ISO 8601)"
                  },
                  "code": {
                    "type": "string",
                    "description": "Optional human-readable order code"
                  },
                  "note": {
                    "type": "string",
                    "description": "Optional free-text note"
                  },
                  "items": {
                    "type": "array",
                    "minItems": 1,
                    "description": "Replacement line items for the order",
                    "items": {
                      "type": "object",
                      "required": [
                        "product_id",
                        "tech_map_id",
                        "amount"
                      ],
                      "properties": {
                        "product_id": {
                          "type": "string",
                          "description": "Product ObjectId to be produced"
                        },
                        "tech_map_id": {
                          "type": "string",
                          "description": "Technical map (recipe/BOM) ObjectId to use"
                        },
                        "amount": {
                          "type": "number",
                          "description": "Planned production quantity"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated production order",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-order~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-order/delete/{id}": {
      "delete": {
        "tags": [
          "Production-order"
        ],
        "description": "Soft-delete a production order by ObjectId.",
        "operationId": "production-order-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Production-order ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-plan/create": {
      "post": {
        "tags": [
          "Production-plan"
        ],
        "description": "Create a production plan for a given year and organization. This is a year-keyed upsert — if a plan already exists for the given (year, organization_id) it is updated rather than duplicated. Items carry per-product monthly targets.",
        "operationId": "production-plan-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "year",
                  "organization_id",
                  "items"
                ],
                "properties": {
                  "year": {
                    "type": "number",
                    "description": "The production plan year (e.g. 2025). Together with organization_id this is the upsert key — submitting a plan for the same year + organization updates the existing plan.",
                    "example": 2025
                  },
                  "organization_id": {
                    "type": "string",
                    "description": "Organization ObjectId this plan belongs to"
                  },
                  "note": {
                    "type": "string",
                    "description": "Optional free-text note"
                  },
                  "items": {
                    "type": "array",
                    "minItems": 1,
                    "description": "Per-product monthly production targets (at least one item required)",
                    "items": {
                      "type": "object",
                      "required": [
                        "product_id",
                        "months"
                      ],
                      "properties": {
                        "product_id": {
                          "type": "string",
                          "description": "Product ObjectId"
                        },
                        "months": {
                          "type": "array",
                          "minItems": 1,
                          "description": "Monthly target entries for this product (at least one month required)",
                          "items": {
                            "type": "object",
                            "required": [
                              "amount",
                              "month_number"
                            ],
                            "properties": {
                              "amount": {
                                "type": "number",
                                "description": "Planned production quantity for this month"
                              },
                              "month_number": {
                                "type": "number",
                                "minimum": 1,
                                "maximum": 12,
                                "description": "Calendar month (1 = January … 12 = December). Each month_number must be unique within an item."
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created (or upserted) production plan with aggregated items and monthly targets",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "Production plan ObjectId"
                            },
                            "number": {
                              "type": "string",
                              "description": "Auto-generated plan number"
                            },
                            "year": {
                              "type": "number",
                              "description": "Plan year"
                            },
                            "note": {
                              "type": "string",
                              "description": "Free-text note"
                            },
                            "organization_id": {
                              "type": "string",
                              "description": "Organization ObjectId"
                            },
                            "organization": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "created_by": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "number": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                }
                              }
                            },
                            "updated_by": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "number": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                }
                              }
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "product_id": {
                                    "type": "string",
                                    "description": "Product ObjectId"
                                  },
                                  "product": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "sku": {
                                        "type": "string"
                                      },
                                      "barcode": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "months": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "amount": {
                                          "type": "number",
                                          "description": "Planned quantity"
                                        },
                                        "month_number": {
                                          "type": "number",
                                          "description": "Calendar month (1–12)"
                                        },
                                        "produced": {
                                          "type": "number",
                                          "description": "Actual produced quantity so far"
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-plan/update/{id}": {
      "put": {
        "tags": [
          "Production-plan"
        ],
        "description": "Update a production plan. Internally performs the same year-keyed upsert as create — the {id} path parameter is standard-shape only; the real dedup key is body year + organization_id. Send the full plan payload including items.",
        "operationId": "production-plan-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Production plan ObjectId (standard-shape; upsert key is year + organization_id in body)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1production-plan~1create/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated production plan with aggregated items and monthly targets",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-plan~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-plan/get-by-id/{id}": {
      "get": {
        "tags": [
          "Production-plan"
        ],
        "description": "Fetch a single production plan by ObjectId, with aggregated items and per-product monthly targets.",
        "operationId": "production-plan-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Production plan ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The production plan",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-plan~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-plan/get-paging": {
      "post": {
        "tags": [
          "Production-plan"
        ],
        "description": "Paginated list of production plans. The search field matches against the plan number.",
        "operationId": "production-plan-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string",
                        "description": "Search string matched against plan number"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list of production plans",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "string"
                                  },
                                  "year": {
                                    "type": "number"
                                  },
                                  "note": {
                                    "type": "string"
                                  },
                                  "organization_id": {
                                    "type": "string"
                                  },
                                  "organization": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "created_by": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "number": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "updated_by": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "number": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "created_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "updated_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/production-plan/delete-many": {
      "post": {
        "tags": [
          "Production-plan"
        ],
        "description": "Soft-delete one or more production plans by their ObjectIds. Sets is_deleted=true; no physical deletion.",
        "operationId": "production-plan-delete-many",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "ids"
                ],
                "properties": {
                  "ids": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string"
                    },
                    "description": "Production plan ObjectIds to soft-delete (at least one required)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-step/create": {
      "post": {
        "tags": [
          "Production-step"
        ],
        "description": "Create a new production step (an individual manufacturing stage such as cutting, assembly, or QC).",
        "operationId": "production-step-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Display name of the production step (required)"
                  },
                  "code": {
                    "type": "string",
                    "description": "Optional human-readable code for this step"
                  },
                  "note": {
                    "type": "string",
                    "description": "Optional free-text note"
                  },
                  "used_warehouse_id": {
                    "type": "string",
                    "description": "ObjectId of the warehouse used in this step (optional)"
                  },
                  "employee_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "ObjectIds of employees assigned to this step (optional)"
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string",
                          "description": "URL of the pre-uploaded attachment"
                        },
                        "name": {
                          "type": "string",
                          "description": "File name of the attachment"
                        },
                        "size": {
                          "type": "number",
                          "description": "File size in bytes"
                        },
                        "type": {
                          "type": "string",
                          "description": "MIME type of the attachment"
                        }
                      }
                    },
                    "description": "Pre-uploaded attachment object references (optional)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created production step",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-step~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-step/get-by-id/{id}": {
      "get": {
        "tags": [
          "Production-step"
        ],
        "description": "Fetch a single production step by ObjectId.",
        "operationId": "production-step-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Production step ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The production step",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-step~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-step/get-paging": {
      "post": {
        "tags": [
          "Production-step"
        ],
        "description": "Paginated list of production steps, filterable by name/code/number search.",
        "operationId": "production-step-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "page": {
                    "type": "number",
                    "default": 1,
                    "minimum": 1
                  },
                  "limit": {
                    "type": "number",
                    "default": 20,
                    "minimum": 1,
                    "maximum": 200
                  }
                },
                "required": [
                  "page",
                  "limit"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list of production steps",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1production-step~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/production-step/update": {
      "put": {
        "tags": [
          "Production-step"
        ],
        "description": "Update an existing production step. Requires _id plus at minimum the name field.",
        "operationId": "production-step-update",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1create/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "required": [
                      "_id"
                    ],
                    "properties": {
                      "_id": {
                        "type": "string",
                        "description": "ObjectId of the production step to update (required)"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated production step",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "Production step ObjectId"
                            },
                            "name": {
                              "type": "string",
                              "description": "Display name of the step"
                            },
                            "number": {
                              "type": "string",
                              "description": "Auto-assigned sequential number"
                            },
                            "code": {
                              "type": "string",
                              "description": "Human-readable code"
                            },
                            "note": {
                              "type": "string",
                              "description": "Free-text note"
                            },
                            "used_warehouse": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "number": {
                                  "type": "string"
                                }
                              },
                              "description": "Denormalized warehouse used in this step (present when used_warehouse_id is set)"
                            },
                            "employees": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "full_name": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "string"
                                  },
                                  "attachments": {
                                    "type": "array",
                                    "items": {
                                      "type": "object"
                                    }
                                  }
                                }
                              },
                              "description": "Denormalized employee records assigned to this step"
                            },
                            "attachments": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              },
                              "description": "Attachment records linked to this step"
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time",
                              "description": "ISO 8601 creation timestamp"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time",
                              "description": "ISO 8601 last-update timestamp"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-step/delete/{id}": {
      "delete": {
        "tags": [
          "Production-step"
        ],
        "description": "Soft-delete a production step by ObjectId (sets is_deleted=true). The step is no longer returned in normal listings after deletion.",
        "operationId": "production-step-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Production step ObjectId to soft-delete",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful soft-delete",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-group/create": {
      "post": {
        "tags": [
          "Production-group"
        ],
        "description": "Create a new production group (hierarchical grouping of tech-maps).",
        "operationId": "production-group-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "name",
                  "organization_ids"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "tech_map",
                      "route_sheet"
                    ],
                    "description": "Category of tech-maps this group organises (tech_map or route_sheet)"
                  },
                  "name": {
                    "type": "string",
                    "description": "Display name of the production group"
                  },
                  "code": {
                    "type": "string",
                    "description": "Optional short code for the group"
                  },
                  "note": {
                    "type": "string",
                    "description": "Optional free-text note"
                  },
                  "parent_id": {
                    "type": "string",
                    "description": "Parent production-group ObjectId for hierarchical grouping"
                  },
                  "organization_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Organization ObjectIds this group is scoped to"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created production group",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "allOf": [
                            {
                              "$ref": "#/paths/~1production-group~1create/post/requestBody/content/application~1json/schema"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Production group ObjectId"
                                },
                                "is_deleted": {
                                  "type": "boolean",
                                  "description": "Soft-delete flag"
                                },
                                "created_at": {
                                  "type": "string",
                                  "format": "date-time",
                                  "description": "Creation timestamp (ISO 8601)"
                                },
                                "updated_at": {
                                  "type": "string",
                                  "format": "date-time",
                                  "description": "Last update timestamp (ISO 8601)"
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-group/get-by-id/{id}": {
      "get": {
        "tags": [
          "Production-group"
        ],
        "description": "Fetch a single production group by ObjectId.",
        "operationId": "production-group-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Production-group ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The production group",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-group~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-group/get-paging": {
      "post": {
        "tags": [
          "Production-group"
        ],
        "description": "Paginated list of production groups, filterable by type and organization.",
        "operationId": "production-group-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string",
                        "description": "Filter by name or code"
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "tech_map",
                          "route_sheet"
                        ],
                        "description": "Filter by group type"
                      },
                      "organization_id": {
                        "type": "string",
                        "description": "Filter by organization ObjectId"
                      },
                      "parent_id": {
                        "type": "string",
                        "description": "Filter by parent group ObjectId"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1production-group~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/production-group/update/{id}": {
      "put": {
        "tags": [
          "Production-group"
        ],
        "description": "Update an existing production group.",
        "operationId": "production-group-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Production-group ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "tech_map",
                      "route_sheet"
                    ],
                    "description": "Category of tech-maps this group organises"
                  },
                  "name": {
                    "type": "string",
                    "description": "Display name of the production group"
                  },
                  "code": {
                    "type": "string",
                    "description": "Optional short code for the group"
                  },
                  "note": {
                    "type": "string",
                    "description": "Optional free-text note"
                  },
                  "parent_id": {
                    "type": "string",
                    "description": "Parent production-group ObjectId for hierarchical grouping"
                  },
                  "organization_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Organization ObjectIds this group is scoped to"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated production group",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-group~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-group/delete/{id}": {
      "delete": {
        "tags": [
          "Production-group"
        ],
        "description": "Soft-delete a production group by ObjectId.",
        "operationId": "production-group-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Production-group ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-task/create": {
      "post": {
        "tags": [
          "Production-task"
        ],
        "description": "Create a new production task with tech-map items and warehouse assignments. Returns the hydrated task including items, route-sheet steps, materials, and warehouse quantities.",
        "operationId": "production-task-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "responsible_id",
                  "currency_id",
                  "organization_id",
                  "produced_warehouse_id",
                  "items",
                  "used_warehouse_items"
                ],
                "properties": {
                  "responsible_id": {
                    "type": "string",
                    "description": "Employee ObjectId responsible for the task (required)"
                  },
                  "currency_id": {
                    "type": "string",
                    "description": "Currency ObjectId for cost tracking (required)"
                  },
                  "organization_id": {
                    "type": "string",
                    "description": "Organization ObjectId the task belongs to (required)"
                  },
                  "produced_warehouse_id": {
                    "type": "string",
                    "description": "Warehouse ObjectId where finished goods land (required)"
                  },
                  "items": {
                    "type": "array",
                    "minItems": 1,
                    "description": "Tech-map line items — at least one required",
                    "items": {
                      "type": "object",
                      "required": [
                        "tech_map_id",
                        "amount"
                      ],
                      "properties": {
                        "tech_map_id": {
                          "type": "string",
                          "description": "ProductionTechMap ObjectId (recipe/BOM reference)"
                        },
                        "amount": {
                          "type": "number",
                          "description": "Planned production quantity (positive number)"
                        }
                      }
                    }
                  },
                  "used_warehouse_items": {
                    "type": "array",
                    "minItems": 1,
                    "description": "Per-step warehouse assignments — at least one required",
                    "items": {
                      "type": "object",
                      "required": [
                        "used_warehouse_id",
                        "step_id"
                      ],
                      "properties": {
                        "used_warehouse_id": {
                          "type": "string",
                          "description": "Warehouse ObjectId materials are consumed from for this step"
                        },
                        "step_id": {
                          "type": "string",
                          "description": "ProductionStep ObjectId this warehouse assignment applies to"
                        }
                      }
                    }
                  },
                  "code": {
                    "type": "string",
                    "description": "Optional human-readable task code"
                  },
                  "note": {
                    "type": "string",
                    "description": "Optional free-text note"
                  },
                  "date": {
                    "type": "string",
                    "format": "date",
                    "description": "Optional task date (ISO 8601 YYYY-MM-DD)"
                  },
                  "attachments": {
                    "type": "array",
                    "description": "Optional pre-uploaded attachment object refs",
                    "items": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created production task (hydrated)",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "description": "Hydrated production task as returned by get-by-id, create, update, and set-status.",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "Production task ObjectId"
                            },
                            "number": {
                              "type": "string",
                              "description": "Auto-generated sequential task number"
                            },
                            "code": {
                              "type": "string",
                              "description": "Human-readable task code"
                            },
                            "note": {
                              "type": "string",
                              "description": "Free-text note"
                            },
                            "date": {
                              "type": "string",
                              "format": "date-time",
                              "description": "Task date"
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "new",
                                "in_progress",
                                "done",
                                "canceled"
                              ],
                              "description": "Current task state"
                            },
                            "organization": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "produced_warehouse": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "responsible": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                },
                                "number": {
                                  "type": "string"
                                }
                              }
                            },
                            "used_warehouse_items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "step_id": {
                                    "type": "string"
                                  },
                                  "step": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "used_warehouse_id": {
                                    "type": "string"
                                  },
                                  "used_warehouse": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "items": {
                              "type": "array",
                              "description": "Hydrated tech-map items with route-sheet steps, materials, and warehouse quantities",
                              "items": {
                                "type": "object"
                              }
                            },
                            "attachments": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-task/get-by-id/{id}": {
      "get": {
        "tags": [
          "Production-task"
        ],
        "description": "Fetch a single production task by ObjectId. Returns the same hydrated shape as create/update.",
        "operationId": "production-task-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Production-task ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The production task (hydrated)",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-task~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-task/get-paging": {
      "post": {
        "tags": [
          "Production-task"
        ],
        "description": "Paginated list of production tasks, filterable by organization and state.",
        "operationId": "production-task-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string",
                        "description": "Filter by organization ObjectId"
                      },
                      "state": {
                        "type": "string",
                        "enum": [
                          "new",
                          "in_progress",
                          "done",
                          "canceled"
                        ],
                        "description": "Filter by task state"
                      },
                      "search": {
                        "type": "string",
                        "description": "Free-text search across number and code fields"
                      },
                      "sort_by": {
                        "type": "string",
                        "description": "Field to sort by (e.g. created_at)"
                      },
                      "asc": {
                        "type": "number",
                        "enum": [
                          1,
                          -1
                        ],
                        "description": "Sort direction: 1 ascending, -1 descending"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list of production tasks",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "description": "Production task summary as returned by get-paging list items.",
                                "properties": {
                                  "_id": {
                                    "type": "string",
                                    "description": "Production task ObjectId"
                                  },
                                  "number": {
                                    "type": "string",
                                    "description": "Auto-generated sequential task number"
                                  },
                                  "code": {
                                    "type": "string",
                                    "description": "Human-readable task code"
                                  },
                                  "note": {
                                    "type": "string",
                                    "description": "Free-text note"
                                  },
                                  "date": {
                                    "type": "string",
                                    "format": "date-time",
                                    "description": "Task date"
                                  },
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "new",
                                      "in_progress",
                                      "done",
                                      "canceled"
                                    ],
                                    "description": "Current task state"
                                  },
                                  "organization": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "produced_warehouse": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "responsible": {
                                    "type": "object",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "full_name": {
                                        "type": "string"
                                      },
                                      "number": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "created_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "updated_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/production-task/update/{id}": {
      "put": {
        "tags": [
          "Production-task"
        ],
        "description": "Update an existing production task. Only allowed while the task is in state `new`. Replaces items and warehouse assignments; re-runs tech-map hydration. Returns the updated hydrated task.",
        "operationId": "production-task-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Production-task ObjectId to update",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-task~1create/post/requestBody/content/application~1json/schema"
                  }
                ],
                "description": "Same payload as Create. The task ObjectId is supplied as a path parameter (:id). Update is only allowed while the task state is `new`."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated production task (hydrated)",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-task~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-task/set-status/{id}": {
      "put": {
        "tags": [
          "Production-task"
        ],
        "description": "Transition a production task to a new state. Valid transitions: new→[in_progress, canceled, done]; in_progress→[canceled, done]; done→[canceled]; canceled→[]. Transitioning to `canceled` cascades cancellation of all linked production operations. NOTE: the `reason` field is accepted by the contract but is NOT persisted (the model has no reason field).",
        "operationId": "production-task-set-status",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Production-task ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "status"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "new",
                      "in_progress",
                      "done",
                      "canceled"
                    ],
                    "description": "Target state for the production task (required). Valid transitions: new→[in_progress, canceled, done]; in_progress→[canceled, done]; done→[canceled]; canceled→[]."
                  },
                  "reason": {
                    "type": "string",
                    "description": "Optional reason for the state transition. Accepted by the API contract but NOT persisted — the ProductionTask model has no reason field."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The production task after the state transition (hydrated)",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-task~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/export-records/create": {
      "post": {
        "tags": [
          "Export-records"
        ],
        "description": "Initiate an async export job for the specified page. The export runs in the background via BullMQ; poll get-by-id or get-paging to track progress. Returns the created record with state=pending.",
        "operationId": "export-records-create",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "page_name",
                  "query_params"
                ],
                "properties": {
                  "page_name": {
                    "type": "string",
                    "description": "Bito page identifier to export (e.g. trade, products, purchase, customers). Must match a registered PageNames value."
                  },
                  "query_params": {
                    "type": "object",
                    "description": "Page-specific query parameters (filters, date range, etc.). Passed through to the per-page export cursor function after RBAC validation. Include ext_type ('xlsx' or 'csv') to control output format; defaults to xlsx."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created export record (state=pending)",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "Export record ObjectId"
                            },
                            "account_id": {
                              "type": "string",
                              "description": "Tenant identifier (equals boss ObjectId / dbName)"
                            },
                            "user_id": {
                              "type": "string",
                              "description": "ObjectId of the user who initiated the export"
                            },
                            "file_name": {
                              "type": "string",
                              "description": "Generated file name (e.g. trade-1718000000000.xlsx)"
                            },
                            "file_path": {
                              "type": "string",
                              "description": "S3 / storage path to the exported file (available when state=completed)"
                            },
                            "page_name": {
                              "type": "string",
                              "description": "Bito page identifier the export was requested for (e.g. trade, products, purchase)"
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "pending",
                                "in_progress",
                                "completed",
                                "failed",
                                "canceled"
                              ],
                              "description": "Current state of the export job. Worker-driven: pending→in_progress→completed|failed. Caller-cancellable: pending|in_progress→canceled."
                            },
                            "started_at": {
                              "type": "string",
                              "format": "date-time",
                              "description": "Timestamp when the export record was created"
                            },
                            "completed_at": {
                              "type": "string",
                              "format": "date-time",
                              "description": "Timestamp when the export reached a terminal state (completed, failed, or canceled)"
                            },
                            "progress": {
                              "type": "number",
                              "description": "Export completion percentage (0–100). Set to 100 on completed."
                            },
                            "query_params": {
                              "type": "object",
                              "description": "The validated query parameters used for this export (page-specific shape)"
                            },
                            "user": {
                              "type": "object",
                              "description": "Denormalized user data (available in get-paging list)",
                              "properties": {
                                "full_name": {
                                  "type": "string"
                                },
                                "phone_number": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/export-records/get-by-id/{id}": {
      "get": {
        "tags": [
          "Export-records"
        ],
        "description": "Fetch a single export record by ObjectId. Use this to poll state/progress after create.",
        "operationId": "export-records-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Export record ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The export record",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1export-records~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/export-records/get-paging": {
      "post": {
        "tags": [
          "Export-records"
        ],
        "description": "Paginated list of export records for the authenticated tenant. Filterable by user_id, page_name, state, date range, and employee list. Includes $lookup user {full_name, phone_number}.",
        "operationId": "export-records-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "user_id": {
                        "type": "string",
                        "description": "Filter by initiating user ObjectId"
                      },
                      "page_name": {
                        "type": "string",
                        "description": "Filter by page name (e.g. trade, products)"
                      },
                      "state": {
                        "type": "string",
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed",
                          "failed",
                          "canceled"
                        ],
                        "description": "Filter by export state"
                      },
                      "date_from": {
                        "type": "string",
                        "format": "date",
                        "description": "Filter records created on or after this date (ISO 8601)"
                      },
                      "date_to": {
                        "type": "string",
                        "format": "date",
                        "description": "Filter records created on or before this date (ISO 8601)"
                      },
                      "employees": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "Filter by a list of user ObjectIds (alternative to user_id for multi-user filtering)"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list of export records",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1export-records~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/export-records/set-state/{id}": {
      "put": {
        "tags": [
          "Export-records"
        ],
        "description": "Cancel a pending or in-progress export job. This is the only caller-driven state transition — only state=canceled is accepted. Worker-driven transitions (pending→in_progress→completed/failed) cannot be triggered via this endpoint.",
        "operationId": "export-records-set-state",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Export record ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "state"
                ],
                "properties": {
                  "state": {
                    "type": "string",
                    "enum": [
                      "canceled"
                    ],
                    "description": "Target state. Only 'canceled' is accepted via this endpoint. The record must currently be in 'pending' or 'in_progress' state; otherwise a WrongState error is returned."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated export record with state=canceled and completed_at stamped",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1export-records~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/pipeline-action/create": {
      "post": {
        "tags": [
          "Pipeline-action"
        ],
        "description": "Create a CRM pipeline automation rule. Specify a trigger (event or scheduled), an optional condition tree, and an action to execute (create task, send SMS, change state, etc.).",
        "operationId": "pipeline-action-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "organization_id",
                  "trigger_category",
                  "action_type",
                  "action_config"
                ],
                "properties": {
                  "organization_id": {
                    "type": "string",
                    "description": "Organization ObjectId this action belongs to"
                  },
                  "state_id": {
                    "type": "string",
                    "description": "Optional CRM pipeline state (column) ObjectId this action is linked to"
                  },
                  "trigger_category": {
                    "type": "string",
                    "enum": [
                      "event",
                      "scheduled"
                    ],
                    "description": "How the action is triggered: on a business event or on a recurring schedule"
                  },
                  "event_trigger": {
                    "type": "string",
                    "enum": [
                      "created_in_stage",
                      "moved_to_stage",
                      "created_or_moved",
                      "responsible_changed",
                      "tag_changed",
                      "products_changed"
                    ],
                    "description": "Required when trigger_category=event. Which business event fires this action"
                  },
                  "scheduled_trigger": {
                    "type": "string",
                    "enum": [
                      "relative_to_field",
                      "specific_date",
                      "daily",
                      "weekly",
                      "monthly",
                      "yearly"
                    ],
                    "description": "Required when trigger_category=scheduled. Which schedule type"
                  },
                  "trigger_config": {
                    "type": "object",
                    "description": "Trigger-specific configuration. Shape varies by trigger type. Examples: {change_type, tag_ids} for tag_changed; {field_name, offset_hours, offset_direction} for relative_to_field; {hour, minute} for daily.",
                    "example": {
                      "hour": 9,
                      "minute": 0
                    }
                  },
                  "condition": {
                    "type": "object",
                    "description": "Optional condition tree evaluated before executing the action. If absent, the action always fires. Shape: {logic: '$and'|'$or', items: [{type, field_name, ...}]}",
                    "example": {
                      "logic": "$and",
                      "items": [
                        {
                          "type": "reference",
                          "field_name": "responsible_id",
                          "ref_ids": [
                            "64a1b2c3d4e5f6a7b8c9d0e1"
                          ],
                          "ref_logic": "$or"
                        }
                      ]
                    }
                  },
                  "action_type": {
                    "type": "string",
                    "enum": [
                      "auto_create_task",
                      "auto_assign_responsible",
                      "auto_change_field",
                      "auto_sms_send",
                      "webhook",
                      "complete_task",
                      "auto_change_state",
                      "add_tag",
                      "remove_tag",
                      "divide_leads"
                    ],
                    "description": "Which automation to execute when the trigger fires"
                  },
                  "action_config": {
                    "type": "object",
                    "description": "Action-specific configuration. Shape varies by action_type. Examples: {responsible_ids, mode} for auto_assign_responsible; {template_id, phone_field} for auto_sms_send; {url, method} for webhook; {state_id} for auto_change_state; {tag_ids} for add_tag/remove_tag.",
                    "example": {
                      "state_id": "64a1b2c3d4e5f6a7b8c9d0e2"
                    }
                  },
                  "name": {
                    "type": "string",
                    "description": "Optional display name for this automation rule"
                  },
                  "order": {
                    "type": "number",
                    "description": "Sort order within a pipeline state column"
                  },
                  "is_active": {
                    "type": "boolean",
                    "description": "Whether this action is currently enabled (defaults to true)"
                  },
                  "apply_to_existing": {
                    "type": "boolean",
                    "description": "If true, the action is applied to all existing matching sale orders immediately after creation (async, post-commit)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created pipeline action (with populated references)",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "Pipeline-action ObjectId"
                            },
                            "organization_id": {
                              "type": "string"
                            },
                            "state_id": {
                              "type": "string"
                            },
                            "state": {
                              "type": "object",
                              "description": "Populated pipeline state (name, bg_color) — present when state_id is set",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "bg_color": {
                                  "type": "string"
                                }
                              }
                            },
                            "trigger_category": {
                              "type": "string",
                              "enum": [
                                "event",
                                "scheduled"
                              ]
                            },
                            "event_trigger": {
                              "type": "string"
                            },
                            "scheduled_trigger": {
                              "type": "string"
                            },
                            "trigger_config": {
                              "type": "object"
                            },
                            "condition": {
                              "type": "object"
                            },
                            "action_type": {
                              "type": "string"
                            },
                            "action_config": {
                              "type": "object"
                            },
                            "name": {
                              "type": "string"
                            },
                            "order": {
                              "type": "number"
                            },
                            "is_active": {
                              "type": "boolean"
                            },
                            "apply_to_existing": {
                              "type": "boolean"
                            },
                            "last_checked_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/pipeline-action/get-by-id/{id}": {
      "get": {
        "tags": [
          "Pipeline-action"
        ],
        "description": "Fetch a single pipeline action by ObjectId, with populated references (state, integration, SMS template, tags, etc.).",
        "operationId": "pipeline-action-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Pipeline-action ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The pipeline action",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1pipeline-action~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/pipeline-action/get-paging": {
      "post": {
        "tags": [
          "Pipeline-action"
        ],
        "description": "Paginated list of pipeline actions. Filterable by organization, state, trigger category, or active status. References are not populated on list rows; use get-by-id for full detail.",
        "operationId": "pipeline-action-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string",
                        "description": "Filter by organization ObjectId"
                      },
                      "state_id": {
                        "type": "string",
                        "description": "Filter by pipeline state (column) ObjectId"
                      },
                      "trigger_category": {
                        "type": "string",
                        "enum": [
                          "event",
                          "scheduled"
                        ],
                        "description": "Filter by trigger category"
                      },
                      "is_active": {
                        "type": "boolean",
                        "description": "Filter by active/inactive status"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1pipeline-action~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/pipeline-action/update/{id}": {
      "put": {
        "tags": [
          "Pipeline-action"
        ],
        "description": "Update an existing pipeline action. Provide the full payload — partial updates are not supported.",
        "operationId": "pipeline-action-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Pipeline-action ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1pipeline-action~1create/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated pipeline action ObjectId",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "description": "Updated document ObjectId"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/pipeline-action/delete/{id}": {
      "delete": {
        "tags": [
          "Pipeline-action"
        ],
        "description": "Soft-delete a pipeline action (sets is_deleted=true). The action is immediately deactivated; any in-flight BullMQ jobs for this action will still complete.",
        "operationId": "pipeline-action-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Pipeline-action ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/pipeline-action/set-status/{id}": {
      "put": {
        "tags": [
          "Pipeline-action"
        ],
        "description": "Activate or deactivate a pipeline action. When deactivated (is_active=false) the action will not fire for new events or scheduled triggers.",
        "operationId": "pipeline-action-set-status",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Pipeline-action ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "is_active"
                ],
                "properties": {
                  "is_active": {
                    "type": "boolean",
                    "description": "Set to true to activate or false to deactivate the pipeline action"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated pipeline action ObjectId",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "description": "Updated document ObjectId"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/message-settings/get": {
      "post": {
        "tags": [
          "Message-settings"
        ],
        "description": "Get the message settings for a specific (bot_type, message_type) combination. Auto-creates the document with defaults if it does not exist yet. Because the resource is keyed by a composite — not an ObjectId — the request requires a body with both keys.",
        "operationId": "getMessageSettings",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "bot_type",
                  "message_type"
                ],
                "properties": {
                  "bot_type": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/bot_type"
                  },
                  "message_type": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/message_type"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The message settings document for the requested (bot_type, message_type)",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1message-settings~1set/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/message-settings/set": {
      "put": {
        "tags": [
          "Message-settings"
        ],
        "description": "Create or update the message settings for a specific (bot_type, message_type) combination. All ~80 DetailSettings toggle fields (show + position) are optional — omitted fields keep their existing values on update, or receive defaults on create.",
        "operationId": "setMessageSettings",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "bot_type",
                  "message_type"
                ],
                "properties": {
                  "bot_type": {
                    "type": "string",
                    "enum": [
                      "CUSTOMER_BOT",
                      "REPORT_BOT",
                      "SMS"
                    ],
                    "description": "Bot channel type"
                  },
                  "message_type": {
                    "type": "string",
                    "enum": [
                      "TRADE",
                      "PURCHASE",
                      "TRANSACTION",
                      "TRANSFER",
                      "PRODUCTION",
                      "TASK"
                    ],
                    "description": "Business event category the settings apply to"
                  },
                  "is_task_created": {
                    "type": "boolean",
                    "description": "Notify when a task is created"
                  },
                  "is_task_closed": {
                    "type": "boolean",
                    "description": "Notify when a task is closed"
                  },
                  "is_refund": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "sold_at": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "state": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "organization": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "seller": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "customer": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "note": {
                    "type": "object",
                    "properties": {
                      "show": {
                        "type": "boolean",
                        "description": "Whether this field is shown in the message"
                      },
                      "position": {
                        "type": "integer",
                        "description": "Display position (0-based)"
                      }
                    }
                  },
                  "total_amount": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "items": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "discount": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "included_tax": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "added_tax": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "total": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "payments": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "by_balance": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "is_installment_plan": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "debt": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "applied_cashbacks": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "initial_payment": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "purchase": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "balance": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "earned_cashback": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "marks": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "date": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "responsible": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "supplier": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "purchase_created_at": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "orders": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "transaction": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "transaction_type": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "cashbox": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "cashier": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "invoice": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "trade": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "employee": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "person": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "amount": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "payment_method": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "payment_type": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "production_number": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "used_warehouse": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "produced_warehouse": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "used_date": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "produced_date": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "currency": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "route_sheet": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "production_created_by": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "production_code": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "total_produced": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "total_used": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "total_cost": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "total_expense": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "link": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "state_changes": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "state_change": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "transfer": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "sender_organization": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "receiver_organization": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "sender_warehouse": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "sender_employee": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "reason": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "products": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "customer_balance": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "transfer_created_at": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "production_created_at": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "change": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "sign_amount": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "number": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "transaction_created_by": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "device_name": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "total_discount": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "task_type": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "task_description": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "result": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "task_deadline": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "task_created_at": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  },
                  "phone_number": {
                    "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created or updated message settings document",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "Document ObjectId"
                            },
                            "account_id": {
                              "type": "string",
                              "description": "Tenant identifier"
                            },
                            "bot_type": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/bot_type"
                            },
                            "message_type": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/message_type"
                            },
                            "is_task_created": {
                              "type": "boolean"
                            },
                            "is_task_closed": {
                              "type": "boolean"
                            },
                            "is_refund": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "sold_at": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "state": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "organization": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "seller": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "customer": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "note": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "total_amount": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "items": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "discount": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "included_tax": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "added_tax": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "total": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "payments": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "by_balance": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "is_installment_plan": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "debt": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "applied_cashbacks": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "initial_payment": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "purchase": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "balance": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "earned_cashback": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "marks": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "date": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "responsible": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "supplier": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "purchase_created_at": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "orders": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "transaction": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "transaction_type": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "cashbox": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "cashier": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "invoice": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "trade": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "employee": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "person": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "amount": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "payment_method": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "payment_type": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "production_number": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "used_warehouse": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "produced_warehouse": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "used_date": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "produced_date": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "currency": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "route_sheet": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "production_created_by": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "production_code": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "total_produced": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "total_used": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "total_cost": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "total_expense": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "link": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "state_changes": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "state_change": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "transfer": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "sender_organization": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "receiver_organization": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "sender_warehouse": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "sender_employee": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "reason": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "products": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "customer_balance": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "transfer_created_at": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "production_created_at": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "change": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "sign_amount": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "number": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "transaction_created_by": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "device_name": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "total_discount": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "task_type": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "task_description": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "result": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "task_deadline": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "task_created_at": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "phone_number": {
                              "$ref": "#/paths/~1message-settings~1set/put/requestBody/content/application~1json/schema/properties/note"
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/reminder-settings/get": {
      "get": {
        "tags": [
          "Reminder-settings"
        ],
        "parameters": [],
        "description": "Get the tenant's reminder settings (created with defaults on first access).",
        "operationId": "reminder-settings-get",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The reminder settings",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "description": "Per-tenant reminder settings singleton. Created with defaults (minute=0) on first access.",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "MongoDB ObjectId"
                            },
                            "account_id": {
                              "type": "string",
                              "description": "Tenant identifier (immutable)"
                            },
                            "minute": {
                              "type": "integer",
                              "minimum": 0,
                              "description": "Reminder lead time in minutes (>= 0)"
                            },
                            "is_deleted": {
                              "type": "boolean"
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/reminder-settings/set": {
      "put": {
        "tags": [
          "Reminder-settings"
        ],
        "description": "Update the tenant's reminder settings (partial patch). Only `minute` is settable.",
        "operationId": "reminder-settings-set",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Partial patch — send only the fields you want to change.",
                "properties": {
                  "minute": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Reminder lead time in minutes (>= 0)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated reminder settings",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1reminder-settings~1get/get/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/marketing-settings/get": {
      "get": {
        "tags": [
          "Marketing-settings"
        ],
        "parameters": [],
        "description": "Get the tenant's marketing settings (created with defaults on first access).",
        "operationId": "marketing-settings-get",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The marketing settings",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "expected_product_template_id": {
                              "type": "string"
                            },
                            "send_by_sms": {
                              "type": "boolean"
                            },
                            "send_by_bot": {
                              "type": "boolean"
                            },
                            "integration_id": {
                              "type": "string"
                            },
                            "template": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "content": {
                                  "type": "string"
                                }
                              }
                            },
                            "integration": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/marketing-settings/set": {
      "put": {
        "tags": [
          "Marketing-settings"
        ],
        "description": "Update the tenant's marketing settings (partial patch).",
        "operationId": "marketing-settings-set",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Partial patch — send only the fields you want to change.",
                "properties": {
                  "expected_product_template_id": {
                    "type": "string",
                    "description": "ObjectId of the SMS template used for the expected-product event notification"
                  },
                  "send_by_sms": {
                    "type": "boolean",
                    "description": "Whether to send expected-product notifications via SMS"
                  },
                  "send_by_bot": {
                    "type": "boolean",
                    "description": "Whether to send expected-product notifications via Telegram bot"
                  },
                  "integration_id": {
                    "type": "string",
                    "description": "ObjectId of the SMS integration to use for outgoing messages"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated marketing settings",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1marketing-settings~1get/get/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/public-lead-form/create": {
      "post": {
        "tags": [
          "Public-lead-form"
        ],
        "description": "Create a new public lead capture form with custom fields, styling, and page settings.",
        "operationId": "public-lead-form-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "organization_id",
                  "responsible_id",
                  "fields",
                  "page",
                  "settings",
                  "styles"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Display name of the lead form"
                  },
                  "organization_id": {
                    "type": "string",
                    "description": "Organization ObjectId the form belongs to"
                  },
                  "responsible_id": {
                    "type": "string",
                    "description": "Responsible user ObjectId"
                  },
                  "fields": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": [
                        "type",
                        "order"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "header",
                            "paragraph",
                            "line",
                            "logo",
                            "file",
                            "field"
                          ],
                          "description": "Element type"
                        },
                        "order": {
                          "type": "number",
                          "description": "Display order index"
                        },
                        "name": {
                          "type": "string",
                          "description": "Display name for the element"
                        },
                        "placeholder": {
                          "type": "string"
                        },
                        "validation_type": {
                          "type": "string",
                          "enum": [
                            "phone",
                            "email"
                          ],
                          "description": "Input validation rule (field elements only)"
                        },
                        "is_required": {
                          "type": "boolean"
                        },
                        "color": {
                          "type": "string"
                        },
                        "bold": {
                          "type": "boolean"
                        },
                        "italic": {
                          "type": "boolean"
                        },
                        "underline": {
                          "type": "boolean"
                        },
                        "text_align": {
                          "type": "string",
                          "enum": [
                            "left",
                            "right",
                            "center"
                          ]
                        },
                        "size": {
                          "type": "number"
                        },
                        "error_message": {
                          "type": "string"
                        },
                        "custom_field_id": {
                          "type": "string",
                          "description": "Custom field ObjectId (field elements only)"
                        }
                      }
                    },
                    "description": "Ordered list of form elements (header, paragraph, line, logo, file, field)"
                  },
                  "page": {
                    "type": "object",
                    "required": [
                      "background_color",
                      "background_type",
                      "header_active",
                      "header_type",
                      "header_text",
                      "header_text_color",
                      "header_text_font_size",
                      "margin_left",
                      "margin_right",
                      "margin_top",
                      "position"
                    ],
                    "properties": {
                      "background_color": {
                        "type": "string",
                        "description": "Page background color (hex)"
                      },
                      "background_image": {
                        "type": "string",
                        "description": "Page background image URL (when background_type is image)"
                      },
                      "background_type": {
                        "type": "string",
                        "enum": [
                          "color",
                          "image"
                        ]
                      },
                      "description": {
                        "type": "string"
                      },
                      "header_active": {
                        "type": "boolean"
                      },
                      "header_type": {
                        "type": "string",
                        "enum": [
                          "text",
                          "image"
                        ]
                      },
                      "header_text": {
                        "type": "string"
                      },
                      "header_text_color": {
                        "type": "string"
                      },
                      "header_image": {
                        "type": "string"
                      },
                      "header_text_font_size": {
                        "type": "number"
                      },
                      "margin_left": {
                        "type": "number"
                      },
                      "margin_right": {
                        "type": "number"
                      },
                      "margin_top": {
                        "type": "number"
                      },
                      "position": {
                        "type": "string",
                        "enum": [
                          "left",
                          "right",
                          "center"
                        ]
                      }
                    }
                  },
                  "settings": {
                    "type": "object",
                    "required": [
                      "autocomplete"
                    ],
                    "properties": {
                      "state_id": {
                        "type": "string",
                        "description": "Default state ObjectId for submitted leads"
                      },
                      "autocomplete": {
                        "type": "boolean",
                        "description": "Auto-complete submitted leads"
                      },
                      "success_message": {
                        "type": "string"
                      },
                      "has_redirect": {
                        "type": "boolean"
                      },
                      "redirect_url": {
                        "type": "string"
                      },
                      "redirect_delay": {
                        "type": "number",
                        "description": "Redirect delay in milliseconds"
                      },
                      "submit": {
                        "type": "string",
                        "description": "Submit button label"
                      },
                      "sidebar": {
                        "type": "object",
                        "required": [
                          "width",
                          "styles",
                          "type"
                        ],
                        "properties": {
                          "fields": {
                            "type": "object",
                            "additionalProperties": {
                              "type": "object",
                              "required": [
                                "code",
                                "element_type",
                                "name",
                                "position",
                                "sort",
                                "styles",
                                "type"
                              ],
                              "properties": {
                                "code": {
                                  "type": "string",
                                  "enum": [
                                    "header",
                                    "paragraph"
                                  ]
                                },
                                "element_type": {
                                  "type": "number"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "position": {
                                  "type": "string",
                                  "enum": [
                                    "left",
                                    "right",
                                    "center"
                                  ]
                                },
                                "sort": {
                                  "type": "number"
                                },
                                "styles": {
                                  "type": "object",
                                  "required": [
                                    "bold",
                                    "italic",
                                    "underline",
                                    "font_color",
                                    "font_size"
                                  ],
                                  "properties": {
                                    "bold": {
                                      "type": "boolean"
                                    },
                                    "italic": {
                                      "type": "boolean"
                                    },
                                    "underline": {
                                      "type": "boolean"
                                    },
                                    "font_color": {
                                      "type": "string"
                                    },
                                    "font_size": {
                                      "type": "number"
                                    }
                                  }
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "header",
                                    "paragraph"
                                  ]
                                }
                              }
                            },
                            "description": "Map of sidebar field key to sidebar element"
                          },
                          "width": {
                            "type": "number"
                          },
                          "styles": {
                            "type": "object",
                            "required": [
                              "background_color"
                            ],
                            "properties": {
                              "background_color": {
                                "type": "string"
                              },
                              "background_image": {
                                "type": "string"
                              }
                            }
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "left",
                              "right"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "styles": {
                    "type": "object",
                    "required": [
                      "field_margin",
                      "margin",
                      "field_background",
                      "field_border_color",
                      "field_form",
                      "field_height",
                      "submit_background",
                      "submit_bold",
                      "submit_italic",
                      "submit_underline",
                      "submit_border_radius",
                      "submit_color",
                      "submit_position",
                      "submit_width",
                      "width",
                      "height",
                      "form_border_color",
                      "form_border_radius",
                      "font",
                      "font_color",
                      "font_size",
                      "form_paddings",
                      "form_shadow",
                      "background",
                      "background_type",
                      "name_position"
                    ],
                    "properties": {
                      "field_margin": {
                        "type": "number"
                      },
                      "margin": {
                        "type": "boolean"
                      },
                      "field_background": {
                        "type": "string"
                      },
                      "field_border_color": {
                        "type": "string"
                      },
                      "field_form": {
                        "type": "string",
                        "enum": [
                          "rounded",
                          "square",
                          "line"
                        ]
                      },
                      "field_height": {
                        "type": "number"
                      },
                      "submit_background": {
                        "type": "string"
                      },
                      "submit_bold": {
                        "type": "boolean"
                      },
                      "submit_italic": {
                        "type": "boolean"
                      },
                      "submit_underline": {
                        "type": "boolean"
                      },
                      "submit_border_radius": {
                        "type": "string",
                        "enum": [
                          "square",
                          "rounded"
                        ]
                      },
                      "submit_color": {
                        "type": "string"
                      },
                      "submit_position": {
                        "type": "string",
                        "enum": [
                          "left",
                          "right",
                          "center"
                        ]
                      },
                      "submit_width": {
                        "type": "string",
                        "enum": [
                          "full_width",
                          "own"
                        ]
                      },
                      "width": {
                        "type": "number"
                      },
                      "height": {
                        "type": "number"
                      },
                      "form_border_color": {
                        "type": "string"
                      },
                      "form_border_radius": {
                        "type": "number"
                      },
                      "font": {
                        "type": "string"
                      },
                      "font_color": {
                        "type": "string"
                      },
                      "font_size": {
                        "type": "number"
                      },
                      "form_paddings": {
                        "type": "boolean"
                      },
                      "form_shadow": {
                        "type": "boolean"
                      },
                      "background": {
                        "type": "string"
                      },
                      "background_type": {
                        "type": "string",
                        "enum": [
                          "color",
                          "image"
                        ]
                      },
                      "name_position": {
                        "type": "string",
                        "enum": [
                          "left",
                          "top"
                        ]
                      }
                    }
                  },
                  "css": {
                    "type": "string",
                    "description": "Optional custom CSS overrides"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created lead form",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "allOf": [
                            {
                              "$ref": "#/paths/~1public-lead-form~1create/post/requestBody/content/application~1json/schema"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Public lead form ObjectId"
                                },
                                "is_deleted": {
                                  "type": "boolean",
                                  "description": "Soft-delete flag"
                                },
                                "created_at": {
                                  "type": "string",
                                  "format": "date-time",
                                  "description": "Creation timestamp (ISO 8601)"
                                },
                                "updated_at": {
                                  "type": "string",
                                  "format": "date-time",
                                  "description": "Last update timestamp (ISO 8601)"
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/public-lead-form/update/{id}": {
      "put": {
        "tags": [
          "Public-lead-form"
        ],
        "description": "Update an existing public lead form by its ObjectId.",
        "operationId": "public-lead-form-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Lead form ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1public-lead-form~1create/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "required": [
                      "_id"
                    ],
                    "properties": {
                      "_id": {
                        "type": "string",
                        "description": "Lead form ObjectId to update"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated lead form",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1public-lead-form~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/public-lead-form/get-by-id/{id}": {
      "get": {
        "tags": [
          "Public-lead-form"
        ],
        "description": "Fetch a single public lead form by its ObjectId.",
        "operationId": "public-lead-form-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Lead form ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The lead form",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1public-lead-form~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/public-lead-form/get-paging": {
      "post": {
        "tags": [
          "Public-lead-form"
        ],
        "description": "Paginated list of public lead forms, optionally filtered by organization.",
        "operationId": "public-lead-form-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string",
                        "description": "Filter by organization ObjectId"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list of lead forms",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1public-lead-form~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/public-lead-form/delete/{id}": {
      "delete": {
        "tags": [
          "Public-lead-form"
        ],
        "description": "Soft-delete a public lead form by its ObjectId.",
        "operationId": "public-lead-form-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Lead form ObjectId to delete",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful deletion",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sms-template/create": {
      "post": {
        "tags": [
          "Sms-template"
        ],
        "description": "Create a new SMS template for the tenant.",
        "operationId": "sms-template-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "content"
                ],
                "properties": {
                  "content": {
                    "type": "string",
                    "description": "SMS message body text"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created SMS template",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "SMS template ObjectId"
                            },
                            "account_id": {
                              "type": "string",
                              "description": "Tenant identifier (immutable, injected server-side)"
                            },
                            "content": {
                              "type": "string",
                              "description": "SMS message body text"
                            },
                            "is_deleted": {
                              "type": "boolean",
                              "description": "Soft-delete flag"
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time",
                              "description": "Creation timestamp (ISO 8601)"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time",
                              "description": "Last update timestamp (ISO 8601)"
                            },
                            "created_by": {
                              "type": "string",
                              "description": "ObjectId of the user who created this template"
                            },
                            "updated_by": {
                              "type": "string",
                              "description": "ObjectId of the user who last updated this template"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sms-template/get-by-id/{id}": {
      "get": {
        "tags": [
          "Sms-template"
        ],
        "description": "Fetch a single SMS template by ObjectId.",
        "operationId": "sms-template-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "SMS template ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The SMS template",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1sms-template~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sms-template/get-paging": {
      "post": {
        "tags": [
          "Sms-template"
        ],
        "description": "Paginated list of SMS templates scoped to the tenant.",
        "operationId": "sms-template-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list of SMS templates",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1sms-template~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/sms-template/update/{id}": {
      "put": {
        "tags": [
          "Sms-template"
        ],
        "description": "Update an existing SMS template by ObjectId.",
        "operationId": "sms-template-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "SMS template ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "content"
                ],
                "properties": {
                  "content": {
                    "type": "string",
                    "description": "SMS message body text"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated SMS template",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1sms-template~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sms-template/delete/{id}": {
      "delete": {
        "tags": [
          "Sms-template"
        ],
        "description": "Soft-delete an SMS template by ObjectId (sets is_deleted=true).",
        "operationId": "sms-template-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "SMS template ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/device/create": {
      "post": {
        "tags": [
          "Device"
        ],
        "description": "Register a new POS device. The backend auto-assigns a device_sign and sets status=approved.",
        "operationId": "device-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Device display name"
                  },
                  "record_calls": {
                    "type": "boolean",
                    "description": "Whether the device records calls"
                  },
                  "multiple_user": {
                    "type": "boolean",
                    "description": "Whether multiple users can share the device"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created device document",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "Device ObjectId"
                            },
                            "name": {
                              "type": "string",
                              "description": "Device display name"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "pending",
                                "approved",
                                "blocked"
                              ],
                              "description": "Device lifecycle status"
                            },
                            "device_sign": {
                              "type": "string",
                              "description": "Auto-generated unique device sign (counter-based)"
                            },
                            "device_name": {
                              "type": "string",
                              "description": "OS-reported device name (set during device activation)"
                            },
                            "imei": {
                              "type": "string",
                              "description": "Device IMEI (set during activation; absent for unused devices)"
                            },
                            "release_type": {
                              "type": "string",
                              "enum": [
                                "store",
                                "standalone"
                              ],
                              "description": "Android release type (set during activation)"
                            },
                            "record_calls": {
                              "type": "boolean",
                              "description": "Whether the device records calls"
                            },
                            "multiple_user": {
                              "type": "boolean",
                              "description": "Whether multiple users can share the device"
                            },
                            "os": {
                              "type": "string",
                              "description": "Operating system reported by the device"
                            },
                            "used_by": {
                              "type": "string",
                              "description": "ObjectId of the user who last activated the device"
                            },
                            "receipt_counter": {
                              "type": "number",
                              "description": "Last receipt counter value on this device"
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/device/update/{id}": {
      "put": {
        "tags": [
          "Device"
        ],
        "description": "Update an existing POS device's name, record_calls, or multiple_user flag.",
        "operationId": "device-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Device ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Device display name"
                  },
                  "record_calls": {
                    "type": "boolean",
                    "description": "Whether the device records calls"
                  },
                  "multiple_user": {
                    "type": "boolean",
                    "description": "Whether multiple users can share the device"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated device ObjectId",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "description": "Device ObjectId"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/device/set-status/{id}": {
      "put": {
        "tags": [
          "Device"
        ],
        "description": "Transition a device to a new status (pending | approved | blocked). Transitioning to blocked terminates all active sessions for the device. No-op when the target status equals the current status.",
        "operationId": "device-set-status",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Device ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "status"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "pending",
                      "approved",
                      "blocked"
                    ],
                    "description": "New device status. Transitioning to blocked terminates all active sessions for the device."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The device ObjectId after status transition",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "description": "Device ObjectId"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/device/delete/{id}": {
      "delete": {
        "tags": [
          "Device"
        ],
        "description": "Soft-delete a POS device (sets is_deleted=true). Fails if the device has an open cashbox session.",
        "operationId": "device-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Device ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful soft-delete",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "description": "Deleted device ObjectId"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/device/get-by-id/{id}": {
      "get": {
        "tags": [
          "Device"
        ],
        "description": "Fetch a single POS device by ObjectId.",
        "operationId": "device-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Device ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The device document",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1device~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/device/get-paging": {
      "post": {
        "tags": [
          "Device"
        ],
        "description": "Paginated list of registered POS devices. Filterable by usage state, IMEI, and Android release type.",
        "operationId": "device-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "is_used": {
                        "type": "boolean",
                        "description": "Filter by whether the device is currently in use (has an IMEI)"
                      },
                      "imei": {
                        "type": "string",
                        "description": "Filter by exact IMEI string"
                      },
                      "release_type": {
                        "type": "string",
                        "enum": [
                          "store",
                          "standalone"
                        ],
                        "description": "Filter by Android release type"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list of devices",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1device~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/states-settings/create": {
      "post": {
        "tags": [
          "States-settings"
        ],
        "description": "Create a custom workflow state column for an organization and domain type.",
        "operationId": "states-settings-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "organization_id",
                  "name",
                  "type",
                  "order"
                ],
                "properties": {
                  "organization_id": {
                    "type": "string",
                    "description": "Organization ObjectId this state column belongs to"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256,
                    "description": "Display name of the state column"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "trades",
                      "saleOrders",
                      "deliveryOrders",
                      "purchases",
                      "purchaseOrders",
                      "purchaseRequests"
                    ],
                    "description": "The domain this state column belongs to (STATE_TYPE)"
                  },
                  "order": {
                    "type": "number",
                    "description": "Display order within the same type; siblings are re-sequenced automatically"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "Optional descriptive note for the state column"
                  },
                  "bg_color": {
                    "type": "string",
                    "description": "Background color hex code, e.g. #F1F2F4"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created state column",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "type": {
                              "type": "string"
                            },
                            "is_default": {
                              "type": "boolean"
                            },
                            "default_key": {
                              "type": "string"
                            },
                            "organization_id": {
                              "type": "string"
                            }
                          },
                          "type": "object",
                          "required": [
                            "_id",
                            "name",
                            "organization_id",
                            "type"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/states-settings/get-by-id/{id}": {
      "get": {
        "tags": [
          "States-settings"
        ],
        "description": "Fetch a single workflow state column by ObjectId.",
        "operationId": "states-settings-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "State column ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The state column",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1states-settings~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/states-settings/get-paging": {
      "post": {
        "tags": [
          "States-settings"
        ],
        "description": "Flat sorted list of workflow state columns. Filterable by type, organization, and is_default. Returns a plain array sorted by {type, order} — not a {list, total} envelope.",
        "operationId": "states-settings-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "trades",
                      "saleOrders",
                      "deliveryOrders",
                      "purchases",
                      "purchaseOrders",
                      "purchaseRequests"
                    ],
                    "description": "Filter by STATE_TYPE domain"
                  },
                  "types": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "trades",
                        "saleOrders",
                        "deliveryOrders",
                        "purchases",
                        "purchaseOrders",
                        "purchaseRequests"
                      ]
                    },
                    "description": "Filter by multiple STATE_TYPE values"
                  },
                  "organization_id": {
                    "type": "string",
                    "description": "Filter by organization ObjectId"
                  },
                  "is_default": {
                    "type": "boolean",
                    "description": "When true, return only default (system-seeded) columns; false returns custom ones only"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Array of state columns sorted by type then order",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1states-settings~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/states-settings/update/{id}": {
      "put": {
        "tags": [
          "States-settings"
        ],
        "description": "Update an existing workflow state column. Changing order re-sequences sibling columns of the same type. order is silently dropped for default (system-seeded) columns.",
        "operationId": "states-settings-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "State column ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256,
                    "description": "New display name"
                  },
                  "order": {
                    "type": "number",
                    "description": "New display order. Silently dropped for default columns."
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "Updated note"
                  },
                  "bg_color": {
                    "type": "string",
                    "description": "Updated background color hex code"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated state column",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1states-settings~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/states-settings/delete/{id}": {
      "delete": {
        "tags": [
          "States-settings"
        ],
        "description": "Soft-delete a workflow state column (sets is_deleted=true). Guarded: default columns cannot be deleted, and columns still referenced by trade/sale-order/delivery-order documents are rejected with an error.",
        "operationId": "states-settings-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "State column ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ObjectId of the soft-deleted state column",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "description": "ObjectId of the deleted state column"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/tag/create": {
      "post": {
        "tags": [
          "Tag"
        ],
        "description": "Create a new tag. Tags can be scoped to one or more entity types (customer, supplier, product, employee, crm_order). is_active defaults to true.",
        "operationId": "tag-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "entity_scopes"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Tag display name"
                  },
                  "entity_scopes": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string",
                      "enum": [
                        "customer",
                        "supplier",
                        "product",
                        "employee",
                        "crm_order"
                      ]
                    },
                    "description": "Entity types this tag can be applied to — at least one required"
                  },
                  "color": {
                    "type": "string",
                    "pattern": "^#[0-9A-Fa-f]{6}$",
                    "description": "Hex color code, format #RRGGBB (e.g. #FF5733)"
                  },
                  "is_active": {
                    "type": "boolean",
                    "description": "Whether this tag is active. Defaults to true."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created tag",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "Tag ObjectId"
                            },
                            "name": {
                              "type": "string",
                              "description": "Tag display name"
                            },
                            "color": {
                              "type": "string",
                              "description": "Hex color code, format #RRGGBB (e.g. #FF5733)"
                            },
                            "entity_scopes": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "customer",
                                  "supplier",
                                  "product",
                                  "employee",
                                  "crm_order"
                                ]
                              },
                              "description": "Entity types this tag can be applied to"
                            },
                            "is_system": {
                              "type": "boolean",
                              "description": "System tags are created by Bito and cannot be deleted"
                            },
                            "is_active": {
                              "type": "boolean",
                              "description": "Whether this tag is active and available for use"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/tag/get-by-id/{id}": {
      "get": {
        "tags": [
          "Tag"
        ],
        "description": "Fetch a single tag by its ObjectId.",
        "operationId": "tag-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Tag ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The tag",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1tag~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/tag/get-paging": {
      "post": {
        "tags": [
          "Tag"
        ],
        "description": "Paginated list of tags. Filter by entity_scopes and/or is_active.",
        "operationId": "tag-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "entity_scopes": {
                        "type": "array",
                        "maxItems": 500,
                        "items": {
                          "type": "string",
                          "enum": [
                            "customer",
                            "supplier",
                            "product",
                            "employee",
                            "crm_order"
                          ]
                        },
                        "description": "Filter by entity type(s)"
                      },
                      "is_active": {
                        "type": "boolean",
                        "description": "Filter by active state. Omit to return all tags."
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list of tags",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1tag~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/tag/update/{id}": {
      "put": {
        "tags": [
          "Tag"
        ],
        "description": "Update an existing tag by ObjectId. All fields are optional; only provided fields are updated. entity_scopes must have at least one value if provided.",
        "operationId": "tag-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Tag ObjectId to update",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Updated tag display name"
                  },
                  "entity_scopes": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string",
                      "enum": [
                        "customer",
                        "supplier",
                        "product",
                        "employee",
                        "crm_order"
                      ]
                    },
                    "description": "Updated entity scopes — at least one required if provided"
                  },
                  "color": {
                    "type": "string",
                    "pattern": "^#[0-9A-Fa-f]{6}$",
                    "description": "Updated hex color code, format #RRGGBB"
                  },
                  "is_active": {
                    "type": "boolean",
                    "description": "Toggle tag active state"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated tag",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1tag~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/tag/delete/{id}": {
      "delete": {
        "tags": [
          "Tag"
        ],
        "description": "Soft-delete a tag by ObjectId (sets is_deleted=true). Returns 400 if the tag is a system tag (is_system=true) — system tags cannot be deleted.",
        "operationId": "tag-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Tag ObjectId to delete",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful soft-delete",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/source/get-all": {
      "post": {
        "tags": [
          "Source"
        ],
        "description": "Return all lead/customer acquisition sources for the tenant. Optionally filter by source type.",
        "operationId": "source-get-all",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Optional filter parameters for the get-all request body.",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "user",
                      "system",
                      "integration",
                      "lead_form"
                    ],
                    "description": "Filter sources by origin category (forward-compatible — not yet applied server-side)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Array of sources",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/paths/~1source~1get-by-id~1%7Bid%7D/get/responses/200/content/application~1json/schema/allOf/1/properties/data"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/source/get-by-id/{id}": {
      "get": {
        "tags": [
          "Source"
        ],
        "description": "Fetch a single acquisition source by its ObjectId.",
        "operationId": "source-get-by-id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Source ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The source",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "description": "A lead/customer acquisition channel source record.",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "Source ObjectId"
                            },
                            "name": {
                              "type": "string",
                              "description": "Display name of the source (e.g. 'Instagram', 'Walk-in', 'Referral')"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "user",
                                "system",
                                "integration",
                                "lead_form"
                              ],
                              "description": "Origin category of the source"
                            },
                            "integration_id": {
                              "type": "string",
                              "description": "ObjectId of the linked integration, if type is 'integration'"
                            },
                            "is_visible": {
                              "type": "boolean",
                              "description": "Whether the source is shown in customer-facing selection lists"
                            },
                            "is_deleted": {
                              "type": "boolean",
                              "description": "Soft-delete flag"
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time",
                              "description": "Creation timestamp"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time",
                              "description": "Last update timestamp"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/kpi-settings/create": {
      "post": {
        "tags": [
          "Kpi-settings"
        ],
        "description": "Create a new KPI settings record for a given period and set of employees.",
        "operationId": "kpi-settings-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "organization_id",
                  "currency_id",
                  "user_ids",
                  "period",
                  "calculation_method",
                  "date_from",
                  "date_to",
                  "year",
                  "conditions",
                  "bonus_metric_code",
                  "bonuses"
                ],
                "properties": {
                  "organization_id": {
                    "type": "string",
                    "description": "Organization ObjectId this KPI setting belongs to"
                  },
                  "name": {
                    "type": "string",
                    "description": "Optional display name for the KPI setting"
                  },
                  "currency_id": {
                    "type": "string",
                    "description": "Currency ObjectId used for monetary KPI metrics"
                  },
                  "user_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "ObjectIds of the employees this KPI setting applies to"
                  },
                  "period": {
                    "type": "string",
                    "enum": [
                      "week",
                      "month",
                      "quarter",
                      "year"
                    ],
                    "description": "KPI evaluation period"
                  },
                  "calculation_method": {
                    "type": "string",
                    "enum": [
                      "progressive",
                      "threshold"
                    ],
                    "description": "How the bonus is calculated across tiers: progressive (each tier adds to the previous) or threshold (only the matched tier applies)"
                  },
                  "date_from": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Start date of the KPI period"
                  },
                  "date_to": {
                    "type": "string",
                    "format": "date-time",
                    "description": "End date of the KPI period"
                  },
                  "year": {
                    "type": "number",
                    "description": "Calendar year of the KPI period"
                  },
                  "quarter": {
                    "type": "string",
                    "description": "Quarter label (e.g. Q1) when period is quarter"
                  },
                  "month": {
                    "type": "string",
                    "description": "Month label when period is month"
                  },
                  "week": {
                    "type": "string",
                    "description": "Week label when period is week"
                  },
                  "filter_enabled": {
                    "type": "boolean",
                    "description": "Whether product/customer filters are active for this KPI setting",
                    "default": false
                  },
                  "filter": {
                    "type": "object",
                    "description": "Optional product and customer scope filters",
                    "properties": {
                      "is_all_categories": {
                        "type": "boolean"
                      },
                      "customer_category_ids": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "Customer category ObjectIds to include"
                      },
                      "customer_nested_category_ids": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "customer_ids": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "Specific customer ObjectIds to include"
                      },
                      "product_category_ids": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "product_nested_category_ids": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "product_ids": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "Specific product ObjectIds to include"
                      }
                    }
                  },
                  "conditions": {
                    "type": "array",
                    "description": "One or more KPI plan conditions defining the performance metric and tier thresholds",
                    "items": {
                      "type": "object",
                      "required": [
                        "logical_operator",
                        "source_metric_code",
                        "tiers"
                      ],
                      "properties": {
                        "logical_operator": {
                          "type": "boolean",
                          "description": "true = AND with the next condition, false = OR"
                        },
                        "source_metric_code": {
                          "type": "string",
                          "enum": [
                            "net_sales",
                            "sales_count",
                            "avg_net_sales",
                            "profit",
                            "paid",
                            "paid_percent",
                            "items_sold"
                          ],
                          "description": "The performance metric used to evaluate this condition"
                        },
                        "tiers": {
                          "type": "array",
                          "description": "Threshold tiers for this condition",
                          "items": {
                            "type": "object",
                            "required": [
                              "min_value"
                            ],
                            "properties": {
                              "min_value": {
                                "type": "number",
                                "description": "Minimum metric value for this tier to activate"
                              },
                              "max_value": {
                                "type": "number",
                                "description": "Maximum metric value for this tier (omit for the top tier)"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "bonus_metric_code": {
                    "type": "string",
                    "enum": [
                      "percent_of_net_sales",
                      "percent_of_payment",
                      "percent_of_profit",
                      "per_sale",
                      "fixed_amount",
                      "per_item_sold"
                    ],
                    "description": "How the bonus amount is computed from the employee's results"
                  },
                  "bonuses": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "description": "Bonus amounts or percentages, one entry per tier in the conditions"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created KPI settings record",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "KPI settings ObjectId"
                            },
                            "organization_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "currency_id": {
                              "type": "string"
                            },
                            "user_ids": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "period": {
                              "type": "string",
                              "enum": [
                                "week",
                                "month",
                                "quarter",
                                "year"
                              ]
                            },
                            "calculation_method": {
                              "type": "string",
                              "enum": [
                                "progressive",
                                "threshold"
                              ]
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "draft",
                                "active",
                                "locked",
                                "approved",
                                "canceled"
                              ]
                            },
                            "date_from": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "date_to": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "year": {
                              "type": "number"
                            },
                            "quarter": {
                              "type": "string"
                            },
                            "month": {
                              "type": "string"
                            },
                            "week": {
                              "type": "string"
                            },
                            "filter_enabled": {
                              "type": "boolean"
                            },
                            "filter": {
                              "type": "object",
                              "properties": {
                                "is_all_categories": {
                                  "type": "boolean"
                                },
                                "customer_category_ids": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "customer_nested_category_ids": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "customer_ids": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "product_category_ids": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "product_nested_category_ids": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "product_ids": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              }
                            },
                            "conditions": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "logical_operator": {
                                    "type": "boolean"
                                  },
                                  "source_metric_code": {
                                    "type": "string",
                                    "enum": [
                                      "net_sales",
                                      "sales_count",
                                      "avg_net_sales",
                                      "profit",
                                      "paid",
                                      "paid_percent",
                                      "items_sold"
                                    ]
                                  },
                                  "tiers": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "min_value": {
                                          "type": "number"
                                        },
                                        "max_value": {
                                          "type": "number"
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "bonus_metric_code": {
                              "type": "string",
                              "enum": [
                                "percent_of_net_sales",
                                "percent_of_payment",
                                "percent_of_profit",
                                "per_sale",
                                "fixed_amount",
                                "per_item_sold"
                              ]
                            },
                            "bonuses": {
                              "type": "array",
                              "items": {
                                "type": "number"
                              }
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "is_deleted": {
                              "type": "boolean"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/kpi-settings/get-by-id/{id}": {
      "get": {
        "tags": [
          "Kpi-settings"
        ],
        "description": "Fetch a single KPI settings record by ObjectId.",
        "operationId": "kpi-settings-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "KPI settings ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The KPI settings record",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1kpi-settings~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/kpi-settings/get-paging": {
      "post": {
        "tags": [
          "Kpi-settings"
        ],
        "description": "Paginated list of KPI settings records, optionally filtered by organization or period.",
        "operationId": "kpi-settings-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "organization_id": {
                        "type": "string",
                        "description": "Filter by organization ObjectId"
                      },
                      "period": {
                        "type": "string",
                        "enum": [
                          "week",
                          "month",
                          "quarter",
                          "year"
                        ],
                        "description": "Filter by KPI period"
                      },
                      "state": {
                        "type": "string",
                        "enum": [
                          "draft",
                          "active",
                          "locked",
                          "approved",
                          "canceled"
                        ],
                        "description": "Filter by KPI settings state"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list of KPI settings",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1kpi-settings~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/kpi-settings/update/{id}": {
      "put": {
        "tags": [
          "Kpi-settings"
        ],
        "description": "Update an existing KPI settings record.",
        "operationId": "kpi-settings-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "KPI settings ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1kpi-settings~1create/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated KPI settings record",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1kpi-settings~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/kpi-settings/delete/{id}": {
      "delete": {
        "tags": [
          "Kpi-settings"
        ],
        "description": "Soft-delete a KPI settings record by ObjectId.",
        "operationId": "kpi-settings-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "KPI settings ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/kpi-settings/set-status/{id}": {
      "put": {
        "tags": [
          "Kpi-settings"
        ],
        "description": "Change the status (state) of a KPI settings record. Allowed transitions: locked, approved, canceled.",
        "operationId": "kpi-settings-set-status",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "KPI settings ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "status"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "locked",
                      "approved",
                      "canceled"
                    ],
                    "description": "New status for the KPI settings record"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated KPI settings record with new status",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1kpi-settings~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/reason/create": {
      "post": {
        "tags": [
          "Reason"
        ],
        "description": "Create a new reason. Reasons are configurable reference data used in business flows such as supplier returns, customer returns, purchase requests, order cancellations, transfers, write-offs, and more. name is required; type should be provided (model requires it — omitting type produces a validation error). is_active defaults to false.",
        "operationId": "reason-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Reason display name (required)"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "supplier_return",
                      "customer_return",
                      "purchase_request",
                      "contract_cancel",
                      "order_cancel",
                      "transfer",
                      "transfer_cancel",
                      "write_off",
                      "visit_reject",
                      "delivery_order_cancel",
                      "task"
                    ],
                    "description": "Reason type — determines which business flow this reason applies to. Note: the model requires a type; omitting it will produce a Mongoose validation error."
                  },
                  "description": {
                    "type": "string",
                    "description": "Optional description"
                  },
                  "is_active": {
                    "type": "boolean",
                    "description": "Whether this reason is active. Defaults to false."
                  },
                  "is_trash": {
                    "type": "boolean",
                    "description": "Whether this reason is for trash/disposal flows."
                  },
                  "code": {
                    "type": "string",
                    "description": "Optional short code identifier for the reason."
                  },
                  "order_number": {
                    "type": "number",
                    "description": "Sort order (ascending). Used to control display order."
                  },
                  "color": {
                    "type": "string",
                    "pattern": "^#[0-9A-Fa-f]{6}$",
                    "description": "Hex color code, format #RRGGBB (e.g. #FF5733)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created reason",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "Reason ObjectId"
                            },
                            "name": {
                              "type": "string",
                              "description": "Reason display name"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "supplier_return",
                                "customer_return",
                                "purchase_request",
                                "contract_cancel",
                                "order_cancel",
                                "transfer",
                                "transfer_cancel",
                                "write_off",
                                "visit_reject",
                                "delivery_order_cancel",
                                "task"
                              ],
                              "description": "Reason type — determines which business flow this reason applies to"
                            },
                            "description": {
                              "type": "string",
                              "description": "Optional description"
                            },
                            "is_active": {
                              "type": "boolean",
                              "description": "Whether this reason is active"
                            },
                            "is_trash": {
                              "type": "boolean",
                              "description": "Whether this reason is for trash/disposal flows"
                            },
                            "code": {
                              "type": "string",
                              "description": "Short code identifier"
                            },
                            "order_number": {
                              "type": "number",
                              "description": "Sort order (ascending)"
                            },
                            "color": {
                              "type": "string",
                              "description": "Hex color code, format #RRGGBB"
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time",
                              "description": "Creation timestamp"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time",
                              "description": "Last update timestamp"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/reason/get-by-id/{id}": {
      "get": {
        "tags": [
          "Reason"
        ],
        "description": "Fetch a single reason by its ObjectId.",
        "operationId": "reason-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Reason ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The reason",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1reason~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/reason/get-paging": {
      "post": {
        "tags": [
          "Reason"
        ],
        "description": "Paginated list of reasons. Filter by type (supplier_return, customer_return, purchase_request, contract_cancel, order_cancel, transfer, transfer_cancel, write_off, visit_reject, delivery_order_cancel, task) and/or is_active. Results sorted by order_number asc, _id desc (or sort_by override).",
        "operationId": "reason-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "supplier_return",
                          "customer_return",
                          "purchase_request",
                          "contract_cancel",
                          "order_cancel",
                          "transfer",
                          "transfer_cancel",
                          "write_off",
                          "visit_reject",
                          "delivery_order_cancel",
                          "task"
                        ],
                        "description": "Filter by reason type. Omit to return reasons of all types."
                      },
                      "is_active": {
                        "type": "boolean",
                        "description": "Filter by active state. Omit to return both active and inactive reasons."
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list of reasons",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1reason~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/reason/update/{id}": {
      "put": {
        "tags": [
          "Reason"
        ],
        "description": "Update an existing reason by ObjectId. All fields are optional; only provided fields are updated. name must be non-empty if provided.",
        "operationId": "reason-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Reason ObjectId to update",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Updated reason display name"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "supplier_return",
                      "customer_return",
                      "purchase_request",
                      "contract_cancel",
                      "order_cancel",
                      "transfer",
                      "transfer_cancel",
                      "write_off",
                      "visit_reject",
                      "delivery_order_cancel",
                      "task"
                    ],
                    "description": "Updated reason type"
                  },
                  "description": {
                    "type": "string",
                    "description": "Updated description"
                  },
                  "is_active": {
                    "type": "boolean",
                    "description": "Toggle active state"
                  },
                  "is_trash": {
                    "type": "boolean",
                    "description": "Toggle trash/disposal flag"
                  },
                  "code": {
                    "type": "string",
                    "description": "Updated short code identifier"
                  },
                  "order_number": {
                    "type": "number",
                    "description": "Updated sort order"
                  },
                  "color": {
                    "type": "string",
                    "pattern": "^#[0-9A-Fa-f]{6}$",
                    "description": "Updated hex color code, format #RRGGBB"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated reason",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1reason~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/reason/delete/{id}": {
      "delete": {
        "tags": [
          "Reason"
        ],
        "description": "Soft-delete a reason by ObjectId (sets is_deleted=true). Returns 400 if the reason is not found.",
        "operationId": "reason-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Reason ObjectId to delete",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful soft-delete",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sale-order/delete-many": {
      "post": {
        "tags": [
          "Sale Order Bulk"
        ],
        "description": "Soft-delete multiple sale orders in a single call (sets is_deleted=true on each). Pass a non-empty array of ObjectIds in ids. Returns the async process record produced by the bulk operation.",
        "operationId": "sale-order-bulk-delete-many",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "ids"
                ],
                "properties": {
                  "ids": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string",
                      "description": "Sale order ObjectId"
                    },
                    "description": "Non-empty list of sale order ObjectIds to soft-delete"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bulk delete process record",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "description": "Async process record returned by the bulk delete operation"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sale-order/update-status-many": {
      "post": {
        "tags": [
          "Sale Order Bulk"
        ],
        "description": "Update the kanban state of multiple sale orders in a single call. Pass a non-empty array of ObjectIds in ids and the target state_id (ObjectId of the States document). Integrations may set reject_if_has_trades=true to atomically reject the whole change if any selected order already owns financial history. Returns the async process record produced by the bulk operation.",
        "operationId": "sale-order-bulk-update-status-many",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "ids",
                  "state_id"
                ],
                "properties": {
                  "ids": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string",
                      "description": "Sale order ObjectId"
                    },
                    "description": "Non-empty list of sale order ObjectIds whose status will be updated"
                  },
                  "state_id": {
                    "type": "string",
                    "description": "ObjectId of the target States document (kanban column) to move the sale orders into"
                  },
                  "reject_if_has_trades": {
                    "type": "boolean",
                    "default": false,
                    "description": "Optional integration safety fence. When true, Bito checks every selected sale order for trade status, non-zero sold total, and linked trade documents inside the same transaction as the state change. If any financial document exists, the entire state update is rejected. Intended for external cancellation flows; omitting it preserves existing behavior."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bulk update-status process record",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "description": "Async process record returned by the bulk state-update operation"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/product/delete-many": {
      "post": {
        "tags": [
          "Product"
        ],
        "description": "Soft-delete multiple products by their ObjectIds. Each product is marked is_deleted=true; no physical deletion occurs. Products that are currently in stock, in transit, on-the-way, or booked cannot be deleted and will return an error.",
        "operationId": "product-delete-many",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "ids"
                ],
                "properties": {
                  "ids": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string",
                      "description": "Product ObjectId"
                    },
                    "description": "List of product ObjectIds to soft-delete"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Array of deleted product ObjectIds",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "ObjectIds of the soft-deleted products"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/product/update-status-many": {
      "post": {
        "tags": [
          "Product"
        ],
        "description": "Archive or unarchive multiple products by their ObjectIds. Set is_archived=true to archive, false to unarchive. Archived products remain visible but are excluded from active product lookups by default.",
        "operationId": "product-update-status-many",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "ids"
                ],
                "properties": {
                  "ids": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string",
                      "description": "Product ObjectId"
                    },
                    "description": "List of product ObjectIds to archive or unarchive"
                  },
                  "is_archived": {
                    "type": "boolean",
                    "description": "true to archive the products, false to unarchive them. Defaults to true when omitted."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Array of updated product ObjectIds",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "ObjectIds of the updated products"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/customer/delete-many": {
      "post": {
        "tags": [
          "Customer Bulk"
        ],
        "description": "Soft-delete multiple customers in a single call (sets is_deleted=true on each). Pass either an explicit list of ObjectIds in ids, or set is_all=true with optional filters to delete all matched customers. Returns the count of deleted documents.",
        "operationId": "customer-bulk-delete-many",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ids": {
                    "type": "array",
                    "maxItems": 500,
                    "items": {
                      "type": "string"
                    },
                    "description": "Explicit list of customer ObjectIds to soft-delete. Mutually exclusive with is_all=true."
                  },
                  "is_all": {
                    "type": "boolean",
                    "description": "When true, soft-delete all customers matched by the optional filters. Must not be combined with ids."
                  },
                  "search": {
                    "type": "string",
                    "description": "Optional text search filter applied when is_all=true. Matches against customer name, phone, and similar indexed fields."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Number of customers soft-deleted",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "deleted_count": {
                              "type": "number",
                              "description": "Number of customer documents that were soft-deleted"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/file/upload": {
      "post": {
        "tags": [
          "File"
        ],
        "description": "Upload a file as base64. Stores it in object storage and returns the storage key (a string in `data`). Use that key as the file field (e.g. `path`, `image`) when creating/updating a record, or pass it to /file/attach. base64-only — no remote URL fetching (no SSRF).",
        "operationId": "file-upload",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "filename",
                  "content_base64"
                ],
                "properties": {
                  "filename": {
                    "type": "string",
                    "description": "Original file name including extension. The extension is used to derive the storage key and (if mimetype is omitted) the content type.",
                    "example": "receipt.pdf"
                  },
                  "content_base64": {
                    "type": "string",
                    "description": "File bytes encoded as base64 (no data: URI prefix). Max ~20MB after decoding. base64-only by design — the API never fetches a remote URL, so there is no SSRF surface.",
                    "example": "JVBERi0xLjQKJeLjz9MK..."
                  },
                  "mimetype": {
                    "type": "string",
                    "description": "Optional MIME type. If omitted it is inferred from the filename extension, falling back to application/octet-stream.",
                    "example": "application/pdf"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The storage key of the uploaded file",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "example": "/uploads/665f.../integration/file-abc123.pdf"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/file/attach": {
      "post": {
        "tags": [
          "File"
        ],
        "description": "Attach an already-uploaded file (its storage key) to an existing record. Body: `path` (the key) plus exactly one entity FK id (e.g. transaction_id, invoice_id). The referenced record must exist and the file must already be uploaded.",
        "operationId": "file-attach",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "path"
                ],
                "description": "Link an already-uploaded file (its storage key) to an existing record. Provide the key in `path` plus exactly ONE entity FK id.",
                "properties": {
                  "path": {
                    "type": "string",
                    "description": "Storage key returned by /file/upload.",
                    "example": "/uploads/665f.../integration/file-abc123.pdf"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "image",
                      "video",
                      "audio",
                      "file"
                    ],
                    "description": "Optional. Inferred from the file extension when omitted."
                  },
                  "name": {
                    "type": "string",
                    "description": "Optional display name."
                  },
                  "note": {
                    "type": "string",
                    "description": "Optional note."
                  },
                  "transaction_id": {
                    "type": "string",
                    "description": "Attach to a finance transaction."
                  },
                  "invoice_id": {
                    "type": "string",
                    "description": "Attach to an invoice."
                  },
                  "category_id": {
                    "type": "string",
                    "description": "Attach to a product category."
                  },
                  "task_id": {
                    "type": "string",
                    "description": "Attach to a task."
                  },
                  "purchase_id": {
                    "type": "string",
                    "description": "Attach to a purchase."
                  },
                  "supplier_id": {
                    "type": "string",
                    "description": "Attach to a supplier."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created attachment",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "path": {
                              "type": "string"
                            },
                            "type": {
                              "type": "string"
                            },
                            "size": {
                              "type": "number"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/file/attach/{id}": {
      "delete": {
        "tags": [
          "File"
        ],
        "description": "Soft-delete an attachment by its ObjectId (detach a file from a record). Returns the deleted attachment id.",
        "operationId": "file-detach",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Attachment ObjectId to detach",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The detached attachment id",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/position/create": {
      "post": {
        "tags": [
          "Position"
        ],
        "description": "Create an HR position. name, section_ids (at least one existing section) and organizations (at least one entry) are required. Returns the created position aggregated with its sections. Fails with 400 if the name already exists in the account, or if a referenced section or organization does not exist.",
        "operationId": "position-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "section_ids",
                  "organizations"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 100,
                    "example": "Sales manager",
                    "description": "Position name (required, 3–100 characters). Must be unique within the account."
                  },
                  "section_ids": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string",
                      "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                    },
                    "description": "Sections (departments) this position belongs to (required, at least one). Every id must reference an existing, non-deleted section."
                  },
                  "organizations": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": [
                        "organization_id",
                        "is_available"
                      ],
                      "properties": {
                        "organization_id": {
                          "type": "string",
                          "example": "63f8b0c4e4b0d3a2f8e4b0c4",
                          "description": "Organization the position is opened in (required). Must exist."
                        },
                        "is_available": {
                          "type": "boolean",
                          "description": "Whether the position is currently open for hiring in this organization (required). A position whose every organization entry is is_available=false is auto soft-deleted by the backend."
                        },
                        "max_employee_count": {
                          "type": "number",
                          "minimum": 0,
                          "description": "Headcount cap for this organization. Defaults to 0 (uncapped) when omitted."
                        }
                      }
                    },
                    "description": "Per-organization availability of the position (required, at least one)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created position",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "created_at": {
                              "type": "string"
                            },
                            "updated_at": {
                              "type": "string"
                            },
                            "is_deleted": {
                              "type": "boolean"
                            },
                            "completely_deleted": {
                              "type": "boolean"
                            },
                            "sections": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "required": [
                                  "_id",
                                  "name"
                                ],
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "is_deleted": {
                                    "type": "boolean"
                                  },
                                  "completely_deleted": {
                                    "type": "boolean"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                }
                              }
                            },
                            "organizations": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "required": [
                                  "_id",
                                  "organization_id"
                                ],
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "organization_id": {
                                    "type": "string"
                                  },
                                  "max_employee_count": {
                                    "type": "number"
                                  },
                                  "is_available": {
                                    "type": "boolean"
                                  }
                                }
                              }
                            }
                          },
                          "type": "object",
                          "required": [
                            "_id",
                            "name"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/position/update/{id}": {
      "put": {
        "tags": [
          "Position"
        ],
        "description": "Update an HR position by ObjectId. name, section_ids and organizations are all required — this is a full replacement of those fields, not a patch. The organizations named in the payload are pulled and re-pushed; organizations not named keep their existing entry. Returns the updated position aggregated with its sections.",
        "operationId": "position-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Position ObjectId to update",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "section_ids",
                  "organizations"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 100,
                    "example": "Sales manager",
                    "description": "Updated position name (required, 3–100 characters)."
                  },
                  "section_ids": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string",
                      "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                    },
                    "description": "Sections (departments) this position belongs to (required, at least one). Every id must reference an existing, non-deleted section."
                  },
                  "organizations": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": [
                        "organization_id",
                        "is_available"
                      ],
                      "properties": {
                        "organization_id": {
                          "type": "string",
                          "example": "63f8b0c4e4b0d3a2f8e4b0c4",
                          "description": "Organization the position is opened in (required). Must exist."
                        },
                        "is_available": {
                          "type": "boolean",
                          "description": "Whether the position is currently open for hiring in this organization (required). A position whose every organization entry is is_available=false is auto soft-deleted by the backend."
                        },
                        "max_employee_count": {
                          "type": "number",
                          "minimum": 0,
                          "description": "Headcount cap for this organization. Defaults to 0 (uncapped) when omitted."
                        }
                      }
                    },
                    "description": "Full replacement set of per-organization entries (required, at least one). The entries for the organizations named here are removed and re-added, so send every organization the position should remain open in — an organization left out keeps its previous entry untouched."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated position",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1position~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/position/delete/{id}": {
      "delete": {
        "tags": [
          "Position"
        ],
        "description": "Soft-delete an HR position by ObjectId (sets is_deleted=true). Fails with 400 when at least one employee still holds the position — the error payload lists the blocking employees. Deleting an already-deleted position is a no-op.",
        "operationId": "position-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Position ObjectId to delete",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful soft-delete",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "description": "The deleted position ObjectId",
                          "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/person/get-paging": {
      "post": {
        "tags": [
          "Person"
        ],
        "description": "Paginated list of persons — the shared identity record behind customers, suppliers and employees. Returns a light projection (_id, name, first_name, last_name, type, phone_number, status, code). Filter by type, status, organization_id/organization_ids, is_customer, is_supplier, or free-text search. Use /person/balance/get-paging when balances are needed.",
        "operationId": "person-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string",
                        "description": "Free-text search over name / phone number / code."
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "legal",
                          "natural"
                        ],
                        "example": "natural",
                        "description": "Filter by person type."
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "active",
                          "inactive"
                        ],
                        "example": "active",
                        "description": "Filter by person status."
                      },
                      "organization_id": {
                        "type": "string",
                        "example": "63f8b0c4e4b0d3a2f8e4b0c4",
                        "description": "Restrict to persons attached to this organization."
                      },
                      "organization_ids": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                        },
                        "description": "Restrict to persons attached to any of these organizations."
                      },
                      "is_customer": {
                        "type": "boolean",
                        "description": "Keep only persons that are also customers."
                      },
                      "is_supplier": {
                        "type": "boolean",
                        "description": "Keep only persons that are also suppliers."
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list of persons",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "required": [
                                  "_id"
                                ],
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string",
                                    "description": "Display name. For legal persons this is the company name; for natural persons the assembled full name."
                                  },
                                  "first_name": {
                                    "type": "string"
                                  },
                                  "last_name": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "legal",
                                      "natural"
                                    ]
                                  },
                                  "phone_number": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "active",
                                      "inactive"
                                    ]
                                  },
                                  "code": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/employee/get-by-phone-number": {
      "post": {
        "tags": [
          "Employee"
        ],
        "description": "Fetch a single employee by phone number. The number is normalised before lookup, so it may be sent with or without a leading +. Returns 400 when no employee carries that number.",
        "operationId": "employee-get-by-phone-number",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "phone_number"
                ],
                "properties": {
                  "phone_number": {
                    "type": "string",
                    "example": "998901234567",
                    "description": "Employee phone number in international format (required)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1employee~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/purchase-order/create": {
      "post": {
        "tags": [
          "Purchase-order"
        ],
        "description": "Open a purchase order — the request stage that precedes a purchase. Ordered quantities are validated against product stock/measure rules before anything is written. state must be \"new\"; any other value is rejected. Returns the created order in its detailed form.",
        "operationId": "purchase-order-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "organization_id",
                  "ordered_at",
                  "responsible_id",
                  "supplier_id",
                  "currency_id",
                  "requests",
                  "state"
                ],
                "properties": {
                  "organization_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a",
                    "description": "Organization placing the order (required). Must exist."
                  },
                  "ordered_at": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the order was placed (required, ISO 8601)."
                  },
                  "purchase_date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Expected purchase/delivery date."
                  },
                  "responsible_id": {
                    "type": "string",
                    "description": "Responsible user ObjectId (required)."
                  },
                  "supplier_id": {
                    "type": "string",
                    "description": "Supplier ObjectId (required)."
                  },
                  "supplier_assistant_id": {
                    "type": "string",
                    "description": "Supplier-side contact person ObjectId."
                  },
                  "currency_id": {
                    "type": "string",
                    "description": "Currency the costs are quoted in (required)."
                  },
                  "price_id": {
                    "type": "string",
                    "description": "Price list the costs were quoted from."
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "new",
                      "accepted",
                      "in_progress",
                      "done",
                      "canceled",
                      "draft"
                    ],
                    "example": "new",
                    "description": "Initial state (required). Only \"new\" is accepted on create — anything else is rejected."
                  },
                  "state_id": {
                    "type": "string",
                    "description": "Board column ObjectId. When omitted the default column for the state is resolved."
                  },
                  "code": {
                    "type": "string",
                    "description": "Caller-supplied external code."
                  },
                  "note": {
                    "type": "string",
                    "description": "Free-text note."
                  },
                  "requests": {
                    "type": "array",
                    "minItems": 1,
                    "description": "Order lines grouped by source purchase request (required, at least one group).",
                    "items": {
                      "type": "object",
                      "required": [
                        "products"
                      ],
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Source purchase-request ObjectId. Omit for an order raised without a request."
                        },
                        "products": {
                          "type": "array",
                          "minItems": 1,
                          "items": {
                            "type": "object",
                            "required": [
                              "product_id",
                              "amount"
                            ],
                            "properties": {
                              "product_id": {
                                "type": "string",
                                "example": "64b7f4d9e2b3b6a0b7c5d80a",
                                "description": "Product ObjectId (required)."
                              },
                              "amount": {
                                "type": "number",
                                "description": "Ordered quantity (required, > 0). Validated against the product measure.",
                                "minimum": 0,
                                "exclusiveMinimum": true
                              },
                              "box_count": {
                                "type": "number",
                                "description": "Whole boxes ordered. Defaults to 0."
                              },
                              "cost": {
                                "type": "number",
                                "description": "Unit cost in the order currency."
                              },
                              "total_cost": {
                                "type": "number",
                                "description": "Line total. Derived when omitted."
                              },
                              "request_item_id": {
                                "type": "string",
                                "description": "Source purchase-request line this order line fulfils."
                              },
                              "used_measure": {
                                "type": "object",
                                "description": "Alternative unit of measure: { _id, ratio, amount }."
                              }
                            }
                          },
                          "description": "Lines in this group (required, at least one)."
                        }
                      }
                    }
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    },
                    "description": "Attached files: { name, path, size, note }."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created purchase order",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "number": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "organization_id": {
                              "type": "string"
                            },
                            "supplier_id": {
                              "type": "string"
                            },
                            "supplier": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "responsible_id": {
                              "type": "string"
                            },
                            "responsible": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "full_name": {
                                  "type": "string"
                                }
                              }
                            },
                            "warehouse_id": {
                              "type": "string"
                            },
                            "currency_id": {
                              "type": "string"
                            },
                            "date": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "delivery_date": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "new",
                                "in_progress",
                                "done",
                                "canceled",
                                "draft"
                              ]
                            },
                            "is_fully_purchased": {
                              "type": "boolean"
                            },
                            "total": {
                              "type": "number"
                            },
                            "note": {
                              "type": "string"
                            },
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "product_id": {
                                    "type": "string"
                                  },
                                  "amount": {
                                    "type": "number"
                                  },
                                  "cost": {
                                    "type": "number"
                                  },
                                  "purchased_amount": {
                                    "type": "number"
                                  }
                                }
                              }
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updated_at": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/purchase-order/set-state": {
      "put": {
        "tags": [
          "Purchase-order"
        ],
        "description": "Move a purchase order along its lifecycle. Allowed transitions: new → in_progress | accepted | canceled; in_progress → done | in_progress; accepted → done. Returns the updated order in its detailed form.",
        "operationId": "purchase-order-set-state",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "_id",
                  "state"
                ],
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a",
                    "description": "Purchase order ObjectId (required)."
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "new",
                      "accepted",
                      "in_progress",
                      "done",
                      "canceled",
                      "draft"
                    ],
                    "description": "Target state (required). Allowed transitions: new → in_progress | accepted | canceled; in_progress → done | in_progress; accepted → done. An unsupported transition is rejected."
                  },
                  "state_id": {
                    "type": "string",
                    "description": "Board column ObjectId to move the order into."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated purchase order",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1purchase-order~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/supplier/create": {
      "post": {
        "tags": [
          "Supplier"
        ],
        "description": "Create a supplier. name and organization_ids (at least one) are required. Conditional fields depend on type: legal persons use short_name / web_site / code / postal_code / owner_id / manager_id, natural persons use last_name / middle_name / birth_date / gender / legal_person_id. Returns the created supplier.",
        "operationId": "supplier-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "organization_ids"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 100,
                    "description": "Supplier name (required). For a legal person this is the company name; for a natural person the display name."
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "legal",
                      "natural"
                    ],
                    "description": "Person type. Drives which of the conditional field groups below apply. Defaults to the backend default when omitted."
                  },
                  "organization_ids": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string",
                      "example": "64b7f4d9e2b3b6a0b7c5d80a"
                    },
                    "description": "Organizations the supplier is available in (required, at least one)."
                  },
                  "first_name": {
                    "type": "string"
                  },
                  "last_name": {
                    "type": "string",
                    "description": "Natural persons only."
                  },
                  "middle_name": {
                    "type": "string",
                    "description": "Natural persons only."
                  },
                  "birth_date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Natural persons only."
                  },
                  "gender": {
                    "type": "string",
                    "enum": [
                      "male",
                      "female"
                    ],
                    "description": "Natural persons only."
                  },
                  "short_name": {
                    "type": "string",
                    "description": "Legal persons only."
                  },
                  "web_site": {
                    "type": "string",
                    "description": "Legal persons only."
                  },
                  "code": {
                    "type": "string",
                    "description": "Legal persons only."
                  },
                  "postal_code": {
                    "type": "string",
                    "description": "Legal persons only."
                  },
                  "owner_id": {
                    "type": "string",
                    "description": "Legal persons only — owning person ObjectId."
                  },
                  "manager_id": {
                    "type": "string",
                    "description": "Legal persons only — manager person ObjectId."
                  },
                  "phone_number": {
                    "type": "string",
                    "description": "Primary phone number in international format."
                  },
                  "phone_numbers": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Additional phone numbers. Must be unique."
                  },
                  "fax": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  },
                  "telegram_link": {
                    "type": "string"
                  },
                  "inn": {
                    "type": "string",
                    "description": "Taxpayer INN. Validated for format."
                  },
                  "qqs_number": {
                    "type": "string",
                    "description": "VAT registration number."
                  },
                  "oked": {
                    "type": "string"
                  },
                  "director_name": {
                    "type": "string"
                  },
                  "bank_name": {
                    "type": "string"
                  },
                  "mfo": {
                    "type": "string"
                  },
                  "card_number": {
                    "type": "string",
                    "description": "Validated as a credit-card number."
                  },
                  "address": {
                    "type": "string"
                  },
                  "delivery_address": {
                    "type": "object",
                    "description": "Location object (lat/lng + address)."
                  },
                  "category_id": {
                    "type": "string"
                  },
                  "person_id": {
                    "type": "string",
                    "description": "Link to an existing person record instead of creating a new one."
                  },
                  "responsible_id": {
                    "type": "string"
                  },
                  "legal_person_id": {
                    "type": "string",
                    "description": "Natural persons only — the legal person they represent."
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "inactive"
                    ]
                  },
                  "is_customer": {
                    "type": "boolean",
                    "description": "Also register this person as a customer."
                  },
                  "locale": {
                    "type": "string",
                    "enum": [
                      "uz",
                      "ru",
                      "en",
                      "kk",
                      "ky",
                      "tg"
                    ]
                  },
                  "comment": {
                    "type": "string",
                    "maxLength": 250
                  },
                  "note": {
                    "type": "string"
                  },
                  "image": {
                    "type": "string"
                  },
                  "tag_ids": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "string"
                    }
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    },
                    "description": "Attached files: { name, path, size, note }."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created supplier",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1supplier~1update/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/trade/get-by-id": {
      "post": {
        "tags": [
          "Trade"
        ],
        "description": "Fetch a single trade by ObjectId, passing the id in the request body instead of the path. Returns the same compact payload as GET /trade/get-by-id/for-bot/{id}, NOT the fuller shape of GET /trade/get-by-id/{id} — use the GET form when you need the full trade.",
        "operationId": "trade-get-by-id-post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "_id"
                ],
                "properties": {
                  "_id": {
                    "type": "string",
                    "example": "64b7f4d9e2b3b6a0b7c5d80a",
                    "description": "Trade ObjectId (required)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1trade~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/section/create": {
      "post": {
        "tags": [
          "Section"
        ],
        "description": "Create a section (HR department). name and organizations (at least one entry) are required; parent_id nests the section under an existing one. Returns the created section with its parent expanded. Fails with 400 if a referenced organization, chief user or parent section does not exist.",
        "operationId": "section-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "organizations"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 100,
                    "example": "Sales department",
                    "description": "Section name (required, 3-100 characters)."
                  },
                  "organizations": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": [
                        "organization_id",
                        "is_available"
                      ],
                      "properties": {
                        "organization_id": {
                          "type": "string",
                          "example": "63f8b0c4e4b0d3a2f8e4b0c4",
                          "description": "Organization the section exists in (required). Must exist."
                        },
                        "is_available": {
                          "type": "boolean",
                          "description": "Whether the section is active in this organization (required). A section whose every organization entry is is_available=false is auto soft-deleted by the backend."
                        },
                        "chief_id": {
                          "type": "string",
                          "example": "63f8b0c4e4b0d3a2f8e4b0c4",
                          "description": "User who heads the section in this organization. Must reference an existing user."
                        }
                      }
                    },
                    "description": "Per-organization presence of the section (required, at least one)."
                  },
                  "parent_id": {
                    "type": "string",
                    "example": "63f8b0c4e4b0d3a2f8e4b0c4",
                    "description": "Parent section, for a nested department tree. Must reference an existing section. Omit for a top-level section."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created section",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "created_at": {
                              "type": "string"
                            },
                            "updated_at": {
                              "type": "string"
                            },
                            "is_deleted": {
                              "type": "boolean"
                            },
                            "parent_id": {
                              "type": "string"
                            }
                          },
                          "type": "object",
                          "required": [
                            "name"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/section/update/{id}": {
      "put": {
        "tags": [
          "Section"
        ],
        "description": "Update a section by ObjectId. name and organizations are both required — this is a full replacement of those fields, not a patch. The organizations named in the payload are pulled and re-pushed; organizations not named keep their existing entry. Returns the updated section with its parent expanded.",
        "operationId": "section-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Section ObjectId to update",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "organizations"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 100,
                    "example": "Sales department",
                    "description": "Updated section name (required, 3-100 characters)."
                  },
                  "organizations": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": [
                        "organization_id",
                        "is_available"
                      ],
                      "properties": {
                        "organization_id": {
                          "type": "string",
                          "example": "63f8b0c4e4b0d3a2f8e4b0c4",
                          "description": "Organization the section exists in (required). Must exist."
                        },
                        "is_available": {
                          "type": "boolean",
                          "description": "Whether the section is active in this organization (required). A section whose every organization entry is is_available=false is auto soft-deleted by the backend."
                        },
                        "chief_id": {
                          "type": "string",
                          "example": "63f8b0c4e4b0d3a2f8e4b0c4",
                          "description": "User who heads the section in this organization. Must reference an existing user."
                        }
                      }
                    },
                    "description": "Full replacement set of per-organization entries (required, at least one). The entries for the organizations named here are removed and re-added, so send every organization the section should remain active in — an organization left out keeps its previous entry."
                  },
                  "parent_id": {
                    "type": "string",
                    "example": "63f8b0c4e4b0d3a2f8e4b0c4",
                    "description": "Updated parent section. Must reference an existing section."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated section",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1section~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/section/delete/{id}": {
      "delete": {
        "tags": [
          "Section"
        ],
        "description": "Soft-delete a section by ObjectId (sets is_deleted=true). Refuses with 400 when another section still names this one as its parent, or when any position still belongs to it — that error payload lists the blocking positions. Delete the child sections and re-home the positions first. Deleting an already-deleted section is a no-op.",
        "operationId": "section-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Section ObjectId to delete",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful soft-delete",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "description": "The deleted section ObjectId",
                          "example": "63f8b0c4e4b0d3a2f8e4b0c4"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-plan/get-by-year": {
      "post": {
        "tags": [
          "Production-plan"
        ],
        "description": "Fetch the production plan for a year + organization. Together these are the plan's natural key — the same pair create/update upsert on — so this is the lookup to use when you hold the business key rather than the ObjectId. Returns an empty object when no plan exists for that pair.",
        "operationId": "production-plan-get-by-year",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "year",
                  "organization_id"
                ],
                "properties": {
                  "year": {
                    "type": "number",
                    "description": "Calendar year of the plan, e.g. 2026",
                    "example": 2026
                  },
                  "organization_id": {
                    "type": "string",
                    "description": "Organization ObjectId the plan belongs to"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The production plan for that year, or {} if none exists",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-plan~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/production/route-sheet/get-with-quantity/{id}": {
      "post": {
        "tags": [
          "Production-route-sheet"
        ],
        "description": "Fetch one route sheet together with live per-warehouse stock for every material it consumes. get-by-id returns the recipe; this returns the recipe plus whether the warehouse can actually cover it — the read to make before launching production. Substitute products are hydrated with their own warehouse balances.",
        "operationId": "production-route-sheet-get-with-quantity",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Production route-sheet ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "organization_id": {
                    "type": "string",
                    "description": "Scope the returned quantities to this organization ObjectId"
                  },
                  "warehouse_id": {
                    "type": "string",
                    "description": "Warehouse ObjectId materials would be consumed from"
                  },
                  "produced_warehouse_id": {
                    "type": "string",
                    "description": "Warehouse ObjectId the output would land in"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The route sheet with per-warehouse quantities",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production~1route-sheet~1update/put/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production/route-sheet/get-alternatives/{itemId}": {
      "get": {
        "tags": [
          "Production-route-sheet"
        ],
        "description": "List the substitute products registered for a single route-sheet item. Lets you resolve what may be swapped in when the primary material is short, without pulling the whole route sheet. Note the path param is the ITEM ObjectId, not the route sheet's.",
        "operationId": "production-route-sheet-get-alternatives",
        "parameters": [
          {
            "name": "itemId",
            "required": true,
            "in": "path",
            "description": "Route-sheet item ObjectId (from products[]._id on get-by-id), NOT the route sheet ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Substitute products for that item",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "_id": {
                                "type": "string",
                                "description": "Alternative entry ObjectId"
                              },
                              "product_id": {
                                "type": "string",
                                "description": "Substitute product ObjectId"
                              },
                              "amount": {
                                "type": "number",
                                "description": "Quantity of the substitute needed in place of the primary material"
                              },
                              "product": {
                                "type": "object",
                                "description": "Hydrated substitute product, including _warehouses with its per-warehouse balances",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "_warehouses": {
                                    "type": "array",
                                    "items": {
                                      "type": "object"
                                    },
                                    "description": "Per-warehouse stock rows for the substitute"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-task/produce/{id}": {
      "put": {
        "tags": [
          "Production-task"
        ],
        "description": "Record production output against one step of the task's technological map. This is the write that actually moves material: the step's inputs are consumed from the used warehouse, `amount` of its output is produced into the produced warehouse, and the task advances. Reverse it with cancel-produced.",
        "operationId": "production-task-produce",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Production-task ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "tech_map_id",
                  "step_id",
                  "responsible_id",
                  "amount",
                  "used_date",
                  "produced_date"
                ],
                "properties": {
                  "tech_map_id": {
                    "type": "string",
                    "description": "Technological-map ObjectId the step belongs to"
                  },
                  "step_id": {
                    "type": "string",
                    "description": "Production-step ObjectId being produced"
                  },
                  "responsible_id": {
                    "type": "string",
                    "description": "Employee ObjectId credited with the output"
                  },
                  "amount": {
                    "type": "number",
                    "description": "Quantity produced in this call"
                  },
                  "used_date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the inputs were consumed (ISO 8601)"
                  },
                  "produced_date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the output was produced (ISO 8601)"
                  },
                  "code": {
                    "type": "string",
                    "description": "Optional external code for the resulting operation"
                  },
                  "state": {
                    "type": "string",
                    "description": "Optional initial state for the resulting production operation"
                  },
                  "note": {
                    "type": "string",
                    "description": "Optional free-text note"
                  },
                  "create_reminder": {
                    "type": "boolean",
                    "description": "Create a follow-up reminder for the responsible employee"
                  },
                  "additional_costs": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "cost_id": {
                          "type": "string",
                          "description": "Extra-cost ObjectId"
                        },
                        "amount": {
                          "type": "number",
                          "description": "Cost amount"
                        }
                      }
                    },
                    "description": "Extra costs to fold into the produced item's cost price"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The production task after the output was recorded (hydrated)",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-task~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-task/cancel-produced/{id}": {
      "put": {
        "tags": [
          "Production-task"
        ],
        "description": "Reverse a previously recorded production for one step of the task. Cancels the operation the matching produce call created and returns the consumed material to stock. `tech_map_id` + `step_id` identify which produced step to undo.",
        "operationId": "production-task-cancel-produced",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Production-task ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "tech_map_id",
                  "step_id"
                ],
                "properties": {
                  "tech_map_id": {
                    "type": "string",
                    "description": "Technological-map ObjectId the produced step belongs to"
                  },
                  "step_id": {
                    "type": "string",
                    "description": "Production-step ObjectId whose production is being reversed"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The production task after the reversal (hydrated)",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-task~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-task/state-report/by-product": {
      "post": {
        "tags": [
          "Production-task"
        ],
        "description": "Paginated production-task state report grouped by product. Answers how much of each product is planned, in progress, done or canceled across tasks — rather than listing the tasks themselves. Accepts the same filters as get-paging.",
        "operationId": "production-task-state-report-by-product",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/paths/~1production-task~1get-paging/post/requestBody/content/application~1json/schema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged per-product state totals",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "product_id": {
                                    "type": "string",
                                    "description": "Product ObjectId"
                                  },
                                  "product": {
                                    "type": "object",
                                    "description": "Hydrated product",
                                    "properties": {
                                      "_id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "new": {
                                    "type": "number",
                                    "description": "Quantity on tasks still in the new state"
                                  },
                                  "in_progress": {
                                    "type": "number",
                                    "description": "Quantity on tasks in progress"
                                  },
                                  "done": {
                                    "type": "number",
                                    "description": "Quantity on completed tasks"
                                  },
                                  "canceled": {
                                    "type": "number",
                                    "description": "Quantity on canceled tasks"
                                  },
                                  "total": {
                                    "type": "number",
                                    "description": "Total planned quantity across all states"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/production-tech-map/create": {
      "post": {
        "tags": [
          "Production-tech-map"
        ],
        "description": "Create a technological map — the step graph that turns route sheets into a finished product. Each item pairs a production step with the route sheet that produces it and names the steps that follow.",
        "operationId": "production-tech-map-create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "items"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Display name of the technological map"
                  },
                  "group_id": {
                    "type": "string",
                    "description": "Production-group ObjectId (a group of type tech_map) this map belongs to"
                  },
                  "code": {
                    "type": "string",
                    "description": "Optional short code for the map"
                  },
                  "note": {
                    "type": "string",
                    "description": "Optional free-text note"
                  },
                  "items": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": [
                        "step_id",
                        "route_sheet_id"
                      ],
                      "properties": {
                        "step_id": {
                          "type": "string",
                          "description": "Production-step ObjectId this node of the map executes"
                        },
                        "route_sheet_id": {
                          "type": "string",
                          "description": "Production route-sheet ObjectId holding the recipe for this step"
                        },
                        "next_step_ids": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Production-step ObjectIds that follow this one. Empty for a terminal step; more than one fans the route out in parallel. This is what turns the flat items[] array into a graph."
                        }
                      }
                    },
                    "description": "Ordered steps of the map, at least one. Each entry pairs a step with the route sheet that produces it and names the steps that come next."
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "file_id": {
                          "type": "string",
                          "description": "Uploaded file ObjectId"
                        },
                        "name": {
                          "type": "string",
                          "description": "Original file name"
                        }
                      }
                    },
                    "description": "Files attached to the map (drawings, specifications)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created technological map",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "allOf": [
                            {
                              "$ref": "#/paths/~1production-tech-map~1create/post/requestBody/content/application~1json/schema"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "description": "Technological map ObjectId"
                                },
                                "number": {
                                  "type": "string",
                                  "description": "Auto-generated sequential map number"
                                },
                                "group": {
                                  "type": "object",
                                  "description": "Hydrated production group this map belongs to",
                                  "properties": {
                                    "_id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "items": {
                                  "type": "array",
                                  "description": "Hydrated step graph — each item carries its step and route sheet inline alongside the ids sent on create",
                                  "items": {
                                    "allOf": [
                                      {
                                        "$ref": "#/paths/~1production-tech-map~1create/post/requestBody/content/application~1json/schema/properties/items/items"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "_id": {
                                            "type": "string",
                                            "description": "Tech-map item ObjectId"
                                          },
                                          "tech_map_id": {
                                            "type": "string",
                                            "description": "Owning technological map ObjectId"
                                          },
                                          "step": {
                                            "type": "object",
                                            "description": "Hydrated production step",
                                            "properties": {
                                              "_id": {
                                                "type": "string"
                                              },
                                              "name": {
                                                "type": "string"
                                              }
                                            }
                                          },
                                          "route_sheet": {
                                            "type": "object",
                                            "description": "Hydrated route sheet",
                                            "properties": {
                                              "_id": {
                                                "type": "string"
                                              },
                                              "name": {
                                                "type": "string"
                                              },
                                              "number": {
                                                "type": "string"
                                              }
                                            }
                                          }
                                        }
                                      }
                                    ]
                                  }
                                },
                                "route_sheet_ids": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  },
                                  "description": "Every route-sheet ObjectId referenced by the map's items"
                                },
                                "last_route_sheet_id": {
                                  "type": "string",
                                  "description": "Route sheet of the terminal step — the one that yields the finished product"
                                },
                                "is_deleted": {
                                  "type": "boolean",
                                  "description": "Soft-delete flag"
                                },
                                "created_at": {
                                  "type": "string",
                                  "format": "date-time",
                                  "description": "Creation timestamp (ISO 8601)"
                                },
                                "updated_at": {
                                  "type": "string",
                                  "format": "date-time",
                                  "description": "Last update timestamp (ISO 8601)"
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-tech-map/get-by-id/{id}": {
      "get": {
        "tags": [
          "Production-tech-map"
        ],
        "description": "Fetch a single technological map by ObjectId, hydrated with its step graph, steps and route sheets.",
        "operationId": "production-tech-map-get-by-id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Technological-map ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The technological map",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-tech-map~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-tech-map/get-paging": {
      "post": {
        "tags": [
          "Production-tech-map"
        ],
        "description": "Paginated list of technological maps, filterable by production group and free-text search over name, number and code.",
        "operationId": "production-tech-map-get-paging",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/paths/~1production-step~1get-paging/post/requestBody/content/application~1json/schema"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "search": {
                        "type": "string",
                        "description": "Filter by name, number or code"
                      },
                      "group_id": {
                        "type": "string",
                        "description": "Filter by production-group ObjectId"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paged list",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "number"
                            },
                            "list": {
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1production-tech-map~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/production-tech-map/update/{id}": {
      "put": {
        "tags": [
          "Production-tech-map"
        ],
        "description": "Update an existing technological map. The item graph is rewritten from the items[] array, so send every step — not just the changed ones.",
        "operationId": "production-tech-map-update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Technological-map ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "items"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Display name of the technological map"
                  },
                  "group_id": {
                    "type": "string",
                    "description": "Production-group ObjectId (a group of type tech_map) this map belongs to"
                  },
                  "code": {
                    "type": "string",
                    "description": "Optional short code for the map"
                  },
                  "note": {
                    "type": "string",
                    "description": "Optional free-text note"
                  },
                  "items": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "$ref": "#/paths/~1production-tech-map~1create/post/requestBody/content/application~1json/schema/properties/items/items"
                    },
                    "description": "Full replacement set of steps. The item graph is rewritten from this array, so send every step, not just the changed ones."
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "file_id": {
                          "type": "string",
                          "description": "Uploaded file ObjectId"
                        },
                        "name": {
                          "type": "string",
                          "description": "Original file name"
                        }
                      }
                    },
                    "description": "Files attached to the map (drawings, specifications)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated technological map",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/paths/~1production-tech-map~1create/post/responses/200/content/application~1json/schema/allOf/1/properties/data"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/production-tech-map/delete/{id}": {
      "delete": {
        "tags": [
          "Production-tech-map"
        ],
        "description": "Soft-delete a technological map by ObjectId.",
        "operationId": "production-tech-map-delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Technological-map ObjectId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/paths/~1sale-order~1create/post/responses/default/content/application~1json/schema"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "string",
                          "default": "ok"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "api-key"
      }
    }
  }
}
