openapi: 3.1.0
info:
  description: >
    # Introducción

    El API de velocity te permite acceder a los datos de la plataforma de
    velocity.


    ## Ambientes

    - Producción: [https://api.velocity-x.co](https://api.velocity-x.co)

    - Staging: [https://api.velocityx.ninja](https://api.velocityx.ninja)


    ## Autenticación


    Los endpoints de la API requieren autenticación. Para obtener un token de
    acceso, se debe de solicitar a velocity.

    El token de acceso se debe enviar en el header `X-Velocity-Access-Token` de
    la siguiente manera:

    ```

    X-Velocity-Access-Token: <token>

    ```


    ## Webhooks


    ### creación de webhook


    Se pueden configurar webhooks para recibir notificaciones de eventos en la
    plataforma de velocity.

    Para crear un webhook se debe de enviar un POST a la ruta `/webhooks` con el
    siguiente payload:

    ```

    {
      "url": "https://mi-servidor.com/webhook",
      "topic": "order.created"
    }


    ```

    Revisa la sección de webhooks para ver las operaciones soportadas.


    ### Tipos de eventos soportados (topics)


    - inventory.updated

    - order.status_updated

    - product.updated


    ### Evento de actualización de inventario


    Cuando se actualiza el inventario de un producto, se envía una petición POST
    al webhook configurado con el siguiente payload:


    ```

    {
      "business_id": "id",  
      "product_id": "id",
      "sku": "sku",
      "quantity": 10,
      "warehouse_id": 1,
      "total_inventory": 100, // total de inventario en todas las bodegas
      "movement_id": 1, // id del movimiento
      "movement_order_id": "order_id", // id de la orden relacionada al movimiento si aplica
      "action": "in", // in | out
      "inventory_per_warehouse": [
        {
          "warehouse_id": 1,
          "quantity": 10
        }
      ]
    }

    ```


    ### Evento de actualización de estado de orden


    Cuando se actualiza el estado de una orden, se envía una petición POST al
    webhook configurado con el payload de la orden.

    (se enviara el mismo objeto que se obtiene al consultar una orden)
  title: Documentación API Velocity
servers:
  - description: Producción
    url: https://api.velocity-x.co
  - description: Staging
    url: https://api.velocityx.ninja
paths:
  /purchase-external-orders/:
    get:
      summary: Obtener Órdenes de Recibo
      description: >-
        Permite obtener órdenes de recibo filtradas por estado y rango de
        fechas.
      tags:
        - Órdenes de Recibo
      parameters:
        - name: status
          in: query
          description: >-
            Estado de las órdenes de recibo (puede repetirse para múltiples
            estados)
          required: false
          schema:
            type: array
            items:
              type: integer
            example:
              - 1
              - 2
              - 4
        - name: start_date
          in: query
          description: Fecha de inicio del rango (formato ISO 8601)
          required: false
          schema:
            type: string
            format: date-time
            example: '2022-01-01T00:00:00Z'
        - name: end_date
          in: query
          description: Fecha de fin del rango (formato ISO 8601)
          required: false
          schema:
            type: string
            format: date-time
            example: '2022-12-01T00:00:00Z'
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -G '$BASE_URL/purchase-external-orders/' --data-urlencode
            'status=1' --data-urlencode 'status=2' --data-urlencode
            'start_date=2022-01-01T00:00:00Z' --data-urlencode
            'end_date=2022-12-01T00:00:00Z'
        - lang: http
          label: HTTP
          source: >-
            GET
            /purchase-external-orders/?status=1&status=2&start_date=2022-01-01T00:00:00Z&end_date=2022-12-01T00:00:00Z

            Host: $BASE_HOST
        - lang: javascript
          label: fetch
          source: >-
            fetch(`${BASE_URL}/purchase-external-orders/?status=1&status=2&start_date=2022-01-01T00:00:00Z&end_date=2022-12-01T00:00:00Z`)
              .then(r => r.json())
              .then(console.log);
      responses:
        '200':
          description: Lista de órdenes de recibo obtenidas con éxito.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    purchase_order_id:
                      type: integer
                      description: ID de la orden de recibo
                    invoice_number:
                      type: string
                      description: Número de factura
                    warehouse_id:
                      type: integer
                      description: ID del almacén
                    warehouse_name:
                      type: string
                      description: Nombre del almacén
                    total:
                      type: number
                      description: Total de la orden de recibo
                    business_id:
                      type: string
                      description: ID del negocio
                    business_name:
                      type: string
                      description: Nombre del negocio
                    purchase_order_status_id:
                      type: integer
                      description: ID del estado de la orden de recibo
                    purchase_order_status:
                      type: string
                      description: Estado de la orden de recibo
                    created_at:
                      type: string
                      format: date-time
                      description: Fecha de creación de la orden de recibo
                  required:
                    - purchase_order_id
                    - invoice_number
                    - warehouse_id
                    - warehouse_name
                    - total
                    - business_id
                    - business_name
                    - purchase_order_status_id
                    - purchase_order_status
                    - created_at
        '400':
          description: Solicitud incorrecta.
  /purchase-external-order/status:
    get:
      summary: Estados Ordenes de Recibo
      description: >-
        Permite obtener la lista de razones de retorno disponibles para órdenes
        externas.
      tags:
        - Órdenes de Recibo
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Lista de estados
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: ID estado
                    name:
                      type: string
                      description: Nombre del estado
                  required:
                    - id
                    - name
                example:
                  - id: 1
                    name: Ejemplo de Estado
        '401':
          description: No autorizado - Token de acceso inválido o no proporcionado
        '500':
          description: Error interno del servidor
  /purchase-external-orders/create:
    post:
      summary: Crear Órden de Recibo
      description: Permite crear una orden de recibo.
      tags:
        - Órdenes de Recibo
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                warehouses:
                  type: array
                  description: Lista de almacenes con los artículos
                  items:
                    type: object
                    properties:
                      warehouse_id:
                        type: integer
                        description: ID del almacén
                      items:
                        type: array
                        description: Lista de artículos en el almacén
                        items:
                          type: object
                          properties:
                            ean:
                              type: string
                              description: Código EAN del artículo
                            quantity:
                              type: integer
                              description: Cantidad del artículo
                            price:
                              type: number
                              description: Precio del artículo
                            cost:
                              type: number
                              description: Costo del artículo
                          required:
                            - ean
                            - quantity
                            - price
                            - cost
                    required:
                      - warehouse_id
                      - items
              required:
                - supplier
                - warehouses
      responses:
        '200':
          description: Orden de recibo creada con éxito.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    purchase_id:
                      type: integer
                      description: ID de la orden de compra
                    warehouse_id:
                      type: integer
                      description: ID del almacén
                    items_res:
                      type: array
                      description: Resultados de validación de los artículos
                      items:
                        type: object
                        properties:
                          ean:
                            type: string
                            description: Código EAN del artículo
                          message:
                            type: string
                            description: Mensaje de validación del artículo
                        required:
                          - ean
                          - message
                  required:
                    - purchase_id
                    - warehouse_id
                    - items_res
        '400':
          description: Solicitud incorrecta.
  /purchase-external-order/return-order-status:
    get:
      summary: Obtener Razones de Devolución en Ordenes
      description: Permite obtener la lista de razones de devolución de órdenes de compra.
      tags:
        - Órdenes de Recibo
      responses:
        '200':
          description: Lista de razones de devolución obtenida con éxito.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: ID de la razón de devolución
                    name:
                      type: string
                      description: Nombre de la razón de devolución
                  required:
                    - id
                    - name
        '400':
          description: Solicitud incorrecta.
  /purchase-external-order/return-order:
    get:
      summary: Obtener Órdenes en devolucion
      description: Permite obtener la lista de órdenes externas que han sido devueltas.
      tags:
        - Órdenes de Recibo
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -G '$BASE_URL/purchase-external-order/return-order'
            --data-urlencode 'orderNumber=UTXKAF'
        - lang: http
          label: HTTP
          source: |-
            GET /purchase-external-order/return-order?orderNumber=UTXKAF
            Host: $BASE_HOST
        - lang: javascript
          label: fetch
          source: >-
            fetch(`${BASE_URL}/purchase-external-order/return-order?orderNumber=UTXKAF`)
              .then(r => r.json())
              .then(console.log);
      parameters:
        - name: orderNumber
          in: query
          description: Número de la orden para obtener una orden específica en devolución
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Lista de órdenes de retorno obtenida con éxito
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    order_number:
                      type: string
                      description: Número de la orden
                    external_order_id:
                      type: string
                      description: ID de la orden externa
                    order_type:
                      type: string
                      description: Tipo de orden (Same day, Express, Programado, Next day)
                      enum:
                        - Same day
                        - Express
                        - Programado
                        - Next day
                    order_status:
                      type: string
                      description: Estado de la orden
                    order_return_reason:
                      type: string
                      description: Razón de la devolución
                    created_at:
                      type: string
                      format: date-time
                      description: Fecha de creación de la orden
                  required:
                    - order_number
                    - external_order_id
                    - order_type
                    - order_status
                    - order_return_reason
                    - created_at
                example:
                  - order_number: UTXKAF
                    external_order_id: ''
                    order_type: Same day
                    order_status: Devolución
                    order_return_reason: vencido por fecha
                    created_at: '2024-05-02T08:27:18-05:00'
                  - order_number: AIUQYF
                    external_order_id: ''
                    order_type: Express
                    order_status: Devolución
                    order_return_reason: Producto en mal estado
                    created_at: '2024-10-11T16:56:10-05:00'
        '401':
          description: No autorizado - Token de acceso inválido o no proporcionado
        '500':
          description: Error interno del servidor
  /purchase-external-order/{id}:
    get:
      summary: Detalle de una Orden de Recibo
      description: >-
        Retorna la cabecera de una Orden de Recibo: número de factura, bodega,
        total, negocio y estado.


        La ruta va en **singular** (`/purchase-external-order/{id}`), a
        diferencia del listado que va en plural (`/purchase-external-orders/`).


        Para obtener los productos de la orden, usar `GET
        /purchase-external-order/{id}/products`.


        Acepta autenticación con API Key (`X-Velocity-Access-Token`) o con token
        JWT (`Authorization: Bearer`).
      tags:
        - Órdenes de Recibo
      parameters:
        - name: id
          in: path
          required: true
          description: >-
            ID de la Orden de Recibo. Corresponde al campo `purchase_order_id`
            que devuelve `GET /purchase-external-orders/`
          schema:
            type: integer
            example: 123
      security:
        - apiKeyAuth: []
        - bearerAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl '$BASE_URL/purchase-external-order/123' -H
            'X-Velocity-Access-Token: <api_key>'
        - lang: http
          label: HTTP
          source: |-
            GET /purchase-external-order/123
            Host: $BASE_HOST
            X-Velocity-Access-Token: <api_key>
        - lang: javascript
          label: fetch
          source: |-
            fetch(`${BASE_URL}/purchase-external-order/123`, {
              headers: { 'X-Velocity-Access-Token': '<api_key>' }
            })
              .then(r => r.json())
              .then(console.log);
      responses:
        '200':
          description: Detalle de la Orden de Recibo.
          content:
            application/json:
              schema:
                type: object
                properties:
                  purchase_order_id:
                    type: integer
                    description: ID de la Orden de Recibo
                  invoice_number:
                    type: string
                    nullable: true
                    description: Número de factura o referencia declarada al crear la orden
                  warehouse_id:
                    type: integer
                    description: ID de la bodega de destino
                  warehouse_name:
                    type: string
                    description: Nombre de la bodega de destino
                  total:
                    type: number
                    description: Valor total de la orden
                  business_id:
                    type: string
                    description: ID del negocio dueño de la orden
                  business_name:
                    type: string
                    description: Nombre del negocio dueño de la orden
                  purchase_order_status_id:
                    type: integer
                    description: ID del estado de la orden
                  purchase_order_status:
                    type: string
                    description: Nombre del estado de la orden (por ejemplo Verificado)
                  created_at:
                    type: string
                    format: date-time
                    description: Fecha de creación de la orden
                required:
                  - purchase_order_id
                  - warehouse_id
                  - business_id
                  - purchase_order_status_id
              example:
                purchase_order_id: 123
                invoice_number: Inventario 1 de junio
                warehouse_id: 305
                warehouse_name: Bodega Principal
                total: 196885200
                business_id: 69bc53424d048
                business_name: Nombre del Negocio
                purchase_order_status_id: 4
                purchase_order_status: Verificado
                created_at: '2026-06-01T13:26:03-05:00'
        '400':
          description: ID de orden inválido.
        '401':
          description: No autenticado o token inválido.
        '404':
          description: >-
            Orden de Recibo no encontrada. Si la respuesta es `{"code":
            "not_found", "message": "Not Found"}` para una orden que sí existe,
            revisar que la ruta esté en singular: el plural
            (`/purchase-external-orders/{id}`) no existe y produce el mismo 404.
  /purchase-external-order/{id}/products:
    get:
      summary: Consultar productos de una Orden de Recibo
      description: >-
        Retorna el listado de productos (código de barras, nombre, cantidades,
        ubicación, costo y precio) asociados a una Orden de Recibo.


        La ruta va en **singular** (`/purchase-external-order/{id}/products`), a
        diferencia del listado de órdenes que va en plural
        (`/purchase-external-orders/`). Usar el plural en esta ruta devuelve
        `404 not_found`.


        Acepta autenticación con API Key (`X-Velocity-Access-Token`) o con token
        JWT (`Authorization: Bearer`).
      tags:
        - Órdenes de Recibo
      parameters:
        - name: id
          in: path
          required: true
          description: >-
            ID de la Orden de Recibo. Corresponde al campo `purchase_order_id`
            que devuelve `GET /purchase-external-orders/`
          schema:
            type: integer
            example: 123
      security:
        - apiKeyAuth: []
        - bearerAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl '$BASE_URL/purchase-external-order/123/products' -H
            'X-Velocity-Access-Token: <api_key>'
        - lang: http
          label: HTTP
          source: |-
            GET /purchase-external-order/123/products
            Host: $BASE_HOST
            X-Velocity-Access-Token: <api_key>
        - lang: javascript
          label: fetch
          source: |-
            fetch(`${BASE_URL}/purchase-external-order/123/products`, {
              headers: { 'X-Velocity-Access-Token': '<api_key>' }
            })
              .then(r => r.json())
              .then(console.log);
      responses:
        '200':
          description: Listado de productos de la Orden de Recibo.
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        ean:
                          type: string
                          description: >-
                            Código de barras del producto. Corresponde al campo
                            `sku` del producto en Velocity, no al `ean`. Si
                            necesitas cruzar con el SKU propio del cliente, ese
                            vive en `external_id` y se consulta en `GET
                            /products/`
                        product_name:
                          type: string
                          description: Nombre del producto
                        quantity_requested:
                          type: integer
                          description: Cantidad solicitada en la orden
                        quantity_received:
                          type: integer
                          nullable: true
                          description: Cantidad recibida (null si aún no se ha recibido)
                        locations:
                          type: array
                          items:
                            type: string
                          description: Ubicaciones en bodega donde se almacenó el producto
                        cost:
                          type: number
                          nullable: true
                          description: Costo unitario del producto
                        price:
                          type: number
                          nullable: true
                          description: Precio de venta unitario del producto
                      required:
                        - ean
                        - product_name
                        - quantity_requested
                        - locations
                required:
                  - items
              example:
                items:
                  - ean: '7896543210001'
                    product_name: Nombre Producto
                    quantity_requested: 10
                    quantity_received: 8
                    locations:
                      - A1-B2
                    cost: 15
                    price: 25
        '400':
          description: ID de orden inválido.
        '401':
          description: No autenticado o token inválido.
        '404':
          description: >-
            Orden de Recibo no encontrada. Si la respuesta es `{"code":
            "not_found", "message": "Not Found"}` para una orden que sí existe,
            revisar que la ruta esté en singular
            (`/purchase-external-order/{id}/products`): el plural no existe y
            produce el mismo 404.
  /businesses:
    get:
      description: |
        Retorna la lista de sellers. (Solo aplicable para operadores)
      parameters:
        - description: Page number
          in: query
          name: page
          schema:
            description: Page number
            type: integer
        - description: Page size
          in: query
          name: size
          schema:
            description: Page size
            type: integer
        - description: filter query
          in: query
          name: filters
          schema:
            $ref: '#/components/schemas/FiltersRaw'
            description: filter query
        - description: sort by field
          in: query
          name: sort_by
          schema:
            description: sort by field
            type: string
        - description: sort direction
          in: query
          name: sort_dir
          schema:
            description: sort direction
            enum:
              - ASC
              - DESC
            type: string
        - description: skip total count, can be used for performance
          in: query
          name: skip_total
          schema:
            description: skip total count, can be used for performance
            type: boolean
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PaginateResponseVelocityAppBusinessDomainBusiness
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Lista sellers
      tags:
        - Businesses
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -G '$BASE_URL/businesses' --data-urlencode 'page=1'
            --data-urlencode 'size=50'
        - lang: http
          label: HTTP
          source: |-
            GET /businesses?page=1&size=50
            Host: $BASE_HOST
        - lang: javascript
          label: fetch
          source: |-
            fetch(`${BASE_URL}/businesses?page=1&size=50`)
              .then(r => r.json())
              .then(console.log);
  /businesses/{id}:
    get:
      description: |
        Retorna un seller. (Solo aplicable para operadores)
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainBusiness'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Obtener seller
      tags:
        - Businesses
  /inventory/movement:
    post:
      description: |
        Crea un movimiento de inventario.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceCreateMovementRequest'
      responses:
        '200':
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Crear movimiento de inventario
      tags:
        - Inventario
  /inventory/stock:
    get:
      description: |
        Retorna el stock de un producto.
      parameters:
        - description: ID del producto - Busca el producto específico y sus variaciones
          in: query
          name: product_id
          schema:
            description: ID del producto - Busca el producto específico y sus variaciones
            type: string
        - description: ID externo del producto - Busca productos por su ID externo
          in: query
          name: external_id
          schema:
            description: ID externo del producto - Busca productos por su ID externo
            type: string
        - description: Código EAN o SKU del producto - Busca productos por EAN o SKU
          in: query
          name: ean
          schema:
            description: Código EAN o SKU del producto - Busca productos por EAN o SKU
            type: string
        - description: >-
            Filtro de fulfillment - 0: Solo ubicaciones no fulfillment, 1: Solo
            ubicaciones fulfillment, sin especificar: todas las ubicaciones
          in: query
          name: is_full
          schema:
            description: Filtro de fulfillment
            enum:
              - 0
              - 1
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceGetStockResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Obtener stock de un producto
      tags:
        - Inventario
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -G '$BASE_URL/inventory/stock' --data-urlencode
            'product_id=123' --data-urlencode 'is_full=1'
        - lang: http
          label: HTTP
          source: |-
            GET /inventory/stock?product_id=123&is_full=1
            Host: $BASE_HOST
        - lang: javascript
          label: fetch
          source: |-
            fetch(`${BASE_URL}/inventory/stock?product_id=123&is_full=1`)
              .then(r => r.json())
              .then(console.log);
  /orders:
    get:
      parameters:
        - description: Numero de pagina. Default 1 si no se envia o es <= 0.
          in: query
          name: page
          schema:
            type: integer
            minimum: 1
            default: 1
          example: 1
        - description: >-
            Tamano de pagina. Default 10. Maximo 200 (valores mayores se
            truncan).
          in: query
          name: size
          schema:
            type: integer
            minimum: 1
            maximum: 200
            default: 10
          example: 50
        - description: >-
            DSL JSON para filtrar ordenes. El valor es un array de expresiones
            combinables con conectores.


            **Formato de cada expresion:**

            - `["campo", valor]` -> igualdad implicita (`campo = valor`). Si
            `valor` es `null`, equivale a `IS NULL`.

            - `["campo", "operador", valor]` -> operador explicito.

            - `["and"]` o `["or"]` -> conector logico entre expresiones (sin
            conector entre dos expresiones se asume `AND`).

            - `[ [expr1], ["or"], [expr2] ]` -> subgrupo de expresiones (se
            anidan).


            **Operadores soportados:** `=`, `!=`, `>`, `>=`, `<`, `<=`, `LIKE`,
            `NOT LIKE`, `IN`, `NOT IN`, `IS`, `IS NOT`, `BETWEEN`.


            **Ejemplos:**

            - Ordenes pendientes creadas despues del 1 de enero:
              `filters=[["order_status_id","=",1],["and"],["created_at",">","2026-01-01"]]`
            - Ordenes en varios estados:
              `filters=[["order_status_id","IN",[1,2,3]]]`
            - Ordenes de una bodega especifica y sin invoicing:
              `filters=[["warehouse_id","=","WH-001"],["and"],["invoicing","=",false]]`
            - Ordenes con guia que contenga un texto:
              `filters=[["order_number","LIKE","%TGAW%"]]`

            El valor se envia URL-encoded como string JSON.
          in: query
          name: filters
          schema:
            $ref: '#/components/schemas/FiltersRaw'
          example: '[["order_status_id","=",1],["and"],["created_at",">","2026-01-01"]]'
        - description: Campo por el cual ordenar. Default `created_at`.
          in: query
          name: sort_by
          schema:
            type: string
            default: created_at
          example: created_at
        - description: >-
            Direccion del ordenamiento. Default `DESC` cuando no se envia
            `sort_by`.
          in: query
          name: sort_dir
          schema:
            type: string
            enum:
              - ASC
              - DESC
            default: DESC
        - description: >-
            Si es `true`, omite el conteo total de la consulta paginada (mejora
            performance en listas grandes).
          in: query
          name: skip_total
          schema:
            type: boolean
        - description: Filtra ordenes que contengan al menos un producto con este SKU.
          in: query
          name: sku
          schema:
            type: string
          example: SKU-A-001
        - description: Filtra ordenes que contengan al menos un producto con este EAN.
          in: query
          name: ean
          schema:
            type: string
        - description: >-
            Filtra ordenes que contengan al menos un producto con este
            `external_id`.
          in: query
          name: external_id
          schema:
            type: string
        - description: Filtra ordenes que contengan este `product_id`.
          in: query
          name: product_id
          schema:
            type: string
        - description: |-
            Filtra por estado de reemplazo de producto:
            - `true`: solo ordenes con al menos un producto reemplazado.
            - `false`: solo ordenes sin productos reemplazados.
            - Omitir el parametro para no aplicar el filtro.
          in: query
          name: product_replaced
          schema:
            type: boolean
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PaginateResponseVelocityAppOrderDomainOrder
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Listar órdenes
      tags:
        - Órdenes
      x-codeSamples:
        - lang: curl
          label: curl (basico)
          source: |-
            curl -G '$BASE_URL/orders' \
              --data-urlencode 'page=1' \
              --data-urlencode 'size=50' \
              --data-urlencode 'sort_by=created_at' \
              --data-urlencode 'sort_dir=DESC'
        - lang: curl
          label: curl (con filters DSL)
          source: |-
            curl -G '$BASE_URL/orders' \
              --data-urlencode 'page=1' \
              --data-urlencode 'size=50' \
              --data-urlencode 'filters=[["order_status_id","=",1],["and"],["created_at",">","2026-01-01"]]'
        - lang: curl
          label: curl (por producto)
          source: |-
            curl -G '$BASE_URL/orders' \
              --data-urlencode 'sku=SKU-A-001' \
              --data-urlencode 'product_replaced=true'
        - lang: http
          label: HTTP
          source: |-
            GET /orders?page=1&size=50&sort_by=created_at&sort_dir=DESC
            Host: $BASE_HOST
        - lang: javascript
          label: fetch
          source: |-
            const filters = JSON.stringify([
              ["order_status_id", "=", 1],
              ["and"],
              ["created_at", ">", "2026-01-01"]
            ]);

            const params = new URLSearchParams({
              page: 1,
              size: 50,
              sort_by: "created_at",
              sort_dir: "DESC",
              filters,
              sku: "SKU-A-001"
            });

            fetch(`${BASE_URL}/orders?${params}`)
              .then(r => r.json())
              .then(console.log);
    post:
      description: Create a new order
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceCreateRequest'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainOrder'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Crear orden
      tags:
        - Órdenes
  /orders/lists/cancel-reasons:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/DomainCancelOrderReason'
                type: array
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Listar razones de cancelación
      tags:
        - Parametros
      description: >-
        Devuelve los motivos de cancelacion que acepta el campo
        cancel_order_reason_id de POST /orders/{id}/cancel.


        La respuesta incluye TODOS los motivos, tambien los descontinuados: usar
        unicamente los que tienen active = 1. Los que traen active = 0 estan
        reservados para uso interno de la plataforma (pruebas, cancelaciones
        automaticas por integracion) y no deben enviarse desde la API.


        **Motivos de cancelacion disponibles (`cancel_order_reason_id`):**


        | id | Motivo |

        |----|--------|

        | 3 | Cliente Desiste De La Compra |

        | 4 | Pedido Mal Creado |

        | 5 | Pedido Duplicado |

        | 6 | Posible Fraude |

        | 9 | Cancelado por el cliente |

        | 10 | Cancelado por falta de stock |


        Estos son los motivos activos. Existen otros ids inactivos reservados
        para uso interno de la plataforma (pruebas, cancelaciones automaticas
        por integracion): no deben usarse desde la API. La lista vigente siempre
        se puede consultar en GET /orders/lists/cancel-reasons.
  /orders/lists/delivery-provider-type-zones:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/DomainTypeZone'
                type: array
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Listar zonas de proveedores de entrega
      tags:
        - Parametros
  /orders/lists/delivery-providers:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/DomainDeliveryProvider'
                type: array
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Listar proveedores de entrega
      tags:
        - Parametros
  /orders/lists/delivery-types:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/DomainOrderType'
                type: array
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Listar tipos de entrega
      tags:
        - Parametros
  /orders/lists/payment-methods:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/DomainPaymentMethod'
                type: array
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Listar métodos de pago
      tags:
        - Parametros
  /orders/lists/payment-types:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/DomainPaymentType'
                type: array
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Listar tipos de pago
      tags:
        - Parametros
  /orders/lists/return-reasons:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/DomainOrderReturnReason'
                type: array
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Listar razones de devolución
      tags:
        - Parametros
  /orders/lists/statuses:
    get:
      description: |-
        Allowed filters:

        - active 
        - color 
        - final 
        - in_progress 
        - in_route 
        - name 
      parameters:
        - in: query
          name: filters
          schema:
            $ref: '#/components/schemas/FiltersRaw'
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/DomainOrderStatus'
                type: array
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Listar estados de orden
      tags:
        - Parametros
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -G '$BASE_URL/orders/lists/statuses' --data-urlencode
            'filters[name]=Entregado'
        - lang: http
          label: HTTP
          source: |-
            GET /orders/lists/statuses?filters[name]=Entregado
            Host: $BASE_HOST
        - lang: javascript
          label: fetch
          source: |-
            fetch(`${BASE_URL}/orders/lists/statuses?filters[name]=Entregado`)
              .then(r => r.json())
              .then(console.log);
  /orders/{id}:
    get:
      description: >
        Retorna una orden con todos sus detalles, incluyendo items y productos.
        Si un item es un kit o combo, el campo `kits` dentro de `items`
        contendrá los productos que lo componen.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainOrder'
              example:
                id: ORD-123456
                status: pending
                created_at: '2024-01-15T10:30:00Z'
                items:
                  - id: 1
                    order_id: ORD-123456
                    product_id: PROD-KIT-789
                    description: Kit Combo Premium
                    quantity: 2
                    price: 150
                    kits:
                      - id: 1
                        order_detail_id: 1
                        product_id: PROD-001
                        quantity: 3
                        product:
                          id: PROD-001
                          name: Producto A
                          sku: SKU-A-001
                          price: 50
                          picture_url: https://example.com/product-a.jpg
                          business_id: BUS-123
                          weight: 1.5
                          width: 10
                          height: 15
                          large: 20
                          tax: 0.19
                          external_id: null
                          ean: null
                          kit_items: []
                      - id: 2
                        order_detail_id: 1
                        product_id: PROD-002
                        quantity: 1
                        product:
                          id: PROD-002
                          name: Producto B
                          sku: SKU-B-002
                          price: 30
                          picture_url: https://example.com/product-b.jpg
                          business_id: BUS-123
                          weight: 0.8
                          width: 8
                          height: 10
                          large: 12
                          tax: 0.19
                          external_id: null
                          ean: null
                          kit_items: []
                  - id: 2
                    order_id: ORD-123456
                    product_id: PROD-SIMPLE-999
                    description: Producto Simple (no es kit)
                    quantity: 1
                    price: 25
                    kits: null
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Obtener orden
      tags:
        - Órdenes
    put:
      description: Update an order
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceUpdateOrderRequest'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainOrder'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Actualizar orden
      tags:
        - Órdenes
  /orders/{id}/serials:
    get:
      description: >
        Retorna los números de serie registrados durante el proceso de picking
        de una orden, agrupados por producto.


        Solo se incluyen los productos que tienen el parámetro de serial
        habilitado. Si la orden existe pero el picking aún no ha registrado
        seriales, se retorna una lista vacía (sin error). La consulta está
        acotada al negocio (business) asociado al token de acceso.
      parameters:
        - in: path
          name: id
          required: true
          description: Número de orden (order_number) o identificador interno de la orden.
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      order_id:
                        type: string
                      order_number:
                        type: string
                      products:
                        type: array
                        items:
                          type: object
                          properties:
                            product_id:
                              type: string
                            sku:
                              type: string
                            quantity:
                              type: integer
                            serials:
                              type: array
                              items:
                                type: string
              example:
                success: true
                message: Seriales obtenidos exitosamente
                data:
                  order_id: 1r7aagi4yt700y
                  order_number: IGXO09
                  products:
                    - product_id: 1r6in6hj7k9a8k
                      sku: SKU-1007
                      quantity: 3
                      serials:
                        - '689'
                        - '690'
                        - '691'
          description: >-
            OK. Si el picking aún no ha registrado seriales, `products` es una
            lista vacía.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: No autenticado (token ausente o inválido).
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: La orden no fue encontrada.
      security:
        - bearerAuth: []
        - apiKeyAuth: []
      summary: Obtener seriales de picking de una orden
      tags:
        - Órdenes
  /orders/{id}/label:
    post:
      description: Upload shipping label file to the order
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/FormDataServiceOrderLabelRequest'
      responses:
        '200':
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Subir guia PDF y numero de guia a una orden
      tags:
        - Órdenes
  /orders/{id}/update-status:
    put:
      description: >-
        Actualiza el estado de la orden validando la máquina de estados: la
        transición solo se acepta si el estado actual de la orden está en la
        lista de estados permitidos del estado destino.


        No sirve para cancelar. Enviar order_status_id = 8 ("Cancelado") solo
        funciona si la orden está en "Pendiente" (1) o "Asignar Piloto" (4); en
        cualquier otro estado responde 400 con "la acción no puede ser
        ejecutada, la transición del estado X al estado 8 no está permitida".
        Para cancelar usar siempre POST /orders/{id}/cancel, que además devuelve
        el inventario reservado y registra el motivo.


        Tampoco sirve para reintentar una entrega fallida: para eso usar POST
        /orders/{id}/try.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceUpdateStatusOrderRequest'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainOrder'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Actualizar estado de orden
      tags:
        - Órdenes
  /orders/{id}/try:
    post:
      description: >-
        Reintenta la entrega de una orden. Reincorpora la orden al flujo de
        entrega dejándola en estado "Asignar Piloto" (4) y limpia el conductor
        asignado (driver_id), sin validar la transición de estado.


        Es el camino correcto para ejecutar un nuevo intento de entrega sobre
        una orden en estado "Devolución" tras una entrega fallida (a diferencia
        de update-status, que rechaza esa transición).


        No requiere cuerpo (body): solo el id de la orden en la ruta. Tras el
        reintento la orden retoma el flujo normal: Asignar Piloto -> Asignado a
        Piloto -> Recoger -> En Camino -> Entregado.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainOrder'
          description: >-
            OK. Orden actualizada al estado "Asignar Piloto" (order_status_id =
            4) con el conductor liberado.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Not Found. La orden no existe (order_not_found).
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Internal Server Error. Error al actualizar la orden.
      summary: Reintentar orden (nuevo intento de entrega)
      tags:
        - Órdenes
  /orders/{id}/cancel:
    post:
      description: >-
        Cancela una orden. Es el UNICO camino correcto para cancelar: deja la
        orden en estado "Cancelado" (8), devuelve al inventario las unidades
        reservadas, registra el motivo de cancelación y agrega una nota en la
        orden.


        No usar update-status con order_status_id = 8 para cancelar: ese
        endpoint valida la máquina de estados y solo acepta la transición a
        "Cancelado" desde "Pendiente" (1) o "Asignar Piloto" (4). Una orden en
        "Picking" (13), "Novedad de Picking" (20), "Novedad por inventario" (15)
        o "Novedad" (21) es cancelable, pero update-status la rechaza con el
        error "la acción no puede ser ejecutada, la transición del estado X al
        estado 8 no está permitida". Este endpoint no tiene esa restricción.


        El campo cancel_order_reason_id es obligatorio; los valores válidos se
        consultan en GET /orders/lists/cancel-reasons. El campo note es opcional
        y se concatena al motivo en la nota que queda registrada en la orden.


        Es idempotente: si la orden ya está en "Cancelado" (8) responde 200 con
        la orden sin repetir el retorno de inventario.


        **Motivos de cancelacion disponibles (`cancel_order_reason_id`):**


        | id | Motivo |

        |----|--------|

        | 3 | Cliente Desiste De La Compra |

        | 4 | Pedido Mal Creado |

        | 5 | Pedido Duplicado |

        | 6 | Posible Fraude |

        | 9 | Cancelado por el cliente |

        | 10 | Cancelado por falta de stock |


        Estos son los motivos activos. Existen otros ids inactivos reservados
        para uso interno de la plataforma (pruebas, cancelaciones automaticas
        por integracion): no deben usarse desde la API. La lista vigente siempre
        se puede consultar en GET /orders/lists/cancel-reasons.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceCancelOrderRequest'
            example:
              cancel_order_reason_id: 4
              note: Orden creada por error
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainOrder'
          description: >-
            OK. Orden cancelada (order_status_id = 8), inventario reservado
            devuelto y motivo registrado.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: >-
            Bad Request. Falta cancel_order_reason_id o el motivo enviado no
            existe.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Not Found. La orden no existe.
        '423':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: >-
            Locked. No se pudo devolver el inventario porque está bloqueado (por
            ejemplo, congelado por un conteo cíclico en curso). La cancelación
            se aborta completa y puede reintentarse.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: >-
            Internal Server Error. Error al devolver el inventario o al
            actualizar la orden; la orden no queda cancelada.
      summary: Cancelar orden
      tags:
        - Órdenes
  /products:
    get:
      description: |
        Retorna una lista de productos.
      parameters:
        - description: Page number
          in: query
          name: page
          schema:
            description: Page number
            type: integer
        - description: Page size
          in: query
          name: size
          schema:
            description: Page size
            type: integer
        - description: SKU del producto
          in: query
          name: sku
          schema:
            description: SKU del producto
            type: string
        - description: Código EAN del producto
          in: query
          name: ean
          schema:
            description: Código EAN del producto
            type: string
        - description: ID del negocio
          in: query
          name: business_id
          schema:
            description: ID del negocio
            type: string
        - description: Fecha de creación desde (YYYY-MM-DD)
          in: query
          name: created_at_from
          schema:
            description: Fecha de creación desde
            type: string
            format: date
        - description: Fecha de creación hasta (YYYY-MM-DD)
          in: query
          name: created_at_to
          schema:
            description: Fecha de creación hasta
            type: string
            format: date
        - description: ID del producto
          in: query
          name: product_id
          schema:
            description: ID del producto
            type: string
        - description: ID externo del producto
          in: query
          name: external_id
          schema:
            description: ID externo del producto
            type: string
        - description: sort by field
          in: query
          name: sort_by
          schema:
            description: sort by field
            type: string
        - description: sort direction
          in: query
          name: sort_dir
          schema:
            description: sort direction
            enum:
              - ASC
              - DESC
            type: string
        - description: skip total count, can be used for performance
          in: query
          name: skip_total
          schema:
            description: skip total count, can be used for performance
            type: boolean
        - description: 'Producto activo. Valores permitidos: TRUE, FALSE'
          in: query
          name: active
          schema:
            description: Producto activo
            type: string
            enum:
              - 'TRUE'
              - 'FALSE'
            example: 'TRUE'
          examples:
            'TRUE':
              value: 'TRUE'
            'FALSE':
              value: 'FALSE'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PaginateResponseVelocityAppProductDomainProductType2
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Listar productos
      tags:
        - Productos
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -G '$BASE_URL/products' --data-urlencode 'active=TRUE'
            --data-urlencode 'page=1' --data-urlencode 'size=50'
        - lang: http
          label: HTTP
          source: |-
            GET /products?active=TRUE&page=1&size=50
            Host: $BASE_HOST
        - lang: javascript
          label: fetch
          source: |-
            fetch(`${BASE_URL}/products?active=TRUE&page=1&size=50`)
              .then(r => r.json())
              .then(console.log);
    post:
      description: |
        Crea un producto.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceCreateProductRequest'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainProductType2'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Crear producto
      tags:
        - Productos
  /products/{id}:
    get:
      description: |
        Retorna un producto.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainProductType2'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Obtener producto
      tags:
        - Productos
    put:
      description: |
        Actualiza un producto.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceUpdateProductRequest'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainProductType2'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Actualizar producto
      tags:
        - Productos
  /warehouses:
    get:
      description: |
        Retorna una lista de bodegas.
      parameters:
        - description: Page number
          in: query
          name: page
          schema:
            description: Page number
            type: integer
        - description: Page size
          in: query
          name: size
          schema:
            description: Page size
            type: integer
        - description: filter query
          in: query
          name: filters
          schema:
            $ref: '#/components/schemas/FiltersRaw'
            description: filter query
        - description: sort by field
          in: query
          name: sort_by
          schema:
            description: sort by field
            type: string
        - description: sort direction
          in: query
          name: sort_dir
          schema:
            description: sort direction
            enum:
              - ASC
              - DESC
            type: string
        - description: skip total count, can be used for performance
          in: query
          name: skip_total
          schema:
            description: skip total count, can be used for performance
            type: boolean
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PaginateResponseVelocityAppWarehouseDomainWarehouse
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Listar Bodegas
      tags:
        - Bodegas
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -G '$BASE_URL/warehouses' --data-urlencode 'page=1'
            --data-urlencode 'size=50'
        - lang: http
          label: HTTP
          source: |-
            GET /warehouses?page=1&size=50
            Host: $BASE_HOST
        - lang: javascript
          label: fetch
          source: |-
            fetch(`${BASE_URL}/warehouses?page=1&size=50`)
              .then(r => r.json())
              .then(console.log);
    post:
      description: |
        Crea una bodega.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceCreateWarehouseRequest'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainWarehouseType4'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Crear Bodega
      tags:
        - Bodegas
  /warehouses/{id}:
    get:
      description: |
        Retorna una bodega.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainWarehouseType4'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Obtener Bodega
      tags:
        - Bodegas
    put:
      description: |
        Actualiza una bodega.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceUpdateWarehouseRequest'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainWarehouseType4'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Actualizar Bodega
      tags:
        - Bodegas
  /webhooks:
    get:
      description: |
        Retorna una lista de webhooks.
      parameters:
        - description: ID del webhook
          in: query
          name: id
          schema:
            description: ID del webhook
            type: integer
        - description: URL del webhook
          in: query
          name: url
          schema:
            description: URL del webhook
            type: string
        - description: >-
            Tópico/tema del webhook. Valores permitidos: inventory.updated,
            order.status_updated, product.updated
          in: query
          name: topic
          schema:
            description: Tópico/tema del webhook
            type: string
            enum:
              - inventory.updated
              - order.status_updated
              - product.updated
        - description: 'Fecha de creación desde (formato: YYYY-MM-DD)'
          in: query
          name: created_at_from
          schema:
            description: 'Fecha de creación desde (formato: YYYY-MM-DD)'
            example: '2024-01-01'
            type: string
        - description: 'Fecha de creación hasta (formato: YYYY-MM-DD)'
          in: query
          name: created_at_to
          schema:
            description: 'Fecha de creación hasta (formato: YYYY-MM-DD)'
            example: '2024-12-31'
            type: string
        - description: Page number
          in: query
          name: page
          schema:
            description: Page number
            type: integer
        - description: Page size
          in: query
          name: size
          schema:
            description: Page size
            type: integer
        - description: filter query
          in: query
          name: filters
          schema:
            $ref: '#/components/schemas/FiltersRaw'
            description: filter query
        - description: sort by field
          in: query
          name: sort_by
          schema:
            description: sort by field
            type: string
        - description: sort direction
          in: query
          name: sort_dir
          schema:
            description: sort direction
            enum:
              - ASC
              - DESC
            type: string
        - description: skip total count, can be used for performance
          in: query
          name: skip_total
          schema:
            description: skip total count, can be used for performance
            type: boolean
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PaginateResponseVelocityAppWebhookDomainWebhook
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Listar webhooks
      tags:
        - Webhooks
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -G '$BASE_URL/webhooks' --data-urlencode
            'topic=inventory.updated' --data-urlencode 'page=1' --data-urlencode
            'size=50'
        - lang: http
          label: HTTP
          source: |-
            GET /webhooks?topic=inventory.updated&page=1&size=50
            Host: $BASE_HOST
        - lang: javascript
          label: fetch
          source: |-
            fetch(`${BASE_URL}/webhooks?topic=inventory.updated&page=1&size=50`)
              .then(r => r.json())
              .then(console.log);
    post:
      description: |
        Crea un webhook.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceCreateWebhookRequest'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainWebhook'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Crear webhook
      tags:
        - Webhooks
  /webhooks/{id}:
    get:
      description: |
        Retorna un webhook.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainWebhook'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Obtener webhook
      tags:
        - Webhooks
    delete:
      description: |
        Elimina un webhook.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorSchema'
          description: Bad Request
      summary: Eliminar webhook
      tags:
        - Webhooks
  /warehouses/{id}/inventory:
    get:
      summary: Consulta de productos por bodega
      description: >
        Retorna el inventario de una bodega: listado paginado de productos con
        su stock actual. Si la bodega tiene layout activo, cada producto incluye
        el detalle de sus ubicaciones (codigo, cantidad y si la ubicacion es
        FULL o no). Productos con stock 0 se incluyen.


        Cada producto incluye el campo seller con el id y nombre del negocio al
        que pertenece. En negocios con sellers (negocios hijos), se puede
        filtrar por seller_id para obtener solo los productos de un seller
        especifico.


        Si la bodega no existe o no pertenece al negocio del token se retorna
        404.
      tags:
        - Productos
      security:
        - bearerAuth: []
        - apiKeyAuth: []
      parameters:
        - name: id
          in: path
          required: true
          description: ID numerico de la bodega.
          schema:
            type: integer
            example: 17
        - name: sku
          in: query
          description: Filtrar por SKU exacto.
          schema:
            type: string
            example: MX3HSCU6
        - name: ean
          in: query
          description: Filtrar por EAN exacto.
          schema:
            type: string
            example: '7702011642017'
        - name: product_id
          in: query
          description: Filtrar por ID de producto.
          schema:
            type: string
            example: 60186b3ad8fcc
        - name: name
          in: query
          description: Filtrar por nombre exacto.
          schema:
            type: string
            example: Mouse Logitech M185
        - name: location_code
          in: query
          description: Filtrar productos cuya ubicacion tenga este codigo.
          schema:
            type: string
            example: A-01-03
        - name: location_id
          in: query
          description: Filtrar por ID de ubicacion.
          schema:
            type: integer
            example: 21
        - name: location_is_full
          in: query
          description: 'true: solo ubicaciones FULL. false: solo NO FULL.'
          schema:
            type: boolean
            example: true
        - name: page
          in: query
          description: 'Numero de pagina (default: 1).'
          schema:
            type: integer
            example: 1
        - name: size
          in: query
          description: 'Items por pagina (default: 10, max: 500). Paginacion por producto.'
          schema:
            type: integer
            example: 50
        - name: sort_by
          in: query
          description: Campo de ordenamiento.
          schema:
            type: string
            enum:
              - name
              - sku
              - ean
              - id
              - stock
            example: stock
        - name: sort_dir
          in: query
          description: Direccion del ordenamiento.
          schema:
            type: string
            enum:
              - ASC
              - DESC
            example: DESC
        - name: seller_id
          in: query
          description: >-
            Filtrar productos por seller (negocio hijo). Debe ser un business_id
            accesible por el token, de lo contrario retorna 403.
          schema:
            type: string
            example: 66ed95749127e
        - name: skip_total
          in: query
          description: Si es true omite COUNT (total=0).
          schema:
            type: boolean
            example: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WarehouseInventoryResponse'
              example:
                warehouse:
                  id: 17
                  name: Prueba Caro
                  has_layout: true
                total: 4
                page: 1
                size: 2
                total_pages: 2
                items:
                  - id: 639a0e757e144
                    name: limpiador fabuloso 12un x1000ml
                    sku: '7702010225239'
                    stock: 3
                    locations:
                      - id: 21
                        code: UBTESTISFULL1
                        qty: 0
                        is_full: true
                      - id: 28
                        code: TFULL
                        qty: 1
                        is_full: true
                      - id: 29
                        code: TFULL2
                        qty: 2
                        is_full: true
                    seller:
                      id: 66ed95749127e
                      name: ULTIMA MILLA
                  - id: 6393a7b36eaae
                    name: Pediasure Botella 24Un x237ml
                    sku: '7703186031204'
                    stock: 1
                    locations:
                      - id: 30
                        code: TFULL3
                        qty: 1
                        is_full: true
                    seller:
                      id: 66ed95749127e
                      name: ULTIMA MILLA
        '400':
          description: Solicitud invalida.
          content:
            application/json:
              examples:
                bodega_requerida:
                  summary: Sin id en el path
                  value:
                    code: bodega_requerida
                    message: >-
                      Debe proporcionar el id de la bodega en el path:
                      /warehouses/{id}/inventory
                warehouse_id_invalido:
                  summary: id invalido
                  value:
                    code: warehouse_id_invalido
                    message: El id de la bodega debe ser un numero entero positivo
                location_id_invalido:
                  summary: location_id invalido
                  value:
                    code: location_id_invalido
                    message: >-
                      El parametro location_id debe ser un numero entero
                      positivo
                location_is_full_invalido:
                  summary: location_is_full invalido
                  value:
                    code: location_is_full_invalido
                    message: El parametro location_is_full debe ser true o false
        '401':
          description: Unauthorized - token invalido o ausente
        '403':
          description: >-
            Forbidden - seller_id no pertenece a los negocios accesibles del
            token.
          content:
            application/json:
              example:
                code: seller_no_permitido
                message: >-
                  El seller_id indicado no pertenece a los negocios accesibles
                  para este usuario
        '404':
          description: Bodega no encontrada o no disponible para el negocio del token.
          content:
            application/json:
              example:
                code: bodega_no_encontrada
                message: Bodega no encontrada o no disponible para este negocio
        '500':
          description: Error interno
          content:
            application/json:
              example:
                code: error_base_datos
                message: Error al consultar los productos de la bodega
      x-codeSamples:
        - lang: curl
          label: curl basico
          source: |-
            curl -G '$BASE_URL/warehouses/17/inventory' \
              -H 'Authorization: Bearer <token>' \
              --data-urlencode 'page=1' \
              --data-urlencode 'size=50' \
              --data-urlencode 'sort_by=stock' \
              --data-urlencode 'sort_dir=DESC'
        - lang: curl
          label: curl (filtros de producto)
          source: |-
            curl -G '$BASE_URL/warehouses/17/inventory' \
              -H 'Authorization: Bearer <token>' \
              --data-urlencode 'sku=MX3HSCU6'
        - lang: curl
          label: curl (solo ubicaciones FULL)
          source: |-
            curl -G '$BASE_URL/warehouses/17/inventory' \
              -H 'Authorization: Bearer <token>' \
              --data-urlencode 'location_is_full=true'
        - lang: curl
          label: curl (filtrar por seller)
          source: |-
            curl -G '$BASE_URL/warehouses/1094/inventory' \
              -H 'Authorization: Bearer <token>' \
              --data-urlencode 'seller_id=66ed95749127e' \
              --data-urlencode 'page=1' \
              --data-urlencode 'size=50'
        - lang: http
          label: HTTP
          source: >-
            GET
            /warehouses/17/inventory?page=1&size=50&sort_by=stock&sort_dir=DESC

            Host: $BASE_HOST

            Authorization: Bearer <token>
        - lang: javascript
          label: fetch
          source: >-
            fetch(`${BASE_URL}/warehouses/17/inventory?page=1&size=50&sort_by=stock&sort_dir=DESC`,
            {
              headers: { 'Authorization': 'Bearer <token>' }
            })
              .then(r => r.json())
              .then(console.log);
components:
  schemas:
    ApiErrorSchema:
      properties:
        code:
          description: error code to identify the type of error
          examples:
            - invalid_request
          type: string
        details:
          description: additional details about the error
          examples:
            - {}
          type:
            - object
            - 'null'
        message:
          description: error message
          examples:
            - invalid request
          type: string
      type: object
    BulkloadBulkLoadValidationResponseVelocityAppBulkloadExampleData:
      properties:
        columns:
          items:
            $ref: '#/components/schemas/BulkloadColumn'
          type:
            - array
            - 'null'
        filename:
          type: string
        has_errors:
          type: boolean
        processed_data:
          items:
            $ref: '#/components/schemas/BulkloadExampleData'
          type:
            - array
            - 'null'
        rows_with_errors:
          items:
            items:
              type: string
            type: array
          type:
            - array
            - 'null'
      type: object
    BulkloadBulkLoadValidationResponseVelocityAppExternalShippingSharedServiceGenerateMassiveShippingData:
      properties:
        columns:
          items:
            $ref: '#/components/schemas/BulkloadColumn'
          type:
            - array
            - 'null'
        filename:
          type: string
        has_errors:
          type: boolean
        processed_data:
          items:
            $ref: '#/components/schemas/ServiceGenerateMassiveShippingData'
          type:
            - array
            - 'null'
        rows_with_errors:
          items:
            items:
              type: string
            type: array
          type:
            - array
            - 'null'
      type: object
    BulkloadBulkProcess:
      properties:
        business_id:
          type: string
        created_at:
          format: date-time
          type: string
        filename:
          type: string
        finished_at:
          format: date-time
          type:
            - 'null'
            - string
        id:
          type: integer
        total_records:
          type: integer
        type:
          type: string
        user_id:
          type: integer
      type: object
    BulkloadColumn:
      properties:
        label:
          type: string
        name:
          type: string
      type: object
    BulkloadExampleData:
      properties:
        idx:
          type: integer
        name:
          type: string
        number:
          type: integer
      type: object
    BulkloadExampleProcessBulkLoadRequest:
      properties:
        data:
          items:
            $ref: '#/components/schemas/BulkloadExampleData'
          type:
            - array
            - 'null'
        filename:
          type: string
      type: object
    ClustersCluster:
      properties:
        center:
          $ref: '#/components/schemas/ClustersPoint'
        color:
          type: string
        driver_id:
          type: integer
        error:
          $ref: '#/components/schemas/ClustersClusterError'
        geo_json:
          $ref: '#/components/schemas/ClustersGeoJSON'
        observations:
          $ref: '#/components/schemas/ClustersObservations'
        orders:
          items:
            type: string
          type:
            - array
            - 'null'
      type: object
    ClustersClusterError:
      properties:
        detail: {}
        error_code:
          type: integer
        message:
          type: string
      type: object
    ClustersClusters:
      items:
        $ref: '#/components/schemas/ClustersCluster'
      type:
        - array
        - 'null'
    ClustersGeoJSON:
      properties:
        features:
          items:
            additionalProperties: {}
            type: object
          type:
            - array
            - 'null'
        type:
          type: string
      type: object
    ClustersObservation: {}
    ClustersObservations:
      items:
        $ref: '#/components/schemas/ClustersObservation'
      type:
        - array
        - 'null'
    ClustersPoint:
      properties:
        address:
          type: string
        coordinates:
          items:
            type: number
          type:
            - array
            - 'null'
        id:
          type: string
        order_number:
          type: string
      type: object
    CountriesCityDane:
      properties:
        city_dane:
          $ref: '#/components/schemas/CountriesCityDane'
        city_dane_id:
          type:
            - 'null'
            - integer
        code:
          type: string
        country:
          $ref: '#/components/schemas/CountriesCountry'
        country_id:
          type: integer
        id:
          type: integer
        name:
          type: string
      type: object
    CountriesCountry:
      properties:
        code:
          type: string
        currency:
          type: string
        has_sublevels:
          type: boolean
        id:
          type: integer
        language:
          type: string
        name:
          type: string
      type: object
    DomainAuthAssignment:
      properties:
        item_name:
          type: string
      type: object
    DomainAuthData:
      properties:
        business_id:
          type: string
        business_type:
          type: string
        parent_business_id:
          type:
            - 'null'
            - string
        scopes:
          items:
            type: string
          type:
            - array
            - 'null'
        user_id:
          type: integer
      type: object
    DomainBoardRoute:
      properties:
        driver_id:
          type: integer
        full_name:
          type:
            - 'null'
            - string
        license_plate:
          type:
            - 'null'
            - string
        percentage:
          type:
            - 'null'
            - number
        quantity:
          type: integer
        route_id:
          type: string
        type_vehicle:
          type:
            - 'null'
            - string
      type: object
    DomainBusiness:
      properties:
        a_threshold:
          type:
            - 'null'
            - number
        active:
          type: boolean
        assign_pickers:
          type:
            - 'null'
            - integer
        automatic_guide:
          type: integer
        automatic_purchase_order:
          type:
            - 'null'
            - integer
        automatic_warehouse_assigment:
          type:
            - 'null'
            - integer
        b_threshold:
          type:
            - 'null'
            - number
        c_threshold:
          type:
            - 'null'
            - number
        calc_discount_after_tax:
          type: boolean
        country_id:
          type:
            - 'null'
            - integer
        created_at:
          format: date-time
          type:
            - 'null'
            - string
        delivery_courier_margin:
          type:
            - 'null'
            - integer
        delivery_fee:
          type:
            - 'null'
            - number
        document_type_id:
          type:
            - 'null'
            - integer
        documents:
          items:
            $ref: '#/components/schemas/DomainBusinessDocument'
          type:
            - array
            - 'null'
        driver_scan_packages:
          type:
            - 'null'
            - integer
        email:
          type:
            - 'null'
            - string
        email_contact_accounting:
          type:
            - 'null'
            - string
        external_id:
          type:
            - 'null'
            - string
        external_id_help:
          type:
            - 'null'
            - string
        external_integration_id:
          type:
            - 'null'
            - integer
        external_integrations:
          items:
            $ref: '#/components/schemas/DomainExternalIntegration'
          type:
            - array
            - 'null'
        id:
          type:
            - 'null'
            - string
        invoice_status_id:
          type:
            - 'null'
            - integer
        invoicing:
          type: boolean
        is_package_type_delivery:
          type: boolean
        is_partner:
          type:
            - 'null'
            - boolean
        is_picking_cases_enabled:
          type:
            - 'null'
            - boolean
        is_saas:
          type:
            - 'null'
            - boolean
        is_signed_commercial_agreement:
          type:
            - 'null'
            - string
        kam_user_id:
          type:
            - 'null'
            - integer
        legal_id:
          type: string
        legal_name:
          type:
            - 'null'
            - string
        name:
          type: string
        only_last_mile:
          type: boolean
        own_inventory:
          type:
            - 'null'
            - integer
        parent_business_id:
          type:
            - 'null'
            - string
        percentage_inventory_notice_variation:
          type:
            - 'null'
            - integer
        phone_number:
          type:
            - 'null'
            - string
        prefix:
          type:
            - 'null'
            - string
        project_channel:
          type:
            - 'null'
            - string
        provider_service_id:
          type:
            - 'null'
            - integer
        route_validation:
          type:
            - 'null'
            - boolean
        scan_products:
          type:
            - 'null'
            - integer
        sequence:
          type:
            - 'null'
            - integer
        shipment_included_total:
          type:
            - 'null'
            - integer
        shipping_best_price:
          type:
            - 'null'
            - integer
        show_basket:
          type:
            - 'null'
            - integer
        show_massive_quantity:
          type:
            - 'null'
            - integer
        show_note:
          type:
            - 'null'
            - integer
        show_note_app:
          type:
            - 'null'
            - integer
        show_note_ok:
          type:
            - 'null'
            - integer
        show_type_zone:
          type: boolean
        sms_notification:
          type:
            - 'null'
            - boolean
        super:
          type:
            - 'null'
            - integer
        take_manual_order:
          type:
            - 'null'
            - integer
        tax_before_total:
          type:
            - 'null'
            - integer
        telegram_chat:
          type:
            - 'null'
            - string
        updated_at:
          format: date-time
          type:
            - 'null'
            - string
        variation_percentage:
          type:
            - 'null'
            - integer
        wallet_amount:
          type: number
        warehouses:
          items:
            $ref: '#/components/schemas/DomainBusinessWarehouse'
          type:
            - array
            - 'null'
      type: object
    DomainBusinessDeliveryProvider:
      properties:
        active:
          type: boolean
        alias:
          type: string
        business_id:
          type: string
        config: {}
        created_at:
          format: date-time
          type: string
        deleted_at:
          format: date-time
          type:
            - 'null'
            - string
        delivery_provider:
          $ref: '#/components/schemas/DomainDeliveryProviderType2'
        delivery_provider_id:
          type: integer
        id:
          type: integer
        own_integration:
          type: boolean
        parent:
          $ref: '#/components/schemas/DomainBusinessDeliveryProvider'
        parent_id:
          type:
            - 'null'
            - integer
        updated_at:
          format: date-time
          type: string
      type: object
    DomainBusinessDocument:
      properties:
        business_id:
          type: string
        created_at:
          format: date-time
          type: string
        document:
          type: string
        id:
          type: integer
      type: object
    DomainBusinessWarehouse:
      properties:
        active:
          type:
            - 'null'
            - integer
        business_id:
          type: string
        created_at:
          format: date-time
          type:
            - 'null'
            - string
        default:
          type:
            - 'null'
            - integer
        external_configuration:
          type:
            - 'null'
            - string
        external_id:
          type:
            - 'null'
            - string
        id:
          type: integer
        rappi_store_id:
          type:
            - 'null'
            - string
        shopify_location_id:
          type:
            - 'null'
            - string
        updated_at:
          format: date-time
          type:
            - 'null'
            - string
        warehouse:
          $ref: '#/components/schemas/DomainWarehouseType3'
        warehouse_code:
          type:
            - 'null'
            - string
        warehouse_code_help:
          type:
            - 'null'
            - string
        warehouse_id:
          type: integer
      type: object
    DomainCancelOrderReason:
      properties:
        active:
          type: integer
          description: >-
            1 = motivo vigente y utilizable desde la API. 0 = descontinuado o de
            uso interno, no usar.
        id:
          type: integer
        name:
          type: string
      type: object
    DomainControlPoint:
      properties:
        active:
          type: boolean
        business_id:
          type: string
        color:
          type: string
        id:
          type: integer
        lat:
          type: number
        lng:
          type: number
        name:
          type: string
        radius:
          type: number
        warehouse_id:
          type: integer
      type: object
    DomainControlPointEvent:
      properties:
        business_id:
          type: string
        control_point:
          $ref: '#/components/schemas/DomainControlPoint'
        control_point_event_type:
          $ref: '#/components/schemas/DomainControlPointEventType'
        control_point_event_type_id:
          type: integer
        control_point_id:
          type: integer
        created_at:
          format: date-time
          type:
            - 'null'
            - string
        driver:
          $ref: '#/components/schemas/DomainDriver'
        driver_id:
          type: integer
        event_at:
          format: date-time
          type:
            - 'null'
            - string
        id:
          type: integer
      type: object
    DomainControlPointEventType:
      properties:
        color:
          type: string
        id:
          type: integer
        name:
          type: string
      type: object
    DomainCountry:
      properties:
        currency:
          type: string
        has_sublevels:
          type: boolean
        id:
          type: string
        name:
          type: string
      type: object
    DomainCustomer:
      properties:
        dni:
          type: string
        document_type_id:
          type:
            - 'null'
            - integer
        email:
          type: string
        full_name:
          type: string
        id:
          type: integer
        mobile_phone_number:
          type: string
        phone_number:
          type: string
      type: object
    DomainDeliveryProvider:
      properties:
        id:
          type: string
        name:
          type: string
      type: object
    DomainDeliveryProviderType2:
      properties:
        accept_multiple_packages:
          type: boolean
        config: {}
        country_id:
          type: integer
        courier_code:
          type: string
        id:
          type: integer
        is_aggregator:
          type: boolean
        is_default:
          type: boolean
        is_public:
          type: boolean
        is_standard:
          type: boolean
        name:
          type: string
        parent:
          $ref: '#/components/schemas/DomainDeliveryProviderType2'
        parent_id:
          type:
            - 'null'
            - integer
        standard_config: {}
        webhook_token:
          type: string
      type: object
    DomainDetailBoardRoute:
      properties:
        collect:
          type:
            - 'null'
            - number
        customer_name:
          type:
            - 'null'
            - string
        driver_id:
          type: integer
        order_number:
          type:
            - 'null'
            - string
        route:
          type: string
        seller_name:
          type:
            - 'null'
            - string
        status_name:
          type:
            - 'null'
            - string
        to_collect:
          type:
            - 'null'
            - number
        total:
          type:
            - 'null'
            - number
      type: object
    DomainDetailBoardRouteCash:
      properties:
        order_number:
          type:
            - 'null'
            - string
        status_name:
          type:
            - 'null'
            - string
        to_collect:
          type:
            - 'null'
            - number
      type: object
    DomainDocumentType:
      properties:
        id:
          type: integer
        name:
          type: string
      type: object
    DomainDriver:
      properties:
        active:
          type: boolean
        business_id:
          type: string
        created_at:
          format: date-time
          type:
            - 'null'
            - string
        deleted_at:
          format: date-time
          type:
            - 'null'
            - string
        dni:
          type: string
        full_name:
          type: string
        id:
          type: integer
        lat:
          type:
            - 'null'
            - number
        license_plate:
          type: string
        lng:
          type:
            - 'null'
            - number
        phone_number:
          type: string
        pin:
          type: string
        token_device:
          type:
            - 'null'
            - string
        type_vehicle:
          $ref: '#/components/schemas/DomainTypeVehicle'
        type_vehicle_id:
          type:
            - 'null'
            - integer
        updated_at:
          format: date-time
          type:
            - 'null'
            - string
        warehouses:
          items:
            $ref: '#/components/schemas/DomainWarehouse'
          type:
            - array
            - 'null'
      type: object
    DomainExternalIntegration:
      type: object
    DomainExtraData:
      additionalProperties: {}
      type:
        - 'null'
        - object
    DomainIntegrationType:
      properties:
        id:
          type: integer
        name:
          type: string
      type: object
    DomainIntegrationTypeType2:
      properties:
        id:
          type: integer
        name:
          type: string
      type: object
    DomainLatLang:
      properties:
        lat:
          type: number
        lng:
          type: number
      type: object
    DomainListPosition:
      properties:
        position_default:
          $ref: '#/components/schemas/DomainLatLang'
        positions:
          items:
            $ref: '#/components/schemas/DomainPosition'
          type:
            - array
            - 'null'
        size:
          type: integer
      type: object
    DomainOrder:
      properties:
        approved:
          type: boolean
        boxes:
          type:
            - 'null'
            - integer
        business:
          $ref: '#/components/schemas/DomainBusiness'
        business_id:
          type:
            - 'null'
            - string
        cancel_order_reason:
          $ref: '#/components/schemas/DomainCancelOrderReason'
        cancel_order_reason_id:
          type:
            - 'null'
            - integer
        city_dane_id:
          type:
            - 'null'
            - integer
        cod_total:
          type:
            - 'null'
            - number
        country:
          $ref: '#/components/schemas/DomainCountry'
        country_id:
          type:
            - 'null'
            - integer
        coupon:
          type:
            - 'null'
            - string
        created_at:
          format: date-time
          type:
            - 'null'
            - string
        customer:
          $ref: '#/components/schemas/DomainCustomer'
        customer_id:
          type:
            - 'null'
            - integer
        delivery_date:
          format: date-time
          type:
            - 'null'
            - string
        delivery_fee:
          type:
            - 'null'
            - number
        delivery_kms:
          type:
            - 'null'
            - integer
        delivery_provider:
          $ref: '#/components/schemas/DomainDeliveryProvider'
        delivery_provider_id:
          type:
            - 'null'
            - integer
        delivery_provider_type_zone_id:
          type:
            - 'null'
            - integer
        discount:
          type:
            - 'null'
            - number
        driver:
          $ref: '#/components/schemas/DomainDriver'
        driver_id:
          type:
            - 'null'
            - integer
        end_picking_date:
          format: date-time
          type:
            - 'null'
            - string
        external_order_id:
          type:
            - 'null'
            - string
        extra_data:
          $ref: '#/components/schemas/DomainExtraData'
        guide_id:
          type:
            - 'null'
            - string
        guide_link:
          type:
            - 'null'
            - string
        height:
          type:
            - 'null'
            - number
        history:
          items:
            $ref: '#/components/schemas/DomainOrderHistory'
          type:
            - 'null'
            - array
        id:
          type: string
        integration_type:
          $ref: '#/components/schemas/DomainIntegrationTypeType2'
        integration_type_id:
          type:
            - 'null'
            - integer
        invoiceable:
          type:
            - 'null'
            - boolean
        invoices:
          items:
            $ref: '#/components/schemas/DomainOrderInvoice'
          type:
            - 'null'
            - array
        is_delivery_default:
          type: boolean
        is_last_mile:
          type: boolean
        is_paid:
          type: boolean
        items:
          items:
            $ref: '#/components/schemas/DomainOrderDetail'
          type:
            - array
            - 'null'
        large:
          type:
            - 'null'
            - number
        manifest_printed:
          type: boolean
        next_status:
          items:
            $ref: '#/components/schemas/DomainOrderStatus'
          type:
            - 'null'
            - array
        notes:
          items:
            $ref: '#/components/schemas/DomainOrderNote'
          type:
            - 'null'
            - array
        order_return_reason:
          $ref: '#/components/schemas/DomainOrderReturnReason'
        order_return_reason_id:
          type:
            - 'null'
            - integer
        order_status:
          $ref: '#/components/schemas/DomainOrderStatus'
        order_status_id:
          type:
            - 'null'
            - integer
        order_sticker:
          type:
            - 'null'
            - string
        order_type:
          $ref: '#/components/schemas/DomainOrderType'
        order_type_id:
          type:
            - 'null'
            - integer
        order_number:
          description: >-
            Número de orden personalizado. Si no se envía, se genera
            automáticamente
          type:
            - 'null'
            - string
        origin_shipping_information:
          $ref: '#/components/schemas/DomainShippingInformation'
        origin_shipping_information_id:
          type:
            - 'null'
            - integer
        packing_user_id:
          type:
            - 'null'
            - integer
        payment_method:
          $ref: '#/components/schemas/DomainPaymentMethod'
        payment_method_id:
          type:
            - 'null'
            - integer
        payment_type_id:
          type:
            - 'null'
            - integer
        picking_user_id:
          type:
            - 'null'
            - integer
        pictures:
          items:
            $ref: '#/components/schemas/DomainOrderPicture'
          type:
            - 'null'
            - array
        shipping_information:
          $ref: '#/components/schemas/DomainShippingInformation'
        shipping_information_id:
          type:
            - 'null'
            - integer
        start_picking_date:
          format: date-time
          type:
            - 'null'
            - string
        subtotal:
          type:
            - 'null'
            - number
        tags:
          type:
            - 'null'
            - string
        tax:
          type:
            - 'null'
            - number
        test:
          type: boolean
        ticket_id:
          type:
            - 'null'
            - string
        total:
          type:
            - 'null'
            - number
        total_shipment:
          type:
            - 'null'
            - number
        tracking_link:
          type:
            - 'null'
            - string
        tracking_number:
          type:
            - 'null'
            - string
        tries:
          type:
            - 'null'
            - integer
        updated_at:
          format: date-time
          type:
            - 'null'
            - string
        user_id:
          type:
            - 'null'
            - integer
        warehouse:
          $ref: '#/components/schemas/DomainWarehouseType4'
        warehouse_id:
          type:
            - 'null'
            - integer
        weight:
          type:
            - 'null'
            - number
        width:
          type:
            - 'null'
            - number
        zone_name:
          $ref: '#/components/schemas/DomainZoneName'
        zone_name_id:
          type:
            - 'null'
            - integer
      type: object
    DomainOrderDetail:
      properties:
        additional_tax:
          type: number
        description:
          type: string
        had_lack:
          type: boolean
        has_inventory:
          type: boolean
        height:
          type:
            - 'null'
            - number
        id:
          type: integer
        kits:
          description: >-
            Lista de productos que componen un kit o combo. Solo se llena cuando
            el producto del item (`product_id`) es un kit. Si el producto no es
            un kit, este campo será `null`.
          example:
            - id: 1
              order_detail_id: 1
              product_id: PROD-001
              quantity: 3
              product:
                id: PROD-001
                name: Producto A del Kit
                sku: SKU-A-001
                price: 50
                picture_url: https://example.com/product-a.jpg
                business_id: BUS-123
                weight: 1.5
                width: 10
                height: 15
                large: 20
                tax: 0.19
                external_id: EXT-001
                ean: '7501234567890'
                kit_items: []
            - id: 2
              order_detail_id: 1
              product_id: PROD-002
              quantity: 1
              product:
                id: PROD-002
                name: Producto B del Kit
                sku: SKU-B-002
                price: 30
                picture_url: https://example.com/product-b.jpg
                business_id: BUS-123
                weight: 0.8
                width: 8
                height: 10
                large: 12
                tax: 0.19
                external_id: EXT-002
                ean: '7501234567891'
                kit_items: []
          items:
            $ref: '#/components/schemas/DomainOrderDetailKit'
          type:
            - 'null'
            - array
        large:
          type:
            - 'null'
            - number
        order_id:
          type: string
        price:
          type: number
        product:
          $ref: '#/components/schemas/DomainProduct'
        product_id:
          type: string
        promo_price:
          type: number
        quantity:
          type: integer
        replacement_product:
          $ref: '#/components/schemas/DomainProduct'
        replacement_product_id:
          type:
            - 'null'
            - string
        tax:
          type:
            - 'null'
            - number
        weight:
          type:
            - 'null'
            - number
        width:
          type:
            - 'null'
            - number
      type: object
    DomainOrderDetailKit:
      description: >-
        Representa un producto individual que forma parte de un kit o combo
        dentro de un item de la orden.
      example:
        id: 1
        order_detail_id: 1
        product_id: PROD-001
        quantity: 3
        product:
          id: PROD-001
          name: Producto A del Kit
          sku: SKU-A-001
          price: 50
          picture_url: https://example.com/product-a.jpg
          business_id: BUS-123
          weight: 1.5
          width: 10
          height: 15
          large: 20
          tax: 0.19
          external_id: EXT-001
          ean: '7501234567890'
          kit_items: []
      properties:
        id:
          description: ID único del registro en la tabla order_detail_kit
          example: 1
          type: integer
        order_detail_id:
          description: ID del item de la orden al que pertenece este kit
          example: 1
          type: integer
        product:
          $ref: '#/components/schemas/DomainProduct'
          description: >-
            Información completa del producto (nombre, SKU, precio, dimensiones,
            etc.)
        product_id:
          description: ID del producto que es parte del kit
          example: PROD-001
          type: string
        quantity:
          description: Cantidad de este producto incluida en el kit
          example: 3
          type: integer
      type: object
    DomainOrderHistory:
      properties:
        created_at:
          format: date-time
          type:
            - 'null'
            - string
        driver:
          $ref: '#/components/schemas/DomainDriver'
        driver_id:
          type:
            - 'null'
            - integer
        id:
          type: integer
        lat:
          type:
            - 'null'
            - number
        lng:
          type:
            - 'null'
            - number
        notes:
          type:
            - 'null'
            - string
        order:
          $ref: '#/components/schemas/DomainOrder'
        order_id:
          type: string
        order_status:
          $ref: '#/components/schemas/DomainOrderStatus'
        order_status_id:
          type: integer
        try:
          type:
            - 'null'
            - integer
        user:
          $ref: '#/components/schemas/DomainUserType2'
        user_id:
          type:
            - 'null'
            - integer
        warehouse_id:
          type:
            - 'null'
            - integer
      type: object
    DomainOrderInvoice:
      properties:
        active:
          type: boolean
        created_at:
          format: date-time
          type: string
        cufe:
          type: string
        id:
          type: integer
        invoice_number:
          type: string
        invoice_url:
          type: string
        is_credit_note:
          type: boolean
        order_id:
          type: string
      type: object
    DomainOrderNote:
      properties:
        created_at:
          format: date-time
          type: string
        id:
          type: integer
        order_id:
          type: string
        text:
          type: string
        user:
          $ref: '#/components/schemas/DomainUserType2'
        user_id:
          type:
            - 'null'
            - integer
      type: object
    DomainOrderPicture:
      properties:
        created_at:
          format: date-time
          type:
            - 'null'
            - string
        file:
          type: string
        id:
          type: integer
        note:
          type:
            - 'null'
            - string
        order_id:
          type: string
        print_documents:
          type: integer
        signature:
          type:
            - 'null'
            - integer
        type:
          type:
            - 'null'
            - string
      type: object
    DomainOrderReturnReason:
      properties:
        description:
          type:
            - 'null'
            - string
        id:
          type: integer
        name:
          type: string
        order_return_reason_id:
          type:
            - 'null'
            - integer
      type: object
    DomainOrderStatus:
      properties:
        active:
          type: integer
        available_if_status_in:
          type:
            - 'null'
            - string
        color:
          type: string
        created_at:
          format: date-time
          type:
            - 'null'
            - string
        deleted_at:
          $ref: '#/components/schemas/GormDeletedAt'
        final:
          type: boolean
        id:
          type: integer
        in_progress:
          type: boolean
        in_route:
          type: boolean
        index:
          type: integer
        name:
          type: string
        require_driver:
          type: boolean
        require_inventory_validation:
          type: boolean
        require_pictures:
          type: boolean
        require_return_reason:
          type: boolean
        required_boxes:
          type: boolean
        required_by_driver:
          type: boolean
        retry_order_enabled:
          type: boolean
        reverse_to:
          type: integer
        updated_at:
          format: date-time
          type:
            - 'null'
            - string
      type: object
    DomainOrderType:
      properties:
        active:
          type:
            - 'null'
            - integer
        automatic_schedule_selection:
          type:
            - 'null'
            - integer
        default:
          type: integer
        end_time:
          type:
            - 'null'
            - string
        expected_delivery_time:
          type:
            - 'null'
            - integer
        final_order_status_id:
          type:
            - 'null'
            - integer
        flow_until_order_status_id:
          type:
            - 'null'
            - integer
        icon:
          type:
            - 'null'
            - string
        id:
          type: integer
        initial_order_status_id:
          type:
            - 'null'
            - integer
        name:
          type: string
        start_time:
          type:
            - 'null'
            - string
      type: object
    DomainPaymentMethod:
      properties:
        active:
          type: boolean
        id:
          type: integer
        name:
          type: string
      type: object
    DomainPaymentType:
      properties:
        business_id:
          type: string
        id:
          type: integer
        name:
          type: string
      type: object
    DomainPolygon:
      items:
        items:
          type: number
        type: array
      type:
        - array
        - 'null'
    DomainPosition:
      properties:
        city:
          type: string
        name:
          type: string
        orders:
          type: integer
        position:
          $ref: '#/components/schemas/DomainLatLang'
        type_vehicle:
          type: string
      type: object
    DomainProduct:
      properties:
        height:
          type:
            - 'null'
            - number
        id:
          type: string
        large:
          type:
            - 'null'
            - number
        name:
          type: string
        picture_url:
          type:
            - 'null'
            - string
        sku:
          type: string
        tax:
          type:
            - 'null'
            - number
        weight:
          type:
            - 'null'
            - number
        width:
          type:
            - 'null'
            - number
      type: object
    DomainProductKit:
      properties:
        id:
          type: integer
        kit_product_id:
          type: string
        product:
          $ref: '#/components/schemas/DomainProductType2'
        product_id:
          type: string
        quantity:
          type: integer
      type: object
    DomainProductType2:
      properties:
        active:
          type: boolean
        business_id:
          type: string
        cost:
          type:
            - 'null'
            - number
        created_at:
          format: date-time
          type:
            - 'null'
            - string
        deleted_at:
          format: date-time
          type:
            - 'null'
            - string
        ean:
          type:
            - 'null'
            - string
        external_id:
          type:
            - 'null'
            - string
        height:
          type:
            - 'null'
            - number
        id:
          type: string
        kit:
          type: boolean
        kit_items:
          items:
            $ref: '#/components/schemas/DomainProductKit'
          type:
            - array
            - 'null'
        large:
          type:
            - 'null'
            - number
        name:
          type:
            - 'null'
            - string
        notes:
          type:
            - 'null'
            - string
        parent_product_id:
          type:
            - 'null'
            - string
        picture_url:
          type:
            - 'null'
            - string
        price:
          type:
            - 'null'
            - number
        sku:
          type:
            - 'null'
            - string
        tax:
          type:
            - 'null'
            - number
        updated_at:
          format: date-time
          type:
            - 'null'
            - string
        variations:
          items:
            $ref: '#/components/schemas/DomainProductType2'
          type:
            - array
            - 'null'
        warehouses:
          items:
            $ref: '#/components/schemas/DomainWarehouseType5'
          type:
            - array
            - 'null'
        weight:
          type:
            - 'null'
            - number
        width:
          type:
            - 'null'
            - number
      type: object
    DomainQuotationExtraData:
      properties:
        entregalo_code_branch:
          type: string
        entregalo_shipping_type:
          type: string
        entregalo_type_zone_id:
          type: integer
        estafeta_packaging_type:
          type:
            - 'null'
            - string
        merq_delivery_option:
          type:
            - 'null'
            - integer
        merq_description:
          type:
            - 'null'
            - string
        merq_package_type:
          type:
            - 'null'
            - integer
      type: object
    DomainRoute:
      properties:
        business_id:
          type: string
        center_lat:
          type: number
        center_lng:
          type: number
        created_at:
          format: date-time
          type:
            - 'null'
            - string
        drivers_count:
          type: integer
        id:
          type:
            - 'null'
            - integer
        is_optimized:
          type: boolean
        name:
          type: string
        origin_address:
          type:
            - 'null'
            - string
        origin_lat:
          type:
            - 'null'
            - number
        origin_lng:
          type:
            - 'null'
            - number
        route_center:
          type:
            - 'null'
            - string
        route_drivers:
          items:
            $ref: '#/components/schemas/DomainRouteDriver'
          type:
            - 'null'
            - array
        route_geos:
          items:
            $ref: '#/components/schemas/DomainRouteGeo'
          type:
            - 'null'
            - array
        route_stops:
          items:
            $ref: '#/components/schemas/DomainRouteStop'
          type:
            - 'null'
            - array
        status:
          type: string
        stops_count:
          type: integer
        updated_at:
          format: date-time
          type:
            - 'null'
            - string
        user_id:
          type:
            - 'null'
            - integer
        warehouse_id:
          type:
            - 'null'
            - integer
      type: object
    DomainRouteDriver:
      properties:
        created_at:
          format: date-time
          type:
            - 'null'
            - string
        driver_id:
          type:
            - 'null'
            - integer
        id:
          type:
            - 'null'
            - integer
        route_id:
          type:
            - 'null'
            - integer
        started_at:
          format: date-time
          type:
            - 'null'
            - string
      type: object
    DomainRouteGeo:
      properties:
        created_at:
          format: date-time
          type:
            - 'null'
            - string
        driver:
          $ref: '#/components/schemas/DomainDriver'
        driver_id:
          type: integer
        geo_json:
          type: string
        id:
          type:
            - 'null'
            - integer
        route_id:
          type:
            - 'null'
            - integer
      type: object
    DomainRouteStop:
      properties:
        active:
          type: boolean
        address:
          type: string
        created_at:
          format: date-time
          type:
            - 'null'
            - string
        deleted_at:
          format: date-time
          type:
            - 'null'
            - string
        driver_id:
          type: integer
        id:
          type:
            - 'null'
            - integer
        index:
          type: integer
        lat:
          type: number
        lng:
          type: number
        order_id:
          type: string
        route_id:
          type:
            - 'null'
            - integer
        updated_at:
          format: date-time
          type:
            - 'null'
            - string
      type: object
    DomainShippingInformation:
      properties:
        address:
          type: string
        address_line:
          type: string
        city:
          type: string
        city_dane:
          $ref: '#/components/schemas/CountriesCityDane'
        city_dane_id:
          type:
            - 'null'
            - integer
        country:
          type: string
        dni:
          type: string
        email:
          type: string
        full_name:
          type: string
        id:
          type: integer
        lat:
          type:
            - 'null'
            - number
        lng:
          type:
            - 'null'
            - number
        locality:
          type:
            - 'null'
            - string
        mobile_phone_number:
          type: string
        origin:
          type: integer
        state:
          type: string
        zip:
          type:
            - 'null'
            - string
      type: object
    DomainSlideCash:
      properties:
        difference:
          type: number
        total_collect:
          type: number
        total_tocollect:
          type: number
      type: object
    DomainSlidesRoute:
      properties:
        assigned:
          type: integer
        delivered:
          type: integer
        on_going:
          type: integer
        return:
          type: integer
      type: object
    DomainTypeVehicle:
      properties:
        id:
          type: integer
        name:
          type: string
        status:
          type: boolean
      type: object
    DomainTypeZone:
      properties:
        id:
          type: integer
        name:
          type: string
        price:
          type: integer
        status:
          type: boolean
      type: object
    DomainUser:
      properties:
        business_id:
          type: string
        email:
          type: string
        id:
          type: integer
        tyc_accepted_at:
          format: date-time
          type:
            - 'null'
            - string
        user_information:
          $ref: '#/components/schemas/DomainUserInformation'
        user_information_id:
          type:
            - 'null'
            - integer
      type: object
    DomainUserInformation:
      properties:
        full_name:
          type:
            - 'null'
            - string
        id:
          type:
            - 'null'
            - integer
        mobile_phone_number:
          type:
            - 'null'
            - string
      type: object
    DomainUserInformationType2:
      properties:
        full_name:
          type: string
        id:
          type: integer
        mobile_phone_number:
          type: string
      type: object
    DomainUserType2:
      properties:
        auth_assignments:
          items:
            $ref: '#/components/schemas/DomainAuthAssignment'
          type:
            - array
            - 'null'
        business:
          $ref: '#/components/schemas/DomainBusiness'
        business_id:
          type: string
        created_at:
          format: date-time
          type:
            - 'null'
            - string
        email:
          type: string
        id:
          type: integer
        is_a_business:
          type: integer
        status:
          type: integer
        super:
          type: integer
        tyc_accepted_at:
          format: date-time
          type:
            - 'null'
            - string
        updated_at:
          format: date-time
          type:
            - 'null'
            - string
        user_information:
          $ref: '#/components/schemas/DomainUserInformationType2'
        user_information_id:
          type: integer
        user_type_id:
          type: integer
        username:
          type: string
        warehouses:
          items:
            $ref: '#/components/schemas/DomainWarehouseType2'
          type:
            - array
            - 'null'
      type: object
    DomainWarehouse:
      properties:
        id:
          type: integer
        name:
          type: string
      type: object
    DomainWarehouseProduct:
      properties:
        business_id:
          type: string
        created_at:
          format: date-time
          type:
            - 'null'
            - string
        quantity:
          type: integer
        reserved_quantity:
          type: integer
        warehouse:
          $ref: '#/components/schemas/DomainWarehouseType6'
        warehouse_id:
          type: integer
      type: object
    DomainWarehouseType2:
      properties:
        address:
          type: string
        address_line:
          type: string
        allow_orders:
          type: boolean
        business_id:
          type: string
        city_dane_id:
          type:
            - 'null'
            - integer
        created_at:
          format: date-time
          type: string
        id:
          type: integer
        lat:
          type: number
        lng:
          type: number
        name:
          type: string
        updated_at:
          format: date-time
          type: string
      type: object
    DomainWarehouseType3:
      properties:
        address:
          type: string
        address_line:
          type: string
        allow_orders:
          type: boolean
        business_id:
          type: string
        city_dane_id:
          type:
            - 'null'
            - integer
        created_at:
          format: date-time
          type: string
        id:
          type: integer
        lat:
          type: number
        lng:
          type: number
        name:
          type: string
        updated_at:
          format: date-time
          type: string
      type: object
    DomainWarehouseType4:
      properties:
        address:
          type: string
        address_line:
          type: string
        allow_orders:
          type: boolean
        business_id:
          type: string
        city_dane:
          $ref: '#/components/schemas/CountriesCityDane'
        city_dane_id:
          type:
            - 'null'
            - integer
        code_branch:
          type:
            - 'null'
            - string
        created_at:
          format: date-time
          type: string
        id:
          type: integer
        lat:
          type: number
        lng:
          type: number
        name:
          type: string
        updated_at:
          format: date-time
          type: string
        zip:
          type:
            - 'null'
            - string
      type: object
    DomainWarehouseType5:
      properties:
        id:
          type: integer
        name:
          type: string
      type: object
    DomainWarehouseType6:
      properties:
        id:
          type: integer
        name:
          type: string
      type: object
    DomainWebhook:
      properties:
        business_id:
          type: string
        created_at:
          format: date-time
          type: string
        id:
          type: integer
        secret:
          type: string
        topic:
          type: string
        updated_at:
          format: date-time
          type: string
        url:
          type: string
      type: object
    DomainZoneName:
      properties:
        id:
          type: integer
        name:
          type: string
      type: object
    DomainZoneNameType2:
      properties:
        active:
          type:
            - 'null'
            - integer
        city_dane:
          $ref: '#/components/schemas/CountriesCityDane'
        city_dane_id:
          type: integer
        color:
          type:
            - 'null'
            - string
        id:
          type: integer
        latlng_points:
          $ref: '#/components/schemas/DomainPolygon'
        name:
          type: string
        polygon_id:
          type: integer
        user_id:
          type: integer
        warehouse_id:
          type: integer
      type: object
    EnviameRequestSaveWarehouseStore:
      properties:
        business_id:
          type: string
        update:
          type: boolean
        warehouse_id:
          type: integer
      type: object
    EnviameSyncStatusEnviameRequest:
      properties:
        business_id:
          type: string
        delivery_provider_ids:
          items:
            type: integer
          type:
            - array
            - 'null'
        duration:
          type: string
        end_date:
          type: string
        parent_business_id:
          type: string
        start_date:
          type: string
      type: object
    ExportsCreateExport:
      properties:
        data:
          $ref: '#/components/schemas/ReportsReport'
        format:
          enum:
            - csv
            - xlsx
          type: string
      type: object
    FiltersRaw:
      items: {}
      type:
        - array
        - 'null'
    FormDataBulkloadExampleValidateBulkLoadRequest:
      properties:
        file:
          $ref: '#/components/schemas/MultipartFileHeader'
        warehouse_id:
          type: string
      type: object
    FormDataServiceCreateBusinessRequest:
      properties:
        document_type_id:
          type: integer
        documents:
          items:
            $ref: '#/components/schemas/MultipartFileHeader'
          type: array
        email:
          type: string
        email_contact_accounting:
          type:
            - 'null'
            - string
        invoicing:
          type: boolean
        is_signed_commercial_agreement:
          examples:
            - '2021-01-01'
          type: string
        kam_user_id:
          type:
            - 'null'
            - integer
        legal_id:
          type: string
        name:
          type: string
        prefix:
          type: string
        project_channel:
          type: string
        route_validation:
          type: boolean
        sequence:
          type: integer
        sms_notification:
          type: boolean
        warehouses:
          items:
            type: integer
          type:
            - array
            - 'null'
      type: object
    FormDataServiceLoadOrdersRequest:
      properties:
        business_id:
          description: Required if the user is an operator
          type:
            - 'null'
            - string
        file:
          $ref: '#/components/schemas/MultipartFileHeader'
        warehouse_id:
          type:
            - 'null'
            - integer
      type: object
    FormDataServiceMassiveShippingValidationRequest:
      properties:
        business_id:
          type: string
        file:
          $ref: '#/components/schemas/MultipartFileHeader'
        type:
          type: string
      type: object
    FormDataServiceOrderEvidenceRequest:
      properties:
        file:
          items:
            $ref: '#/components/schemas/MultipartFileHeader'
          type: array
      type: object
    FormDataServiceOrderLabelRequest:
      properties:
        file:
          items:
            $ref: '#/components/schemas/MultipartFileHeader'
          type: array
        guide_id:
          type: string
      type: object
    FormDataServiceUpdateBusinessRequest:
      properties:
        document_type_id:
          type: integer
        documents:
          items:
            $ref: '#/components/schemas/MultipartFileHeader'
          type: array
        email:
          type: string
        email_contact_accounting:
          type:
            - 'null'
            - string
        invoicing:
          type: boolean
        is_signed_commercial_agreement:
          examples:
            - '2021-01-01'
          type: string
        kam_user_id:
          type:
            - 'null'
            - integer
        legal_id:
          type: string
        name:
          type: string
        only_last_mile:
          type: boolean
        prefix:
          type: string
        project_channel:
          type: string
        route_validation:
          type: boolean
        sequence:
          type: integer
        sms_notification:
          type: boolean
        warehouses:
          items:
            type: integer
          type:
            - array
            - 'null'
      type: object
    GormDeletedAt:
      type: object
    MensajerosUrbanosOrderMU:
      properties:
        date:
          type: string
        id_company:
          type: string
        order_id:
          type: string
        token:
          type: string
        type: {}
      type: object
    MensajerosUrbanosRequestSaveStore:
      properties:
        business_id:
          type: string
        update:
          type: boolean
        warehouse_id:
          type: integer
      type: object
    MerqFileEncoded:
      items:
        minimum: 0
        type: integer
      type:
        - array
        - 'null'
    MerqGuideStatus:
      properties:
        POD:
          $ref: '#/components/schemas/MerqFileEncoded'
        POD_B64:
          type: string
        POD_fileName:
          type: string
        date:
          type: string
        dateTime:
          type: string
        location:
          type: string
        observations:
          type: string
        statusObj:
          $ref: '#/components/schemas/MerqStatusObj'
        value:
          type: string
      type: object
    MerqStatusObj:
      properties:
        code:
          type: string
        description:
          type: string
        description_en:
          type: string
        id:
          type: integer
        long_description:
          type: string
        long_description_en:
          type: string
      type: object
    MultipartFileHeader:
      contentMediaType: application/octet-stream
      format: binary
      type: string
    PaginateResponseVelocityAppBusinessDomainBusiness:
      properties:
        items:
          items:
            $ref: '#/components/schemas/DomainBusiness'
          type:
            - array
            - 'null'
        page:
          type: integer
        size:
          type: integer
        total:
          type: integer
        total_pages:
          type: integer
      type: object
    PaginateResponseVelocityAppControlpointsDomainControlPoint:
      properties:
        items:
          items:
            $ref: '#/components/schemas/DomainControlPoint'
          type:
            - array
            - 'null'
        page:
          type: integer
        size:
          type: integer
        total:
          type: integer
        total_pages:
          type: integer
      type: object
    PaginateResponseVelocityAppControlpointsDomainControlPointEvent:
      properties:
        items:
          items:
            $ref: '#/components/schemas/DomainControlPointEvent'
          type:
            - array
            - 'null'
        page:
          type: integer
        size:
          type: integer
        total:
          type: integer
        total_pages:
          type: integer
      type: object
    PaginateResponseVelocityAppDriverDomainDriver:
      properties:
        items:
          items:
            $ref: '#/components/schemas/DomainDriver'
          type:
            - array
            - 'null'
        page:
          type: integer
        size:
          type: integer
        total:
          type: integer
        total_pages:
          type: integer
      type: object
    PaginateResponseVelocityAppMonitorLogisticDomainDetailBoardRoute:
      properties:
        items:
          items:
            $ref: '#/components/schemas/DomainDetailBoardRoute'
          type:
            - array
            - 'null'
        page:
          type: integer
        size:
          type: integer
        total:
          type: integer
        total_pages:
          type: integer
      type: object
    PaginateResponseVelocityAppOrderDomainOrder:
      properties:
        items:
          items:
            $ref: '#/components/schemas/DomainOrder'
          type:
            - array
            - 'null'
        page:
          type: integer
        size:
          type: integer
        total:
          type: integer
        total_pages:
          type: integer
      type: object
    PaginateResponseVelocityAppPolygonDomainZoneName:
      properties:
        items:
          items:
            $ref: '#/components/schemas/DomainZoneNameType2'
          type:
            - array
            - 'null'
        page:
          type: integer
        size:
          type: integer
        total:
          type: integer
        total_pages:
          type: integer
      type: object
    PaginateResponseVelocityAppProductsDomainProduct:
      properties:
        items:
          items:
            $ref: '#/components/schemas/DomainProductType2'
          type:
            - array
            - 'null'
        page:
          type: integer
        size:
          type: integer
        total:
          type: integer
        total_pages:
          type: integer
      type: object
    PaginateResponseVelocityAppRoutesDomainRoute:
      properties:
        items:
          items:
            $ref: '#/components/schemas/DomainRoute'
          type:
            - array
            - 'null'
        page:
          type: integer
        size:
          type: integer
        total:
          type: integer
        total_pages:
          type: integer
      type: object
    PaginateResponseVelocityAppUserDomainUser:
      properties:
        items:
          items:
            $ref: '#/components/schemas/DomainUserType2'
          type:
            - array
            - 'null'
        page:
          type: integer
        size:
          type: integer
        total:
          type: integer
        total_pages:
          type: integer
      type: object
    PaginateResponseVelocityAppWarehouseDomainWarehouse:
      properties:
        items:
          items:
            $ref: '#/components/schemas/DomainWarehouseType4'
          type:
            - array
            - 'null'
        page:
          type: integer
        size:
          type: integer
        total:
          type: integer
        total_pages:
          type: integer
      type: object
    PaginateResponseVelocityAppProductDomainProductType2:
      properties:
        items:
          items:
            $ref: '#/components/schemas/DomainProductType2'
          type:
            - array
            - 'null'
        page:
          type: integer
        size:
          type: integer
        total:
          type: integer
        total_pages:
          type: integer
      type: object
    PaginateResponseVelocityAppWebhookDomainWebhook:
      properties:
        items:
          items:
            $ref: '#/components/schemas/DomainWebhook'
          type:
            - array
            - 'null'
        page:
          type: integer
        size:
          type: integer
        total:
          type: integer
        total_pages:
          type: integer
      type: object
    ReportsCol:
      properties:
        title:
          type: string
        type:
          type: string
      type: object
    ReportsReport:
      properties:
        cols:
          items:
            $ref: '#/components/schemas/ReportsCol'
          type:
            - array
            - 'null'
        rows:
          items:
            items: {}
            type: array
          type:
            - array
            - 'null'
      type: object
    ServiceAddBoxesOrderRequest:
      properties:
        boxes:
          type: integer
      type: object
    ServiceAddZoneOrderRequest:
      properties:
        zone_id:
          type: integer
      type: object
    ServiceAssignDriverRequest:
      properties:
        order_ids:
          items:
            type: string
          type:
            - array
            - 'null'
      type: object
    ServiceAssignRouteResponse:
      properties:
        started:
          type: boolean
      type: object
    ServiceCancelOrderRequest:
      required:
        - cancel_order_reason_id
      properties:
        cancel_order_reason_id:
          type: integer
          description: >-
            Motivo de la cancelacion. Obligatorio.


            **Motivos de cancelacion disponibles (`cancel_order_reason_id`):**


            | id | Motivo |

            |----|--------|

            | 3 | Cliente Desiste De La Compra |

            | 4 | Pedido Mal Creado |

            | 5 | Pedido Duplicado |

            | 6 | Posible Fraude |

            | 9 | Cancelado por el cliente |

            | 10 | Cancelado por falta de stock |


            Estos son los motivos activos. Existen otros ids inactivos
            reservados para uso interno de la plataforma (pruebas, cancelaciones
            automaticas por integracion): no deben usarse desde la API. La lista
            vigente siempre se puede consultar en GET
            /orders/lists/cancel-reasons.
          example: 4
        note:
          type:
            - 'null'
            - string
          description: Nota libre, opcional. Se guarda en la orden junto al motivo.
      type: object
    ServiceConfirmLoadOrdersRequest:
      properties:
        orders:
          description: List of orders to create
          items:
            $ref: '#/components/schemas/ServiceCreateRequest'
          type:
            - array
            - 'null'
      type: object
    ServiceConfirmPasswordResetRequest:
      properties:
        password:
          type: string
        token:
          type: string
      type: object
    ServiceControlPointRequest:
      properties:
        color:
          type: string
        lat:
          type: number
        lng:
          type: number
        name:
          type: string
        radius:
          type: number
        warehouse_id:
          type: integer
      type: object
    ServiceControlUpdateRequest:
      properties:
        color:
          type: string
        lat:
          type: number
        lng:
          type: number
        name:
          type: string
        radius:
          type: number
      type: object
    ServiceCreateBusinessDeliveryProviderRequest:
      properties:
        alias:
          type: string
        config: {}
        delivery_provider_id:
          type: integer
        own_integration:
          type: boolean
      type: object
    ServiceCreateCreditNoteRequest:
      properties:
        created_by:
          type:
            - 'null'
            - integer
        invoice_id:
          type: integer
        order_id:
          type: string
        send_email:
          type:
            - 'null'
            - boolean
      type: object
    ServiceCreateDriverRequest:
      properties:
        dni:
          type: string
        full_name:
          type: string
        license_plate:
          type: string
        phone_number:
          type: string
        pin:
          type: string
        type_vehicle_id:
          type:
            - 'null'
            - integer
        warehouses:
          items:
            type: integer
          type:
            - array
            - 'null'
      type: object
    ServiceCreateInvoiceRequest:
      properties:
        automatic:
          type: boolean
        created_by:
          type:
            - 'null'
            - integer
        enqueue_nc:
          type: boolean
        order_id:
          type: string
        send_email:
          type:
            - 'null'
            - boolean
      type: object
    ServiceCreateMovementRequest:
      properties:
        business_id:
          type: string
        product_id:
          type: string
        quantity:
          type: integer
        reason:
          type:
            - 'null'
            - string
        warehouse_id:
          type: integer
      type: object
    ServiceCreateNoteRequest:
      properties:
        text:
          type: string
      type: object
    ServiceCreateProductRequest:
      properties:
        active:
          type:
            - 'null'
            - boolean
        business_id:
          type:
            - 'null'
            - string
        cost:
          type:
            - 'null'
            - number
        ean:
          type:
            - 'null'
            - string
        external_id:
          type:
            - 'null'
            - string
        height:
          type:
            - 'null'
            - number
        large:
          type:
            - 'null'
            - number
        name:
          type:
            - 'null'
            - string
        notes:
          type:
            - 'null'
            - string
        parent_product_id:
          type:
            - 'null'
            - string
        picture_url:
          type:
            - 'null'
            - string
        price:
          type:
            - 'null'
            - number
        sku:
          type:
            - 'null'
            - string
        tax:
          type:
            - 'null'
            - number
        warehouses:
          items:
            type: integer
          type:
            - array
            - 'null'
        weight:
          type:
            - 'null'
            - number
        width:
          type:
            - 'null'
            - number
      type: object
    ServiceCreateRequest:
      properties:
        business_id:
          description: Requerido si el usuario es operador
          type:
            - 'null'
            - string
        cod_total:
          description: Valor contra entrega
          type:
            - 'null'
            - number
        country_id:
          type:
            - 'null'
            - integer
        customer:
          properties:
            dni:
              type: string
            document_type_id:
              type:
                - 'null'
                - integer
            email:
              type: string
            full_name:
              type: string
            phone_number:
              type: string
          type: object
        delivery_date:
          description: Fecha de entrega en caso de que el envío sea entregado
          format: date-time
          type:
            - 'null'
            - string
        delivery_provider_id:
          description: id de la transportadora
          type:
            - 'null'
            - integer
        discount:
          description: Valor de descuento
          type:
            - 'null'
            - number
        external_order_id:
          description: Id externo si aplica
          type:
            - 'null'
            - string
        guide_id:
          description: Número de guía de la transportadora
          type:
            - 'null'
            - string
        guide_link:
          description: Link de la guía de la transportadora
          type:
            - 'null'
            - string
        integration_type_id:
          type:
            - 'null'
            - integer
        invoiceable:
          type:
            - 'null'
            - boolean
        is_last_mile:
          description: >-
            Si la orden es de last mile pasara directamente a el estado asignar
            piloto
          type:
            - 'null'
            - boolean
        items:
          description: Productos de la orden
          items:
            $ref: '#/components/schemas/ServiceProductOrderReq'
          type:
            - array
            - 'null'
        notes:
          type: string
        order_type_id:
          type:
            - 'null'
            - integer
        order_number:
          description: >-
            Número de orden personalizado. Si no se envía, se genera
            automáticamente
          type:
            - 'null'
            - string
        origin_shipping_information:
          $ref: '#/components/schemas/ServiceShippingInformation'
          description: Información de origen del envío (si aplica)
        payment_method_id:
          type:
            - 'null'
            - integer
        payment_type_id:
          type:
            - 'null'
            - integer
        shipping_information:
          $ref: '#/components/schemas/ServiceShippingInformation'
          description: destination shipping information
        subtotal:
          type:
            - 'null'
            - number
        total:
          description: Valor total de la orden
          type:
            - 'null'
            - number
        total_shipment:
          description: Valor del envío
          type:
            - 'null'
            - number
        tracking_link:
          description: Link de tracking de la transportadora
          type:
            - 'null'
            - string
        warehouse_id:
          type:
            - 'null'
            - integer
      permitir_impresion_canales_especiales:
        description: >-
          Bandera para permitir impresión de guías en canales especiales
          (MercadoLibre/Falabella). Cuando está habilitado (true), permite
          generar guías desde la app para órdenes de estos canales. IMPORTANTE:
          No se puede enviar guide_link cuando este campo es true (contradicción
          lógica). Aplica solo para órdenes creadas vía API.
        type:
          - 'null'
          - boolean
        default: false
        example: true
      boxes:
        description: Número de paquetes en la orden
        type: integer
        default: 1
        example: 1
      approved:
        description: Si la orden es aprobada o necesita confirmación
        type:
          - 'null'
          - boolean
        default: true
      external_integration_id:
        description: ID de la integración externa (opcional)
        type:
          - 'null'
          - integer
      type: object
    ServiceCreateRequest2:
      properties:
        business_id:
          description: Required if the user is an operator
          type:
            - 'null'
            - string
        cod_total:
          type: number
        customer:
          $ref: '#/components/schemas/ServiceCustomer'
        delivery_date:
          type: string
        integration_type:
          $ref: '#/components/schemas/ServiceTypeDataOrderMassive3'
        integration_type_id:
          type:
            - 'null'
            - integer
        invoiceable:
          type: boolean
        is_cod:
          type: boolean
        notes:
          type: string
        order_id:
          type: string
        order_type:
          $ref: '#/components/schemas/ServiceTypeDataOrderMassive2'
        order_type_id:
          type:
            - 'null'
            - integer
        order_number:
          description: >-
            Número de orden personalizado. Si no se envía, se genera
            automáticamente
          type:
            - 'null'
            - string
        origin_shipping_information:
          $ref: '#/components/schemas/ServiceShippingInformation'
        shipping_information:
          $ref: '#/components/schemas/ServiceShippingInformation'
          description: destination shipping information
        subtotal:
          type: number
        total:
          type: number
        total_shipment:
          type: number
        warehouse_id:
          type:
            - 'null'
            - integer
      type: object
    ServiceCreateTransactionRequest:
      properties:
        amount:
          type: number
        business_id:
          type: string
        user_id:
          type: integer
      type: object
    ServiceCreateUserRequest:
      properties:
        auth_assignments:
          items:
            type: string
          type:
            - array
            - 'null'
        email:
          type: string
        full_name:
          type: string
        mobile_phone_number:
          type: string
        password:
          type: string
        warehouses:
          items:
            type: integer
          type:
            - array
            - 'null'
      type: object
    ServiceCreateWarehouseRequest:
      properties:
        address:
          type: string
        address_line:
          type: string
        allow_orders:
          type: boolean
        city_dane_id:
          type:
            - 'null'
            - integer
        lat:
          type: number
        lng:
          type: number
        name:
          type: string
        zip:
          type:
            - 'null'
            - string
      type: object
    ServiceCreateWebhookRequest:
      properties:
        business_id:
          description: Required in case of operator
          type: string
        topic:
          description: >-
            Tópico/tema del webhook. Valores permitidos: inventory.updated,
            order.status_updated, product.updated
          type: string
          enum:
            - inventory.updated
            - order.status_updated
            - product.updated
        url:
          type: string
      type: object
    ServiceCustomer:
      properties:
        dni:
          type: string
        document_type:
          $ref: '#/components/schemas/ServiceTypeDataOrderMassive'
        document_type_id:
          type:
            - 'null'
            - integer
        email:
          type: string
        full_name:
          type: string
        phone_number:
          type: string
      type: object
    ServiceDeleteDriverRouteRequest:
      properties:
        driver_id:
          type: integer
        route_id:
          type: integer
      type: object
    ServiceDeliveryProvider:
      properties:
        business_delivery_provider_id:
          type: integer
        delivery_provider_id:
          type: integer
        is_default:
          type: boolean
        name:
          type: string
        parent_delivery_provider_id:
          type: integer
      type: object
    ServiceDetailBoardRouteResponse:
      properties:
        routers:
          $ref: >-
            #/components/schemas/PaginateResponseVelocityAppMonitorLogisticDomainDetailBoardRoute
        slides_route:
          $ref: '#/components/schemas/DomainSlidesRoute'
      type: object
    ServiceDetialRouteCashOnDeliveryResponse:
      properties:
        orders:
          items:
            $ref: '#/components/schemas/DomainDetailBoardRouteCash'
          type:
            - array
            - 'null'
        slides_cash:
          $ref: '#/components/schemas/DomainSlideCash'
      type: object
    ServiceErrorFields:
      properties:
        field:
          type: integer
        message:
          type: string
      type: object
    ServiceGenerateMassiveRequest:
      properties:
        data:
          items:
            $ref: '#/components/schemas/ServiceGenerateMassiveShippingData'
          type:
            - array
            - 'null'
        filename:
          type: string
      type: object
    ServiceGenerateMassiveShippingData:
      properties:
        boxes:
          type: integer
        estafeta_packaging_type:
          type:
            - 'null'
            - string
        merq_delivery_option:
          type:
            - 'null'
            - integer
        merq_description:
          type:
            - 'null'
            - string
        merq_package_type:
          type:
            - 'null'
            - integer
        order_id:
          type: string
      type: object
    ServiceGenerateShippingRequest:
      properties:
        business_delivery_provider_id:
          type: integer
        delivery_fee:
          type: number
        extra_data:
          $ref: '#/components/schemas/DomainQuotationExtraData'
        height:
          description: in cm
          type: integer
        large:
          description: in cm
          type: integer
        order_id:
          type: string
        quotation_id:
          type: string
        weight:
          description: in grams
          type: integer
        width:
          description: in cm
          type: integer
      type: object
    ServiceGetAmountResponse:
      properties:
        active:
          type: boolean
        amount:
          type: number
      type: object
    ServiceGetDeliveryProvidersResponse:
      properties:
        items:
          items:
            $ref: '#/components/schemas/ServiceDeliveryProvider'
          type:
            - array
            - 'null'
      type: object
    ServiceGetQuotationOutput:
      properties:
        quotations:
          items:
            $ref: '#/components/schemas/ServiceQuotationResult'
          type:
            - array
            - 'null'
      type: object
    ServiceGetQuotationRequest:
      properties:
        best_price:
          type: boolean
        business_delivery_providers:
          items:
            type: integer
          type:
            - array
            - 'null'
        extra_data:
          $ref: '#/components/schemas/DomainQuotationExtraData'
        height:
          description: in cm
          type: number
        large:
          description: in cm
          type: number
        order_id:
          type: string
        weight:
          description: in grams
          type: number
        width:
          description: in cm
          type: number
      type: object
    ServiceGetQuotationWithProductsRequest:
      properties:
        destination:
          type:
            - 'null'
            - string
        is_cod:
          type: boolean
        items:
          items:
            $ref: '#/components/schemas/ServiceQuotationItem'
          type:
            - array
            - 'null'
        origin:
          type:
            - 'null'
            - string
        total:
          type: number
      type: object
    ServiceGetStockResponse:
      properties:
        inventory:
          items:
            $ref: '#/components/schemas/DomainWarehouseProduct'
          type:
            - array
            - 'null'
        variations:
          items:
            $ref: '#/components/schemas/ServiceVariation'
          type:
            - array
            - 'null'
      type: object
    ServiceIndicatorsResponse:
      properties:
        assigned:
          type: integer
        delivered:
          type: integer
        on_going:
          type: integer
        return:
          type: integer
        routes:
          items:
            $ref: '#/components/schemas/DomainBoardRoute'
          type:
            - array
            - 'null'
      type: object
    ServiceListCityDane:
      properties:
        cities:
          items:
            $ref: '#/components/schemas/CountriesCityDane'
          type:
            - array
            - 'null'
        size:
          type: integer
      type: object
    ServiceListCustomersByDNIRequest:
      properties:
        dni:
          type: string
      type: object
    ServiceListWarehouses:
      properties:
        size:
          type: integer
        warehouses:
          items:
            $ref: '#/components/schemas/DomainWarehouseType4'
          type:
            - array
            - 'null'
      type: object
    ServiceLoginRequest:
      properties:
        email:
          type: string
        password:
          type: string
      type: object
    ServiceLoginResponse:
      properties:
        access_token:
          type: string
        data:
          $ref: '#/components/schemas/DomainAuthData'
        refresh_token:
          type: string
        user:
          $ref: '#/components/schemas/DomainUser'
      type: object
    ServiceMercadoPagoWebhookRequest:
      properties:
        action:
          type: string
        data:
          properties:
            id:
              type: string
          type: object
        type:
          type: string
      type: object
    ServiceMonitorLogisticRequest:
      properties:
        date:
          type:
            - 'null'
            - string
        warehouse_id:
          type:
            - 'null'
            - integer
      type: object
    ServiceOptimizeRouteRequest:
      properties:
        drivers:
          items:
            type: integer
          type:
            - array
            - 'null'
        orders:
          items:
            type: string
          type:
            - array
            - 'null'
        origin:
          properties:
            address:
              type: string
            lat:
              type: number
            lng:
              type: number
            warehouse_id:
              type:
                - 'null'
                - integer
          type:
            - object
            - 'null'
        route_id:
          type:
            - 'null'
            - integer
      type: object
    ServiceOptimizeRouteResponse:
      properties:
        center:
          $ref: '#/components/schemas/ClustersPoint'
        groups:
          $ref: '#/components/schemas/ClustersClusters'
        orders_with_errors:
          additionalProperties:
            type: string
          type:
            - object
            - 'null'
        shipment_route:
          $ref: '#/components/schemas/DomainRoute'
      type: object
    ServicePolygonRequest:
      properties:
        color:
          type: string
        ltnlng:
          $ref: '#/components/schemas/DomainPolygon'
        name_zone:
          type: string
        polygon_id:
          type: integer
        warehouse_id:
          type: integer
      type: object
    ServicePolygonUpdateRequest:
      properties:
        color:
          type:
            - 'null'
            - string
        ltnlng:
          $ref: '#/components/schemas/DomainPolygon'
        name:
          type: string
        polygon_id:
          type: integer
      type: object
    ServicePositionDriverRequest:
      properties:
        city_dane_id:
          type:
            - 'null'
            - string
        warehouse_id:
          type:
            - 'null'
            - integer
      type: object
    ServiceProcessedOrder:
      properties:
        errors:
          items:
            $ref: '#/components/schemas/ServiceErrorFields'
          type:
            - array
            - 'null'
        order:
          $ref: '#/components/schemas/ServiceCreateRequest2'
      type: object
    ServiceProductOrderReq:
      description: >-
        Producto de la orden, se debe enviar el product_id o el sku o el
        external_id, en caso de que el producto no exista, se creará uno nuevo
      properties:
        external_id:
          description: Id externo del producto
          type:
            - 'null'
            - string
        height:
          description: Alto del producto
          type:
            - 'null'
            - number
        large:
          description: Largo del producto
          type:
            - 'null'
            - number
        price:
          description: Precio unitario
          type: number
        product_id:
          description: >-
            Id del producto (si no se envía, se usará el SKU o external_id para
            buscar el producto)
          type:
            - 'null'
            - string
        promo_price:
          description: Valor total del descuento
          type: number
        quantity:
          description: Cantidad de productos
          type: integer
        sku:
          description: SKU del producto
          type:
            - 'null'
            - string
        tax:
          description: porcentaje de impuesto
          type:
            - 'null'
            - number
        weight:
          description: Peso del producto
          type:
            - 'null'
            - number
        width:
          description: Ancho del producto
          type:
            - 'null'
            - number
      type: object
    ServiceQuotationItem:
      properties:
        qty:
          type: integer
        sku:
          type: string
      type: object
    ServiceQuotationResult:
      properties:
        best_price:
          type: boolean
        cost_commission:
          type: number
        delivery_hours:
          type: integer
        delivery_provider:
          $ref: '#/components/schemas/ServiceDeliveryProvider'
        error:
          type:
            - 'null'
            - string
        id:
          type: string
        price:
          type: number
      type: object
    ServiceRefreshRequest:
      properties:
        refresh_token:
          type: string
      type: object
    ServiceReplaceDriverRequest:
      properties:
        new_driver_id:
          type: integer
        old_driver_id:
          type: integer
        route_id:
          type: integer
      type: object
    ServiceRequestPasswordResetRequest:
      properties:
        email:
          type: string
      type: object
    ServiceSendEmailRequest:
      properties:
        email:
          type: string
        invoice_id:
          type: integer
      type: object
    ServiceShippingInformation:
      properties:
        address:
          type: string
        address_line:
          type: string
        city:
          description: Requerido si city_dane_id no está presente
          type: string
        city_dane_id:
          type:
            - 'null'
            - integer
        country:
          description: Requerido si city_dane_id no está presente
          type: string
        lat:
          description: Si no está presente, se calculará a partir de la dirección
          type:
            - 'null'
            - number
        lng:
          description: Si no está presente, se calculará a partir de la dirección
          type:
            - 'null'
            - number
        state:
          description: Requerido si city_dane_id no está presente
          type: string
        zip:
          type:
            - 'null'
            - string
      type: object
    ServiceTypeDataOrderMassive:
      properties:
        id:
          type:
            - 'null'
            - integer
        name:
          type: string
      type: object
    ServiceTypeDataOrderMassive2:
      properties:
        id:
          type: integer
        name:
          type: string
      type: object
    ServiceTypeDataOrderMassive3:
      properties:
        id:
          type:
            - 'null'
            - integer
        name:
          type: string
      type: object
    ServiceUpdateBusinessDeliveryProviderRequest:
      properties:
        alias:
          type: string
        config: {}
      type: object
    ServiceUpdateBusinessDeliveryProviderStatusRequest:
      properties:
        active:
          type: boolean
      type: object
    ServiceUpdateBusinessStatusRequest:
      properties:
        active:
          type: boolean
      type: object
    ServiceUpdateDriverRequest:
      properties:
        dni:
          type: string
        full_name:
          type: string
        license_plate:
          type: string
        phone_number:
          type: string
        pin:
          type: string
        type_vehicle_id:
          type:
            - 'null'
            - integer
        warehouses:
          items:
            type: integer
          type:
            - array
            - 'null'
      type: object
    ServiceUpdateDriverStatusRequest:
      properties:
        active:
          type: boolean
      type: object
    ServiceUpdateOrderRequest:
      properties:
        business_id:
          description: Requerido si el usuario es operador
          type:
            - 'null'
            - string
        cod_total:
          description: Valor contra entrega
          type:
            - 'null'
            - number
        country_id:
          type:
            - 'null'
            - integer
        customer:
          properties:
            dni:
              type: string
            document_type_id:
              type:
                - 'null'
                - integer
            email:
              type: string
            full_name:
              type: string
            phone_number:
              type: string
          type: object
        delivery_date:
          description: Fecha de entrega en caso de que el envío sea entregado
          format: date-time
          type:
            - 'null'
            - string
        delivery_provider_id:
          description: id de la transportadora
          type:
            - 'null'
            - integer
        discount:
          description: Valor de descuento
          type:
            - 'null'
            - number
        external_order_id:
          description: Id externo si aplica
          type:
            - 'null'
            - string
        guide_id:
          description: Número de guía de la transportadora
          type:
            - 'null'
            - string
        guide_link:
          description: Link de la guía de la transportadora
          type:
            - 'null'
            - string
        integration_type_id:
          type:
            - 'null'
            - integer
        invoiceable:
          type:
            - 'null'
            - boolean
        is_last_mile:
          description: >-
            Si la orden es de last mile pasara directamente a el estado asignar
            piloto
          type:
            - 'null'
            - boolean
        items:
          description: Productos de la orden
          items:
            $ref: '#/components/schemas/ServiceProductOrderReq'
          type:
            - array
            - 'null'
        notes:
          type: string
        order_type_id:
          type:
            - 'null'
            - integer
        order_number:
          description: >-
            Número de orden personalizado. Si no se envía, se genera
            automáticamente
          type:
            - 'null'
            - string
        origin_shipping_information:
          $ref: '#/components/schemas/ServiceShippingInformation'
          description: Información de origen del envío (si aplica)
        payment_method_id:
          type:
            - 'null'
            - integer
        payment_type_id:
          type:
            - 'null'
            - integer
        shipping_information:
          $ref: '#/components/schemas/ServiceShippingInformation'
          description: destination shipping information
        subtotal:
          type:
            - 'null'
            - number
        total:
          description: Valor total de la orden
          type:
            - 'null'
            - number
        total_shipment:
          description: Valor del envío
          type:
            - 'null'
            - number
        tracking_link:
          description: Link de tracking de la transportadora
          type:
            - 'null'
            - string
        warehouse_id:
          type:
            - 'null'
            - integer
      type: object
    ServiceUpdateProductRequest:
      properties:
        active:
          type:
            - 'null'
            - boolean
        business_id:
          type:
            - 'null'
            - string
        cost:
          type:
            - 'null'
            - number
        ean:
          type:
            - 'null'
            - string
        external_id:
          type:
            - 'null'
            - string
        height:
          type:
            - 'null'
            - number
        large:
          type:
            - 'null'
            - number
        name:
          type:
            - 'null'
            - string
        notes:
          type:
            - 'null'
            - string
        parent_product_id:
          type:
            - 'null'
            - string
        picture_url:
          type:
            - 'null'
            - string
        price:
          type:
            - 'null'
            - number
        sku:
          type:
            - 'null'
            - string
        tax:
          type:
            - 'null'
            - number
        warehouses:
          items:
            type: integer
          type:
            - array
            - 'null'
        weight:
          type:
            - 'null'
            - number
        width:
          type:
            - 'null'
            - number
      type: object
    ServiceUpdateShippingInformationRequest:
      properties:
        lat:
          type: number
        lng:
          type: number
      type: object
    ServiceUpdateStatusOrderRequest:
      properties:
        driver_id:
          type:
            - 'null'
            - integer
        note:
          type:
            - 'null'
            - string
        order_return_reason_id:
          type:
            - 'null'
            - integer
        order_status_id:
          type: integer
      type: object
    ServiceUpdateUserRequest:
      properties:
        auth_assignments:
          items:
            type: string
          type:
            - array
            - 'null'
        email:
          type: string
        full_name:
          type: string
        mobile_phone_number:
          type: string
        password:
          type: string
        warehouses:
          items:
            type: integer
          type:
            - array
            - 'null'
      type: object
    ServiceUpdateUserStatusRequest:
      properties:
        active:
          type: boolean
      type: object
    ServiceUpdateWarehouseRequest:
      properties:
        address:
          type: string
        address_line:
          type: string
        allow_orders:
          type: boolean
        city_dane_id:
          type:
            - 'null'
            - integer
        lat:
          type: number
        lng:
          type: number
        name:
          type: string
        zip:
          type:
            - 'null'
            - string
      type: object
    ServiceVariation:
      properties:
        id:
          type: string
        inventory:
          items:
            $ref: '#/components/schemas/DomainWarehouseProduct'
          type:
            - array
            - 'null'
        name:
          type: string
        sku:
          type: string
      type: object
    V4Map:
      additionalProperties: {}
      type: object
    DomainWarehouseSummary:
      description: Resumen de la bodega consultada
      type: object
      properties:
        id:
          type: integer
          description: ID de la bodega
        name:
          type: string
          description: Nombre de la bodega
        has_layout:
          type: boolean
          description: true si la bodega tiene layout de ubicaciones activo
    DomainProductLocation:
      description: Ubicacion de un producto dentro de la bodega
      type: object
      properties:
        id:
          type:
            - 'null'
            - integer
          description: ID de la warehouse_location
        code:
          type:
            - 'null'
            - string
          description: Codigo de la ubicacion
        qty:
          type:
            - 'null'
            - integer
          description: Cantidad del producto en esta ubicacion
        is_full:
          type:
            - 'null'
            - boolean
          description: true si la ubicacion es FULL (is_fulfillment)
    DomainProductWithStock:
      description: Producto con stock y ubicaciones en la bodega
      type: object
      properties:
        id:
          type: string
          description: ID del producto
        name:
          type:
            - 'null'
            - string
          description: Nombre del producto
        sku:
          type:
            - 'null'
            - string
          description: SKU del producto
        stock:
          type: integer
          description: >-
            Cantidad disponible en la bodega. Productos sin movimiento retornan
            0.
        locations:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/DomainProductLocation'
          description: >-
            Ubicaciones del producto. Vacio si la bodega no tiene layout o el
            producto no tiene ubicaciones asignadas.
        seller:
          $ref: '#/components/schemas/DomainSellerSummary'
          description: >-
            Negocio al que pertenece el producto. En operadores con sellers,
            identifica a cual seller corresponde.
    WarehouseInventoryResponse:
      description: Respuesta del inventario de una bodega
      type: object
      properties:
        warehouse:
          $ref: '#/components/schemas/DomainWarehouseSummary'
        total:
          type: integer
          description: Total de productos en la bodega
        page:
          type: integer
          description: Pagina actual
        size:
          type: integer
          description: Items por pagina
        total_pages:
          type: integer
          description: Total de paginas
        items:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/DomainProductWithStock'
          description: Productos paginados con sus ubicaciones agrupadas
    DomainSellerSummary:
      description: Negocio seller (hijo) al que pertenece el producto
      type: object
      properties:
        id:
          type: string
          description: ID del negocio seller
        name:
          type: string
          description: Nombre del negocio seller
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Token JWT obtenido via /auth/login. Header: Authorization: Bearer
        <token>
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Velocity-Access-Token
      description: >-
        API Key provista por Velocity. Header: X-Velocity-Access-Token:
        <api_key>
