openapi: 3.0.3
info:
  title: MasLogistics API
  description: I am MasLogistics API, my intention is to provide mas logistics integrations.
  contact:
    name: MasLogistics Squad
    email: mas_logistics@masmovil.com
  version: 2.0.0
servers:
- url: https://logistics.sta.masstack.com/v2/
  description: Staging
- url: https://logistics.masstack.com/v2/
  description: Production
security:
- AuthnTokenMasLogistics: []
tags:
- name: Direct Logistics
  description: The aim of the operations is to provide information about the available
    products as well as control the process for the delivery of the goods to the end
    customer.
- name: Reverse Logistics
  description: The aim of the operations is to control the process for the return
    of products from consumption or end user points to the manufacturer or distributor
    for their recovery, repair, recycling or disposal.
- name: Swap Logistics
  description: 'The aim of the operations is to provide information about the available
    products as well as control the swap process.

    '
- name: Expeditions Logistics
  description: The aim of the operations is to provide information about expeditions
    for both  direct and reverse logistics processes. Expeditions represent the shipment
    tracking  and status of orders and pickups.
- name: External Logistic Operator
  description: The aim of the operations is to provide logistic information about
    external logistic operator orders
- name: Logistics Management
  description: Endpoints for managing logistics configurations
paths:
  /orgs/{orgId}/core/reservations/{reservation_id}:
    put:
      tags:
      - Direct Logistics
      summary: Update reservation status (Confirm/Cancel)
      description: Update reservation status (Confirm/Cancel)
      operationId: updateReservation
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: reservation_id
        in: path
        description: Internal logistics reservation id
        required: true
        schema:
          type: string
        example: 130
      requestBody:
        description: Information needed to change the status to a reservation to confirmed
          or cancelled.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReservationStatus'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/ReservationUpdateSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
      - Direct Logistics
      summary: Get a reservation
      description: Retrieve a reservation by its internal reservation ID
      operationId: getReservation
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: reservation_id
        in: path
        description: Internal reservation ID
        required: true
        schema:
          type: string
        example: '123456'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReservationDetails'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/reservations:
    post:
      tags:
      - Direct Logistics
      summary: Create a reservation
      description: Create a new reservation
      operationId: createReservation
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      requestBody:
        description: Information needed to create a new Reservation
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Reservation'
      responses:
        '200':
          $ref: '#/components/responses/ReservationSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/orders:
    post:
      tags:
      - Direct Logistics
      summary: Create an order
      description: Create an new order
      operationId: createNewOrder
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      requestBody:
        description: Information needed to create a new order
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrder'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/NewOrderSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
      - Direct Logistics
      summary: Get list of orders
      description: Get list of orders filtered by the given parameters
      operationId: getOrders
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: size
        in: query
        description: Page size
        required: true
        schema:
          type: integer
        example: 100
      - name: page
        in: query
        description: Page number
        required: true
        schema:
          type: integer
        example: 1
      - name: order_id
        in: query
        description: Order id in mas-logistics (Multiple values allowed separated
          with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: E1585NAHY276BR4
      - name: order_id_crm
        in: query
        description: Order id in crm (Multiple values allowed separated with coma
          (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: MYSIM_103827
      - name: order_id_external
        in: query
        description: Order id in the external system, usually the logistic operator
          (Multiple values allowed separated with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: MAS000001
      - name: subscription_id
        in: query
        description: Subscription id (Multiple values allowed separated with coma
          (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: '2203846'
      - name: business_process
        in: query
        description: Business process (Multiple values allowed separated with coma
          (','))
        required: false
        style: form
        explode: false
        schema:
          type: array
          items:
            $ref: '#/components/schemas/DirectBusinessProcess'
        example: PEDIDO,BREAKDOWN_DELIVERY
      - name: delivery_type
        in: query
        description: Delivery type (Multiple values allowed separated with coma (','))
        required: false
        style: form
        explode: false
        schema:
          type: array
          items:
            $ref: '#/components/schemas/DeliveryTypeEnum'
        example: HOME,SHOP
      - name: identity_document_id
        in: query
        description: Client identity document id (Multiple values allowed separated
          with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: 12345678Z
      - name: product_identifier
        in: query
        description: Product identifier like IMEI, ICCID, Serial Number, etc (Multiple
          values allowed separated with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: RM58AV3N2
      - name: product_code
        in: query
        description: The product reference (Multiple values allowed separated with
          coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: P0000001
      - name: product_subscription_device_id
        in: query
        description: Product subscription device id (Multiple values allowed separated
          with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: '1123456789'
      - name: from_order_date
        in: query
        description: 'From order date in ISO 8601 format. Example: 2021-05-24T09:00:00Z'
        required: false
        schema:
          type: string
          format: date-time
        example: '2021-05-24T09:00:00Z'
      - name: to_order_date
        in: query
        description: 'To order date in ISO 8601 format. Example: 2021-05-24T09:00:00Z'
        required: false
        schema:
          type: string
          format: date-time
        example: '2021-05-25T09:00:00Z'
      - name: sort
        in: query
        description: Sort value
        required: false
        schema:
          type: string
          enum:
          - DATE_DESC
          - DATE_ASC
        example: DATE_DESC
      responses:
        '200':
          $ref: '#/components/responses/GetOrderSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/orders/{order_id}:
    get:
      tags:
      - Direct Logistics
      summary: Get an order by id
      description: Get an order by the order_id
      operationId: getOrder
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: order_id
        in: path
        description: Internal logistics order id
        required: true
        schema:
          type: string
        example: 888888-A9293
      responses:
        '200':
          $ref: '#/components/responses/GetOrderByIdSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/orders/{order_id}/products:
    get:
      tags:
      - Direct Logistics
      summary: Get the list of products for an order
      description: Get the list of products for an order
      operationId: getOrderProducts
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: order_id
        in: path
        description: Internal logistics order id
        required: true
        schema:
          type: string
        example: 888888-A9293
      - name: size
        in: query
        description: Page size
        required: true
        schema:
          type: integer
        example: 100
      - name: page
        in: query
        description: Page number
        required: true
        schema:
          type: integer
        example: 1
      responses:
        '200':
          $ref: '#/components/responses/GetOrderProductsSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/orders/{order_id}/products/{product_id}:
    get:
      tags:
      - Direct Logistics
      summary: Get a product for an order
      description: Get a product for an order
      operationId: getOrderProduct
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: order_id
        in: path
        description: Internal logistics order id
        required: true
        schema:
          type: string
        example: 888888-A9293
      - name: product_id
        in: path
        description: Product id, usually subscription_device_id
        required: true
        schema:
          type: string
        example: 888888-A9293
      responses:
        '200':
          $ref: '#/components/responses/GetOrderProductSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/orders/{order_id}/documents:
    get:
      tags:
      - Direct Logistics
      summary: Get the documents list for an order
      description: Get the documents list for an order
      operationId: getOrderDocuments
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: order_id
        in: path
        description: Internal logistics order id
        required: true
        schema:
          type: string
        example: d290f1ee-6c54-4b01-90e6-d701748f0851
      - name: size
        in: query
        description: Page size
        required: true
        schema:
          type: integer
        example: 100
      - name: page
        in: query
        description: Page number
        required: true
        schema:
          type: integer
        example: 1
      responses:
        '200':
          $ref: '#/components/responses/GetOrderDocumentsSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/orders/{order_id}/documents/{document_id}:
    get:
      tags:
      - Direct Logistics
      summary: Get a document for an order
      description: Get a document for an order
      operationId: getOrderDocument
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: order_id
        in: path
        description: Internal logistics order id
        required: true
        schema:
          type: string
        example: d290f1ee-6c54-4b01-90e6-d701748f0851
      - name: document_id
        in: path
        description: The public document id managed by mas-logistics
        required: true
        schema:
          type: string
        example: d290f1ee-6c54-4b01-90e6-d701748f0851
      responses:
        '200':
          $ref: '#/components/responses/GetOrderDocumentSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/orders/{order_id}/communications:
    get:
      tags:
      - Direct Logistics
      summary: Get list of communications sent for an order
      description: Get list of communications sent for an order
      operationId: getOrderCommunications
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: order_id
        in: path
        description: Internal logistics order id
        required: true
        schema:
          type: string
        example: d290f1ee-6c54-4b01-90e6-d701748f0851
      - name: size
        in: query
        description: Page size
        required: true
        schema:
          type: integer
        example: 100
      - name: page
        in: query
        description: Page number
        required: true
        schema:
          type: integer
        example: 1
      responses:
        '200':
          $ref: '#/components/responses/GetOrderCommunicationsSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/orders/documents/sign:
    post:
      tags:
      - Direct Logistics
      summary: Sign documents related to a set of orders
      description: Sign the signeable documents related to a set of orders
      operationId: signOrderDocuments
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      requestBody:
        description: Information needed to sign the documents
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SignDocumentsRequest'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/SingDocumentsSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/orders/{order_id}/cancellation:
    post:
      tags:
      - Direct Logistics
      summary: Create a request to cancel an order
      description: Create a request to cancel an order. Its request could be accepted
        or declined asynchronously
      operationId: cancelOrder
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: order_id
        in: path
        description: Internal logistics order id
        required: true
        schema:
          type: string
        example: 888888-A9293
      requestBody:
        description: Information needed to create a cancellation request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancellationRequest'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/NewCancellationRequestSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/orders/{order_id}/confirmDelivery:
    post:
      tags:
      - Direct Logistics
      summary: Notify order delivery confirmation
      description: Notify delivery confirmation for an order
      operationId: confirmOrderDelivery
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: order_id
        in: path
        description: Internal logistics order id
        required: true
        schema:
          type: string
        example: 888888-A9293
      requestBody:
        description: Information needed to create a delivery confirmation request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeliveryConfirmationRequest'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/ConfirmDeliverySuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/stock:
    get:
      tags:
      - Direct Logistics
      summary: Get stock
      description: Get the stock provided by the logistics operators
      operationId: getStockOnline
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: salesChannel
        in: query
        description: Sales channel identifier
        required: false
        schema:
          $ref: '#/components/schemas/DataSalesChannelEnum'
      - name: salesType
        in: query
        description: Sales Type identifier
        required: false
        schema:
          $ref: '#/components/schemas/DataSalesTypeEnum'
      - name: productId
        in: query
        description: Product identifier
        required: false
        schema:
          type: string
      responses:
        '200':
          $ref: '#/components/responses/StockSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/pickups:
    post:
      tags:
      - Reverse Logistics
      summary: Create a pickup
      description: Create a new pickup
      operationId: createNewPickup
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      requestBody:
        description: Information needed to create a new Order
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Pickup'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/NewPickupSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
      - Reverse Logistics
      summary: Get list of pickups
      description: Get list of pickups filtered by the given parameters
      operationId: getPickups
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: size
        in: query
        description: Page size
        required: true
        schema:
          type: integer
        example: 100
      - name: page
        in: query
        description: Page number
        required: true
        schema:
          type: integer
        example: 1
      - name: pickup_id
        in: query
        description: Pickup id in mas-logistics (Multiple values allowed separated
          with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: R1585NAHY276BR4
      - name: order_id_crm
        in: query
        description: Order id in crm (Multiple values allowed separated with coma
          (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: MYSIM_103827
      - name: order_id_external
        in: query
        description: Order id in the external system, usually the logistic operator
          (Multiple values allowed separated with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: MAS000001
      - name: subscription_id
        in: query
        description: Subscription id (Multiple values allowed separated with coma
          (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: '2203846'
      - name: business_process
        in: query
        description: Business process (Multiple values allowed separated with coma
          (','))
        required: false
        style: form
        explode: false
        schema:
          type: array
          items:
            $ref: '#/components/schemas/ReverseBusinessProcess'
        example: UNSUBSCRIPTION
      - name: delivery_type
        in: query
        description: Delivery type (Multiple values allowed separated with coma (','))
        required: false
        style: form
        explode: false
        schema:
          type: array
          items:
            $ref: '#/components/schemas/DeliveryTypeEnum'
      - name: identity_document_id
        in: query
        description: Client identity document id (Multiple values allowed separated
          with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: 12345678Z
      - name: product_identifier
        in: query
        description: Product identifier like IMEI, ICCID, Serial Number, etc (Multiple
          values allowed separated with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: RM58AV3N2
      - name: product_code
        in: query
        description: The product reference (Multiple values allowed separated with
          coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: P0000001
      - name: product_subscription_device_id
        in: query
        description: Product subscription device id (Multiple values allowed separated
          with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: '1123456789'
      - name: from_order_date
        in: query
        description: 'From order date in ISO 8601 format. Example: 2021-05-24T09:00:00Z'
        required: false
        schema:
          type: string
          format: date-time
        example: '2021-05-24T09:00:00Z'
      - name: to_order_date
        in: query
        description: 'To order date in ISO 8601 format. Example: 2021-05-24T09:00:00Z'
        required: false
        schema:
          type: string
          format: date-time
        example: '2021-05-25T09:00:00Z'
      - name: sort
        in: query
        description: Sort value, multiple values allowed, separate with coma
        required: false
        schema:
          type: string
          enum:
          - DATE_DESC
          - DATE_ASC
      responses:
        '200':
          $ref: '#/components/responses/GetPickupsSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/pickups/{pickup_id}:
    get:
      tags:
      - Reverse Logistics
      summary: Get a pickup by id
      description: Get a pickup by the pickup_id
      operationId: getPickup
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: pickup_id
        in: path
        description: Internal logistics pickup id
        required: true
        schema:
          type: string
        example: 888888-A9293
      responses:
        '200':
          $ref: '#/components/responses/NewPickupSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/pickups/{pickup_id}/cancellation:
    post:
      tags:
      - Reverse Logistics
      summary: Create a request to cancel a pickup
      description: Create a request to cancel an pickup. Its request could be accepted
        or declined asynchronously
      operationId: cancelPickup
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: pickup_id
        in: path
        description: Internal logistics pickup id
        required: true
        schema:
          type: string
        example: R010000001
      requestBody:
        description: Information needed to create a  cancellation request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReverseCancellationRequest'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/ReverseNewCancellationRequestSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/pickups/{pickup_id}/products:
    get:
      tags:
      - Reverse Logistics
      summary: Get the list of products for a pickup
      description: Get the list of products for a pickup
      operationId: getPickupProducts
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: pickup_id
        in: path
        description: Internal logistics pickup id
        required: true
        schema:
          type: string
        example: 888888-A9293
      - name: size
        in: query
        description: Page size
        required: true
        schema:
          type: integer
        example: 100
      - name: page
        in: query
        description: Page number
        required: true
        schema:
          type: integer
        example: 1
      responses:
        '200':
          $ref: '#/components/responses/GetPickupProductsSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/pickups/{pickup_id}/products/{product_id}:
    get:
      tags:
      - Reverse Logistics
      summary: Get a product for a pickup
      description: Get a product for a pickup
      operationId: getPickupProduct
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: pickup_id
        in: path
        description: Internal logistics pickup id
        required: true
        schema:
          type: string
        example: 888888-A9293
      - name: product_id
        in: path
        description: Product id, usually subscription_device_id
        required: true
        schema:
          type: string
        example: 888888-A9293
      responses:
        '200':
          $ref: '#/components/responses/GetPickupProductSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/pickups/{pickup_id}/unblock:
    post:
      tags:
      - Reverse Logistics
      summary: Unblock a blocked pickup
      description: Unblocks a previously blocked pickup and forwards it to the logistics
        operator if any products are in CREATED acceptance status
      operationId: unblockPickup
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: pickup_id
        in: path
        description: Internal logistics pickup id
        required: true
        schema:
          type: string
        example: 888888-A9293
      responses:
        '200':
          $ref: '#/components/responses/NewPickupSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/pickups/{pickup_id}/communications:
    get:
      tags:
      - Reverse Logistics
      summary: Get list of communications sent for a pickup
      description: Get list of communications sent for a pickup
      operationId: getPickupCommunications
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: pickup_id
        in: path
        description: Internal logistics pickup id
        required: true
        schema:
          type: string
        example: 888888-A9293
      - name: size
        in: query
        description: Page size
        required: true
        schema:
          type: integer
        example: 100
      - name: page
        in: query
        description: Page number
        required: true
        schema:
          type: integer
        example: 1
      responses:
        '200':
          $ref: '#/components/responses/GetPickupCommunicationsSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/swaps:
    post:
      tags:
      - Swap Logistics
      summary: Create a swap
      description: Create a new swap
      operationId: createNewSwap
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      requestBody:
        description: Information needed to create a new Order
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSwap'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/NewSwapSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
      - Swap Logistics
      summary: Get list of swaps
      description: Get list of swaps filtered by the given parameters
      operationId: getSwaps
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: size
        in: query
        description: Page size
        required: true
        schema:
          type: integer
        example: 100
      - name: page
        in: query
        description: Page number
        required: true
        schema:
          type: integer
        example: 1
      - name: swap_id
        in: query
        description: Swap id in mas-logistics domain (Multiple values allowed separated
          with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: S1585NAHY276BR4
      - name: swap_id_crm
        in: query
        description: Swap id in crm (Multiple values allowed separated with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: MYSIM_103827
      - name: order_id
        in: query
        description: Order id in mas-logistics (Multiple values allowed separated
          with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: E0185NAHY276BR4
      - name: pickup_id
        in: query
        description: Pickup id in mas-logistics (Multiple values allowed separated
          with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: P0185NAHY276BR4
      - name: business_process
        in: query
        description: Business process (Multiple values allowed separated with coma
          (','))
        required: false
        style: form
        explode: false
        schema:
          type: array
          items:
            $ref: '#/components/schemas/SwapBusinessProcess'
        example: SWAP
      - name: subscription_id
        in: query
        description: Subscription id (Multiple values allowed separated with coma
          (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: '2203846'
      - name: identity_document_id
        in: query
        description: Client identity document id (Multiple values allowed separated
          with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: 12345678Z
      - name: product_identifier
        in: query
        description: Product identifier like IMEI, ICCID, Serial Number, etc (Multiple
          values allowed separated with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: RM58AV3N2
      - name: product_code
        in: query
        description: The product reference (Multiple values allowed separated with
          coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: P0000001
      - name: product_subscription_device_id
        in: query
        description: Product subscription device id (Multiple values allowed separated
          with coma (','))
        required: false
        schema:
          type: array
          items:
            type: string
        example: '1123456789'
      - name: from_swap_date
        in: query
        description: 'From swap date in ISO 8601 format. Example: 2021-05-24T09:00:00Z'
        required: false
        schema:
          type: string
          format: date-time
        example: '2021-05-24T09:00:00Z'
      - name: to_swap_date
        in: query
        description: 'To swap date in ISO 8601 format. Example: 2021-05-24T09:00:00Z'
        required: false
        schema:
          type: string
          format: date-time
        example: '2021-05-25T09:00:00Z'
      - name: sort
        in: query
        description: Sort value, multiple values allowed, separate with coma
        required: false
        schema:
          type: string
          enum:
          - DATE_DESC
          - DATE_ASC
      responses:
        '200':
          $ref: '#/components/responses/GetSwaps'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/swaps/{swap_id}:
    get:
      tags:
      - Swap Logistics
      summary: Get a swap by id
      description: Get a swap by swap_id
      operationId: getSwap
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: swap_id
        in: path
        description: Internal logistics swap id
        required: true
        schema:
          type: string
        example: S01ABC123DEF456G
      responses:
        '200':
          $ref: '#/components/responses/GetSwapById'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/swaps/{swap_id}/products:
    get:
      tags:
      - Swap Logistics
      summary: Get the list of products for a swap
      description: Get the list of products for a swap
      operationId: getSwapProducts
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: swap_id
        in: path
        description: Internal logistics swap id
        required: true
        schema:
          type: string
        example: S01ABC123DEF456G
      - name: size
        in: query
        description: Page size
        required: true
        schema:
          type: integer
        example: 100
      - name: page
        in: query
        description: Page number
        required: true
        schema:
          type: integer
        example: 1
      responses:
        '200':
          $ref: '#/components/responses/GetSwapProducts'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/swaps/{swap_id}/products/{product_id}:
    get:
      tags:
      - Swap Logistics
      summary: Get a product for a swap
      description: Get a product for a swap
      operationId: getSwapProduct
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: swap_id
        in: path
        description: Internal logistics swap id
        required: true
        schema:
          type: string
        example: S01ABC123DEF456G
      - name: product_id
        in: path
        description: Product id, usually subscription_device_id
        required: true
        schema:
          type: string
        example: 1234567890
      responses:
        '200':
          $ref: '#/components/responses/GetSwapProductById'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/expeditions:
    get:
      tags:
      - Expeditions Logistics
      summary: Get list of expeditions
      description: Get list of expeditions filtered by the given parameters
      operationId: getOrderExpeditions
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: size
        in: query
        description: Page size
        required: true
        schema:
          type: integer
        example: 100
      - name: page
        in: query
        description: Page number
        required: true
        schema:
          type: integer
        example: 1
      - name: sort
        in: query
        description: Sort value, multiple values allowed, separte with coma
        required: false
        schema:
          type: string
          enum:
          - DATE_DESC
          - DATE_ASC
      - name: from
        in: query
        description: Date from (min) the creation of the expedition in ISO 8601 format
          and UTC
        required: false
        schema:
          type: string
          format: date-time
          description: Date in ISO 8601 format and UTC
          example: '2021-03-24T13:31:16.425Z'
      - name: to
        in: query
        description: Date to (max) the creation of the expedition in ISO 8601 format
          and UTC
        required: false
        schema:
          type: string
          format: date-time
          description: Date in ISO 8601 format and UTC
          example: '2021-03-24T13:31:16.425Z'
      - name: order_id
        in: query
        description: Filter expeditions by order ID. Returns expeditions that contain
          at least one product from this order, including ALL products in those expeditions.
        required: false
        schema:
          type: string
        example: order-12345
      responses:
        '200':
          $ref: '#/components/responses/GetExpeditionsSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/core/expeditions/{expedition_id}:
    get:
      tags:
      - Expeditions Logistics
      summary: Get an expedition  by id
      description: Get an expedition by the expedition_id
      operationId: getExpedition
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: expedition_id
        in: path
        description: Internal logistics expedition id
        required: true
        schema:
          type: string
        example: a13a4674f6547447ff1f8813f33b5a90f6616ec2514e3f6e162acc5b88e9cfcb-R0
      responses:
        '200':
          $ref: '#/components/responses/GetExpeditionSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/external/status:
    post:
      tags:
      - External Logistic Operator
      summary: Notify an order status
      description: Notify a new order status to MasLogistics from an external logistic
        operator
      operationId: notifyStatus
      security:
      - AuthnTokenMasLogistics: []
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      requestBody:
        description: Information needed to send a status order update
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExternalOrder'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/Success'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/external/devices:
    post:
      tags:
      - External Logistic Operator
      summary: Notify a device picking
      description: Notify a device picking to MasLogistics from an external logistic
        operator
      operationId: notifyDevice
      security:
      - AuthnTokenMasLogistics: []
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      requestBody:
        description: Information needed to send a device
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PickingDevice'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/Success'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/management/obsolescence:
    post:
      tags:
      - Logistics Management
      summary: Create a new obsolescence
      description: Create a new obsolescence record
      operationId: createObsolescence
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Obsolescence'
      responses:
        '201':
          description: Obsolescence record created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Obsolescence'
    get:
      tags:
      - Logistics Management
      summary: Get a list of obsolescence
      description: Get list of obsolescence records for an organization with pagination
        support
      operationId: getObsolescences
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: size
        in: query
        description: Page size
        required: true
        schema:
          type: integer
        example: 100
      - name: page
        in: query
        description: Page number
        required: true
        schema:
          type: integer
        example: 1
      responses:
        '200':
          $ref: '#/components/responses/GetObsolescencesSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/management/obsolescence/{reference}:
    get:
      tags:
      - Logistics Management
      summary: Get an obsolescence by reference
      description: Get an obsolescence record by reference
      operationId: getObsolescenceByReference
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: reference
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Obsolescence record found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Obsolescence'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
    put:
      tags:
      - Logistics Management
      summary: Update an obsolescence
      description: Update an obsolescence record by reference
      operationId: updateObsolescence
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: reference
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Obsolescence'
      responses:
        '200':
          description: Obsolescence record updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Obsolescence'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
    delete:
      tags:
      - Logistics Management
      summary: Delete an obsolescence
      description: Delete an obsolescence record and return a confirmation message
      operationId: deleteObsolescence
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: reference
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Obsolescence record deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteResponse'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/management/communications:
    post:
      tags:
      - Logistics Management
      summary: Create a new communication configuration
      description: Create a new communication configuration with associated trigger
        states
      operationId: createCommunication
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Communication'
      responses:
        '201':
          description: Communication configuration created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Communication'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
      - Logistics Management
      summary: Get list of communication configurations
      description: Get a list of communication configurations for an organization
        with pagination support
      operationId: getCommunications
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: size
        in: query
        description: Page size
        required: true
        schema:
          type: integer
        example: 100
      - name: page
        in: query
        description: Page number
        required: true
        schema:
          type: integer
        example: 1
      - name: uuidStatus
        in: query
        description: Filter by trigger uuidStatus
        required: false
        schema:
          type: string
      - name: deliveryType
        in: query
        description: Filter by trigger deliveryType
        required: false
        schema:
          $ref: '#/components/schemas/DeliveryTypeEnum'
      - name: documentationOnly
        in: query
        description: Filter by documentationOnly flag
        required: false
        schema:
          type: boolean
      responses:
        '200':
          $ref: '#/components/responses/GetCommunicationsSuccess'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
  /orgs/{orgId}/management/communications/{communicationId}:
    get:
      tags:
      - Logistics Management
      summary: Get a communication configuration by id
      description: Get a complete communication configuration including triggers by
        communication id
      operationId: getCommunicationById
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: communicationId
        in: path
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: Communication configuration found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Communication'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
    put:
      tags:
      - Logistics Management
      summary: Update a communication configuration
      description: Update an existing communication configuration and its triggers
      operationId: updateCommunication
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: communicationId
        in: path
        required: true
        schema:
          type: integer
          format: int64
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Communication'
      responses:
        '200':
          description: Communication configuration updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Communication'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
    delete:
      tags:
      - Logistics Management
      summary: Delete a communication configuration by id
      description: Delete a communication configuration and return a confirmation
        message
      operationId: deleteCommunication
      parameters:
      - name: orgId
        in: path
        description: Organization name as it is registered in mas-stack
        required: true
        schema:
          type: string
        example: yoigo
      - name: communicationId
        in: path
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: Communication configuration deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteResponse'
        4XX:
          $ref: '#/components/responses/BadRequest'
        5XX:
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    Client:
      type: object
      description: Object with client data
      required:
      - identity
      - contact_phone
      properties:
        identity:
          $ref: '#/components/schemas/Identity'
        contact_phone:
          $ref: '#/components/schemas/Phone'
        name:
          type: string
          description: Client name
          example: Juan
        surnames:
          type: array
          description: Client surnames
          items:
            type: string
            example: Perez
        email:
          type: string
          description: Client email
          example: example@gmail.com
        commercial_name:
          type: string
          description: Client commercial name
          example: Pedro
        address:
          $ref: '#/components/schemas/Address'
    Identity:
      type: object
      description: Object representing the identity of a client
      required:
      - document_id
      - document_type
      properties:
        document_id:
          type: string
          description: Document Id
          example: 00000000A
        document_type:
          type: string
          description: Document Type
          example: NIF
          enum:
          - NIF
          - CIF
          - NIE
          - PASSPORT
    Phone:
      type: object
      description: Phone object with prefix and phone number
      properties:
        phone_number:
          type: string
          description: Phone Number
          example: '666666666'
        prefix:
          type: string
          description: Phone prefix
          example: '+34'
    Address:
      type: object
      description: Address object with street, number, city, zip code, province and
        country
      required:
      - street
      - zip_code
      - city
      - province
      - country
      properties:
        street_type:
          type: string
          minLength: 0
          maxLength: 200
          description: Street type
          example: Calle
        street:
          type: string
          minLength: 2
          maxLength: 200
          pattern: (?:.*[A-Za-zÀ-ú]){2}
          description: Street name
          example: Mayor
        number:
          type: string
          minLength: 0
          maxLength: 200
          description: Building number
          example: '208'
        additional_details:
          type: string
          minLength: 0
          maxLength: 200
          description: Other address parameters
        city:
          type: string
          minLength: 2
          maxLength: 200
          pattern: (?:.*[A-Za-zÀ-ú\d]){2}
          description: City
          example: Leganes
        zip_code:
          type: string
          minLength: 5
          maxLength: 5
          pattern: '[\d]{5}'
          description: Postal code
          example: '28912'
        province:
          type: string
          minLength: 4
          maxLength: 200
          pattern: (?:.*[A-Za-zÀ-ú\d]){4}
          description: Province
          example: Madrid
        country:
          type: string
          minLength: 0
          maxLength: 2
          description: Country
          example: es
        bis:
          type: string
          description: Bis
        floor:
          type: string
          description: Floor
        block:
          type: string
          description: Block
        stair:
          type: string
          description: Stair
        letter:
          type: string
          description: Letter
    Status:
      type: object
      description: Info about the status of the expedition
      properties:
        id:
          type: string
          description: status id
          example: '1'
        value:
          $ref: '#/components/schemas/StatusValue'
        description:
          type: string
          description: status description
          example: Order delivered to the client
        final:
          type: boolean
          description: Indicates if the status is a final state of an expedition
          example: false
        reshippable:
          type: boolean
          description: Indicates if the status is reshippable in a new expedition,
            but not in this one
          example: false
        reason_code:
          type: string
          description: reason for the status, if needed
          nullable: true
          example: ''
        reason_description:
          type: string
          description: reason description, if needed
          nullable: true
          example: ''
        timestamp:
          type: string
          description: status date
          example: '2023-05-02 11:00:09'
    Product:
      type: object
      description: Info about the product
      required:
      - product_code
      - subscription_device_id
      properties:
        product_id:
          type: string
          readOnly: true
          description: The product id in mas-logistics domain, usually suscription_device_id.
            (Read only parameter, only for GET requests)
          example: '40397'
        product_code:
          type: string
          description: Product code
          example: RM58AV3N2
        product_description:
          type: string
          description: Product description
          example: Caja de voz Ad Hoc v3
        product_type:
          type: string
          description: The product type. It is mandatory when using generic product_code
          enum:
          - STB
          - TERMINAL
          - ROUTER
          - SIM
          - GENERIC
          - SMART_TV
          - SMARTHOME
          example: ROUTER
        product_type_id:
          type: integer
          description: Product Type Id
          example: 16
        product_unit_price:
          type: number
          description: Product Unit price
          example: 16.5
        icc_imei:
          type: string
          writeOnly: true
          description: Product imei
        identifier:
          type: string
          readOnly: true
          description: The physical product identifier, usually SerialNumber/MAC/IMEI.
            (Read only parameter, only for GET requests)
        quantity:
          type: integer
          writeOnly: true
          description: Product quantity
          example: 1
        product_comments:
          type: string
          description: Product comments
        msisdn:
          type: string
          pattern: ^\d{9}
          description: MSISDN associated
          example: '666666666'
        financed:
          type: boolean
          description: Is product financed
          example: true
        subscription_device_id:
          type: string
          description: Identifier of an internal order in mas stack
          example: '40397'
        remaining_payment:
          type: number
          description: Remaining payment amount to pay on delivery
          maximum: 999.99
          example: 20.5
        invoiced:
          type: boolean
          default: true
          description: If this value is false it indicates that the product is on
            lease if it is true it is on sale and we should have the data_invoice
            info.
          example: true
        status:
          $ref: '#/components/schemas/AcceptanceStatus'
    ProductWithExpedition:
      allOf:
      - $ref: '#/components/schemas/Product'
      - type: object
        properties:
          associated_expedition:
            type: object
            description: Associated expedition info
            readOnly: true
            properties:
              expedition_id:
                type: string
                description: Unique expedition identifier
                example: a13a4674f6547447ff1f8813f33b5a90f6616ec2514e3f6e162acc5b88e9cfcb-R0
              current_status:
                $ref: '#/components/schemas/Status'
    ProductBasic:
      type: object
      description: Info about the product
      required:
      - product_code
      - subscription_device_id
      properties:
        product_code:
          type: string
          description: Product code
          example: RM58AV3N2
        product_description:
          type: string
          description: Product description
          example: Caja de voz Ad Hoc v3
        product_type:
          type: string
          description: Product Type
          enum:
          - STB
          - TERMINAL
          - ROUTER
          - SIM
          - GENERIC
          - SMART_TV
          - SMARTHOME
          example: STB
        product_type_id:
          type: integer
          description: Product Type Id
          example: 16
        identifier:
          type: string
          description: Product imei/serial number. Mandatory for all the process types,
            except for routers unsubscription.
          example: '822339400182'
        msisdn:
          type: string
          pattern: ^\d{9}
          description: MSISDN associated
          example: '666666666'
        subscription_device_id:
          type: string
          description: Subscription device Id
          example: '40397'
    Pagination:
      type: object
      description: Pagination information
      properties:
        page_size:
          type: integer
          example: 123
          description: Page size
        total_pages:
          type: integer
          example: 10
          description: Total pages for page size
        current_page:
          type: integer
          example: 1
          description: Current page
        total_elements:
          type: integer
          example: 3000
          description: Total element
    ArrayOfProductWithExpedition:
      allOf:
      - $ref: '#/components/schemas/Pagination'
      - type: object
        description: List of products with expeditions
        properties:
          products:
            type: array
            description: Info about the product with the expedition
            items:
              $ref: '#/components/schemas/ProductWithExpedition'
    Errors:
      type: array
      description: 'I am MasLogistics API, my intention is to provide mas logistics
        integrations.


        ## Error handling


        All errors returned by MasLogistics API follow a common structure and include

        an internal error code, a title and a detailed message.


        ### MasLogistics Error Dictionary


        | Code        | Title                        | Description |

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

        | MLOG_0001   | OUT_OF_STOCK                 | Out of stock |

        | MLOG_0002   | UNCONTROLLED                 | Uncontrolled error |

        | MLOG_0003   | MISSING_MANDATORY_FIELDS     | Missing mandatory fields |

        | MLOG_0004   | THIRD_PARTY_ERROR            | Third party error |

        | MLOG_0005   | VALUE_NOT_VALID              | Value not valid |

        | MLOG_0006   | PRODUCT_NOT_EXIST            | Product not exists |

        | MLOG_0007   | DUPLICATE_UNIQUE_KEY         | Duplicate unique key |

        | MLOG_0008   | RESERVATION_INVALID          | Reservation invalid |

        | MLOG_0009   | TRANSITION_NOT_VALID         | The current status does not
        allow the transition |

        | MLOG_0010   | VALIDATION_FIELDS            | Field not valid |

        | MLOG_0011   | ORDER_NOT_FOUND              | Order not found |

        | MLOG_0012   | RESERVATION_EXPIRED          | Reservation already cancelled
        due to expiration time |

        | MLOG_0013   | PICKING_ALREADY_CONFIRMED    | The picking has already confirmed
        |

        | MLOG_0014   | DEVICE_NOT_VALID             | The device is not valid |

        | MLOG_0015   | ORDER_STATUS_NOT_VALID       | Order status not valid |

        | MLOG_0016   | UNSUBSCRIBE_ALREADY_EXISTS   | Unsuscribe already exists |

        | MLOG_0017   | SERIAL_NUMBER_NOT_EXISTS     | SerialNumber not exists |

        | MLOG_0018   | VALIDATION_FIELDS_SIZE       | Field size not valid |

        | MLOG_0019   | VALIDATION_FIELDS_FORMAT     | Field format not valid |

        | MLOG_0020   | BAD_REQUEST                  | Bad request |

        | MLOG_0999   | THIRD_PARTY_UNKNOWN_ERROR    | Internal error |


        ### Validation errors


        - **MLOG_0010**: Field not valid

        - **MLOG_0018**: Size constraints (minLength / maxLength)

        - **MLOG_0019**: Format constraints (pattern)

        - **MLOG_0020**: Bad request

        '
      items:
        $ref: '#/components/schemas/Error'
      example:
      - code: MLOG_0001
        title: OUT_OF_STOCK
        details: Out of stock
      - code: MLOG_0003
        title: MISSING_MANDATORY_FIELDS
        details: Missing mandatory fields
      - code: MLOG_0008
        title: RESERVATION_INVALID
        details: Reservation invalid
      - code: MLOG_0010
        title: VALIDATION_FIELDS
        details: Field not valid
    Error:
      type: object
      description: Mas Logistics Error
      properties:
        title:
          type: string
          description: Error description
          example: VALIDATION_FIELDS_FORMAT
        ref:
          type: string
          description: Link to error dictionary
        details:
          type: string
          description: Error detail message
          example: 'Validation error in client.email: provided string should respect
            pattern'
        code:
          type: string
          description: Internal MasLogistics error code
          example: MLOG_XXXX
    DataSales:
      type: object
      description: Information related to sales associated with the order
      properties:
        agent:
          type: string
          description: client reference
          maxLength: 25
          example: RETEN001
        channel:
          $ref: '#/components/schemas/DataSalesChannelEnum'
        type:
          $ref: '#/components/schemas/DataSalesTypeEnum'
        group:
          $ref: '#/components/schemas/DataSalesGroupEnum'
    OrderCommunication:
      type: object
      description: Object representing a communication sent for an order
      properties:
        order_communication_id:
          type: string
          readOnly: true
          description: Unique identifier for the order communication
          example: oc-123e4567-e89b-12d3-a456-426614174000
        order_id:
          type: string
          description: Internal logistics order id
          example: d290f1ee-6c54-4b01-90e6-d701748f0851
        communication_id:
          type: string
          description: Communication identifier
          example: comm-789
        trigger_communication_id:
          type: string
          nullable: true
          description: Trigger communication identifier that caused this communication
          example: trigger-123
        external_communication_id:
          type: string
          nullable: true
          description: External communication identifier
          example: ext-comm-456
        template_id:
          type: string
          description: Template identifier used for the communication
          example: template-012
        sent:
          type: boolean
          description: Indicates if the communication was sent
          example: true
        reason:
          type: string
          nullable: true
          description: Reason for the communication
          example: order_created
        event:
          type: string
          nullable: true
          description: Event that triggered the communication
          example: ORDER_CREATED
        sent_at:
          type: string
          nullable: true
          description: Timestamp when the communication was sent
          example: '2023-11-25T10:30:00Z'
    ArrayOfOrderCommunications:
      allOf:
      - $ref: '#/components/schemas/Pagination'
      - type: object
        description: List of order communications
        properties:
          communications:
            type: array
            description: Communications sent for the order
            items:
              $ref: '#/components/schemas/OrderCommunication'
    Language:
      type: string
      example: ES
      maxLength: 2
      description: Order language
      enum:
      - ES
      - EN
      - EU
      - CA
      - GL
      - PT
    DeliveryTypeEnum:
      type: string
      description: The delivery type
      enum:
      - AGENCY
      - SHOP
      - HOME
      - COURIER
    CourierIdEnum:
      type: string
      description: The courier identifier. For unknowns values, set to DEFAULT
      example: CORREOS
      enum:
      - DEFAULT
      - GLS
      - HL
      - ASIGNA
      - SENDING
      - SEUR
      - CORREOS
      - CORREOS_EXPRESS
      - SUS_MEDIOS
      - INSIDE
      - ZELERIS
      - CTT
    DeliveryServiceIdEnum:
      type: string
      description: Delivery service id. For unknowns values, set to DEFAULT
      example: DELIVERY_24
      enum:
      - DEFAULT
      - DELIVERY_24
      - DELIVERY_10AM
      - DELIVERY_14AM
      - DELIVERY_72
      - DELIVERY_SECURED
      - DELIVERY_INSTALL
      - DELIVERY_STANDARD
    DataSalesChannelEnum:
      type: string
      description: Data sales channel
      enum:
      - TELE_SALE_CARE
      - EXCLUSIVE_POS
      - FRANCHISE_POS
      - INDIRECT_POS
      - SELF_SALE_CARE
      - D2D
    DataSalesTypeEnum:
      type: string
      description: Data sales type
      enum:
      - NEW_SALE
      - ADD_SUBSCRIPTION_TO_BUNDLE
      - MIGRATION
      - EXISTENT_SUBSCRIPTION
    DataSalesGroupEnum:
      type: string
      description: Data sales group
      enum:
      - POS
      - ONLINE_DISTRIBUTION
      - INBOUND
      - OUTBOUND
      - RETENTION
      - LOYALTY
      - UNSUBSCRIBE
      - CANCELLATIONS
      - UNDER_CUSTOMER_BASE
      - BROADCAST_CUSTOMER_BASE
      - ADMINISTRATOR
      - CUSTOMER_SUPPORT
    StatusValue:
      type: string
      description: status value
      example: DELIVERED
      enum:
      - ABANDONED
      - ABSENT_INCIDENCE
      - ACCEPTED
      - ACCEPTED_BY_MANUFACTURER
      - CANCELLATION_REQUEST
      - CANCELLED
      - COLLECTED
      - COLLECTION_REQUEST
      - COMPLETE_RMA
      - CONTRACT_GENERATED
      - CONTRACT_MISSING
      - CONTRACT_NOT_RETRIEVED
      - CONTRACT_RETRIEVED
      - CONTRACT_SIGNED
      - CUSTOMER_CONTACTED
      - DELIVERED
      - DELIVERED_CUSTODIAN
      - DELIVERED_IN_DELIVERY_POINT
      - DELIVERED_TO_MANUFACTURER
      - DELIVERED_TO_OL
      - DELIVERY_IN_WAREHOUSE
      - DELIVERY_INCIDENCE
      - DELIVERY_REQUESTED
      - DELIVERY_TO_MANUFACTURER
      - DESTROYED
      - DISASTER
      - DOCUMENTATION_SENT
      - ERROR
      - ERROR_RMA
      - EXPEDITION_CREATED
      - EXPIRED
      - FAIL_CONTACT
      - FRAUD
      - IN_DELIVERY
      - IN_DELIVERY_TO_MANUFACTURER
      - IN_TRANSIT
      - IN_WAREHOUSE
      - INCIDENCE
      - MISSING_DATA
      - NOT_COLLECTED
      - NOT_DELIVERED
      - NOT_FRAUD
      - NOT_PENALIZED
      - NOT_PICKUP
      - NOT_SENT
      - ON_DEPARTURE
      - ORDER_MODIFIED
      - ORDER_READY
      - ORDER_RECEIVED
      - OUT_OF_STOCK
      - PAID
      - PENALIZED
      - PENDING_CUSTOMER_CONTACT
      - PENDING_PENALTY
      - PENDING_RMA
      - PERMANENCE_ALREADY_LOADED
      - PERMANENCE_ASSOCIATED
      - PICKING
      - PICKING_STARTED
      - PICKUP_ACORDED
      - PICKUP_DONE
      - PICKUP_FAIL
      - PICKUP_IN_PROCESS
      - PICKUP_MODIFIED
      - PICKUP_REQUEST
      - POSSIBLE_FRAUD
      - PREPICKING
      - READY_TO_SHIPPING
      - REFOUND_PENDING
      - REJECTED
      - REJECTED_BY_MANUFACTURER
      - RETURNED
      - RETURNED_TO_CLIENT
      - RETURNED_TO_OL
      - RETURNED_TO_WAREHOUSE
      - SENT
      - SENT_TO_MANUFACTURER
      - SENT_TO_OL
      - SENT_TO_WAREHOUSE
      - SINISTER
      - START_EXTRACTION
      - STARTED
      - STORED
      - STORED_IN_OL
      - TRANSPORT_INCIDENCE
      - UNKNOWN
      - WAREHOUSE_DELIVERED
      - WAREHOUSE_EXIT
      - WAREHOUSE_REJECTED
    AcceptanceStatus:
      type: string
      example: CREATED
      readOnly: true
      description: The status of the product. (Read only parameter, only for GET requests)
      enum:
      - CREATED
      - DISCARDED
    ReservationDetails:
      type: object
      description: Full reservation details from the reservation table
      properties:
        reservation_id:
          type: string
          description: Internal reservation ID
          example: '123456'
        reservation_id_external:
          type: string
          description: External reservation ID
          example: ext-123456
        order_id:
          type: string
          nullable: true
          description: Internal order ID associated with the reservation
          example: E01ABC123DEF456G
        order_id_crm:
          type: string
          nullable: true
          description: CRM order ID associated with the reservation
          example: '109384632'
        product_reference:
          type: string
          description: Product reference
          example: P0000001
        state:
          type: string
          description: Reservation state
          enum:
          - PENDING
          - CONFIRMED
          - CANCELLED
          - ORDER_CREATED
          example: CONFIRMED
        tenant:
          type: string
          description: Tenant or organization
          example: yoigo
        duration:
          type: string
          nullable: true
          description: Duration of the reservation
          example: 180 seconds
        valid_until:
          type: string
          nullable: true
          description: Timestamp when the reservation expires
          example: '2025-12-17T12:00:00Z'
        create_date:
          type: string
          description: Reservation creation timestamp
          example: '2025-12-15T10:00:00Z'
        update_date:
          type: string
          description: Reservation last update timestamp
          example: '2025-12-16T15:30:00Z'
    ReservationStatus:
      type: object
      required:
      - status
      properties:
        reservation_id:
          type: string
          readOnly: true
          description: Reservation Id
          example: '123456'
        order_id:
          type: string
          description: Order Id (newOrder service)
          example: '134566'
          minLength: 1
        status:
          type: string
          enum:
          - CONFIRM
          - CANCEL
          description: Reservation status
          example: CONFIRM
        zip_code:
          type: string
          minLength: 5
          maxLength: 5
          pattern: '[\d]{5}'
          description: Postal code (Mandatory if the status is CONFIRM)
          example: '28912'
    Reservation:
      type: object
      required:
      - product_id
      properties:
        data_sales:
          $ref: '#/components/schemas/DataSales'
        product_id:
          type: string
          description: Product identifier
          example: RM58AV3N2
    Order:
      type: object
      description: Represents an order with its main details.
      required:
      - order
      - shipping
      - client
      properties:
        order:
          $ref: '#/components/schemas/OrderData'
        data_sales:
          $ref: '#/components/schemas/DataSales'
        client:
          $ref: '#/components/schemas/Client'
        invoice:
          allOf:
          - $ref: '#/components/schemas/Invoice'
          - type: object
            writeOnly: true
        shipping:
          $ref: '#/components/schemas/DeliveryShipping'
    CreateOrder:
      allOf:
      - $ref: '#/components/schemas/Order'
      - type: object
        description: Represents a new order creation request/response including products
          and documentation.
        required:
        - products
        properties:
          products:
            writeOnly: true
            type: array
            items:
              $ref: '#/components/schemas/Product'
          documentation:
            $ref: '#/components/schemas/Documentation'
    OrderData:
      type: object
      description: Main order data, including ID and essential details
      properties:
        reservation_id:
          type: string
          description: The reservation identifier
          example: 7d19cf38-a33d-42cd-8770-cea25db0b2e3
          nullable: true
        subscription_id:
          description: Identifier of a customer subscription, it can have several
            subscription_device_id associated to its line.
          type: string
          example: '2203846'
        work_order:
          type: string
          minLength: 1
          maxLength: 25
          description: Work Order
          example: MYSIM_213563123
        order_id:
          type: string
          readOnly: true
          example: E01ABC123DEF456G
          description: The order identifier in mas-logistics domain. (Read only parameter,
            only for GET requests)
        order_id_crm:
          type: string
          maxLength: 45
          example: '109384632'
          description: The order identifier of the requester. For example, the ItemNumber.
        order_id_external:
          type: string
          example: '484543418'
          description: Order id in external domain
        business_process:
          $ref: '#/components/schemas/DirectBusinessProcess'
        order_date:
          description: 'Order date in ISO 8601 format. Example: 2021-05-24T09:00:00Z
            (Read only parameter, only for GET requests)'
          type: string
          format: date-time
          example: '2021-05-25T09:00:00Z'
        reason:
          type: string
          example: Extraordinary order, original order lost
          description: The reason of the order
        convergent:
          type: boolean
          description: Is Order convergent
          example: true
        language:
          $ref: '#/components/schemas/Language'
        delivery_type:
          $ref: '#/components/schemas/DeliveryTypeEnum'
    DirectBusinessProcess:
      type: string
      description: The business process
      enum:
      - PEDIDO
      - BREAKDOWN_DELIVERY
      - MIGRATION_DELIVERY
      example: PEDIDO
      default: PEDIDO
    CancellationRequest:
      type: object
      description: Request to cancel a whole order, no partial cancellations allowed.
      properties:
        cancellation_request_id:
          type: string
          readOnly: true
          description: "The identifier of the cancellation request. (Read only parameter,\
            \ only for GET requests) (Deprecated \nfield, please remove linked logic)\n"
          example: C0000001
        reason:
          type: string
          description: The reason of the cancellation.
          example: DUPLICATE
        products:
          type: array
          description: The devices of the cancellation orders. (Deprecated soon, do
            not send in new integrations)
          items:
            $ref: '#/components/schemas/ProductBasic'
    DeliveryConfirmationRequest:
      type: object
      properties:
        products:
          type: array
          items:
            $ref: '#/components/schemas/ProductBasic'
    Document:
      type: object
      description: Object representing the document as contract, INE or delivery note
      properties:
        document_id:
          type: string
          description: Public document id managed by mas-logistics, not the id managed
            by mas-documents
          example: d290f1ee-6c54-4b01-90e6-d701748f0851
        document_type:
          type: string
          description: Document Type
          example: CONTRACT
          enum:
          - CONTRACT
          - INE
          - CCGG
          - DELIVERY_NOTE
        copies:
          type: integer
          description: The number of copies that must be printed
          example: 2
        signable:
          type: boolean
          description: Defines if the document is signable in the MasLogistics context
            using the signOrderDocuments operation
          example: true
          default: false
        signed:
          type: boolean
          description: Defines if the document is signed. If the document is not signable,
            this field will never be true
          example: true
          default: false
    DocumentWithUrl:
      allOf:
      - $ref: '#/components/schemas/Document'
      - type: object
        properties:
          url:
            type: string
            description: The public url to download the document
            example: https://storage.googleapis.com/mas-documents-prod/cbd2e693-d71a-4cee-8313-1972acc0394d
    ReservationCreateResponse:
      type: object
      description: Response of the reservation creation
      properties:
        product_id:
          type: string
          description: The product Id
          example: P0000001
        reservation_id:
          type: string
          description: Reservation Id
          example: '250'
        total_duration_in_seconds:
          type: number
          description: The time in seconds that the reservation is available before
            expire.
          example: 180
        valid_until:
          type: string
          description: The timestamp when the reservation will expire in ISO 8601
            format and UTC
          example: '2021-05-24T09:00:00Z'
    Invoice:
      type: object
      description: Invoice information generated for the order
      properties:
        address:
          $ref: '#/components/schemas/Address'
        client:
          $ref: '#/components/schemas/Client'
        data_invoice:
          $ref: '#/components/schemas/DataInvoice'
    DataInvoice:
      type: object
      description: Data invoice information
      required:
      - base
      - tax_value
      - total_invoice
      - payment_type
      properties:
        base:
          type: number
          description: base invoice
          example: 100
        tax_value:
          type: number
          description: invoice tax value
          example: 21
        total_invoice:
          type: number
          description: total invoice
          example: 121
        discount:
          type: number
          description: discount
          example: 0
        payment_type:
          type: integer
          description: payment type
        residual_value:
          type: number
          description: Final Payment
        initial_payment:
          type: number
          description: Initial payment
        fee:
          $ref: '#/components/schemas/Fee'
    Fee:
      type: object
      description: Fee information
      properties:
        amount:
          type: number
          description: Fee amount
          example: 12
        duration:
          type: integer
          description: Fee duration
          example: 12
    DeliveryShipping:
      required:
      - contact_data
      - address
      - data_delivery
      type: object
      description: Shipping details, including address and delivery info
      properties:
        address:
          $ref: '#/components/schemas/Address'
        contact_data:
          required:
          - name
          - surnames
          allOf:
          - $ref: '#/components/schemas/Client'
        data_delivery:
          $ref: '#/components/schemas/DataDelivery'
    DataDelivery:
      type: object
      description: Data delivery information
      required:
      - courier_id
      - delivery_service
      - exclusive
      - verify_identity
      - retrieve_contract
      properties:
        courier_id:
          $ref: '#/components/schemas/CourierIdEnum'
        delivery_service:
          $ref: '#/components/schemas/DeliveryServiceIdEnum'
        exclusive:
          type: boolean
          description: Delivery to exact person
          example: true
        verify_identity:
          type: boolean
          description: The carrier must verify the identity document
          example: false
        retrieve_contract:
          type: boolean
          description: The carrier must return the signed document
          example: false
        group_by:
          type: string
          description: Group by
        secure_delivery:
          type: boolean
          description: Defines if delivery should be secure
          example: false
        delivery_point_id:
          type: string
          description: The delivery point identifier. Normally the store SFID. Mandatory
            for orders with delivery type SHOP.
          example: SEUR-1234
        delivery_shop_name:
          type: string
          description: The delivery shop name. Mandatory for orders with delivery
            type SHOP.
          example: Mas Life Plaza España
        delivery_type:
          $ref: '#/components/schemas/DeliveryTypeEnum'
        ol_comments:
          type: string
          description: information or instructions for OL
          example: ONT password
    Documentation:
      type: object
      description: Info about the documentation related to the order
      properties:
        letter_type:
          type: string
          description: 'Letter type. Possible values: "H", "T", "TV", "RW", "SR",
            "WF", "WP", "JN", "JP", "JR", "LC", "N", "PP0", "PP8", "R"'
          example: WP
        documents:
          type: array
          description: List of documents
          items:
            $ref: '#/components/schemas/Document'
    SignDocumentsRequest:
      type: object
      properties:
        order_ids:
          type: array
          items:
            type: string
          description: Order ids to sign
          example:
          - 6ea0ca52-e194-45e2-a4fd-6d93923682bd
          - 8b243340-4b87-4b9b-bead-781698931477
    SignDocumentsResponse:
      type: object
      properties:
        sign_id:
          type: string
          description: The sign id from MasDocuments
          example: 6ea0ca52-e194-45e2-a4fd-6d93923682bd
        documents:
          type: array
          items:
            $ref: '#/components/schemas/Document'
    ArrayOfOrders:
      allOf:
      - $ref: '#/components/schemas/Pagination'
      - type: object
        description: List of Orders
        properties:
          orders:
            type: array
            description: List of Orders
            items:
              $ref: '#/components/schemas/Order'
    ArrayOfDocuments:
      allOf:
      - $ref: '#/components/schemas/Pagination'
      - type: object
        properties:
          documents:
            type: array
            items:
              $ref: '#/components/schemas/Document'
    ArrayOfStockItem:
      type: object
      properties:
        data:
          type: array
          description: List of objects with stock information
          items:
            $ref: '#/components/schemas/StockItem'
    StockItem:
      type: object
      description: Stock information
      properties:
        warehouse_id:
          type: string
          description: Warehouse Id
          example: '50'
        product_id:
          type: string
          description: productId
          example: RM58AV3N2
        available_quantity:
          type: integer
          description: Available quantity
          example: 60
    PickupData:
      type: object
      required:
      - business_process
      properties:
        subscription_id:
          type: string
          example: '2203846'
        pickup_id:
          type: string
          readOnly: true
          description: The pickup identifier in mas-logistics domain. (Read only parameter,
            only for GET requests)
          example: P0000001
        order_id_external:
          type: string
          readOnly: true
          description: The order identifier given by the logistics operator. (Read
            only parameter, only for GET requests)
          example: YG24011009607
        order_id_crm:
          type: string
          maxLength: 45
          description: The order identifier of the request. It is mandatory to sent
            the OT in router unsubscription process.
          example: '4640528'
        language:
          $ref: '#/components/schemas/Language'
        business_process:
          $ref: '#/components/schemas/ReverseBusinessProcess'
        order_date:
          description: 'Order date in ISO 8601 format. Example: 2021-05-24T09:00:00Z
            (Read only parameter, only for GET requests)'
          type: string
          format: date-time
          example: '2021-05-25T09:00:00Z'
        reason:
          type: string
          example: Unsubscription
          description: The reason of the pickup
        delivery_type:
          $ref: '#/components/schemas/DeliveryTypeEnum'
        access_reused:
          type: boolean
          example: true
          writeOnly: true
          description: Access reused for routers pickups
        blocked:
          type: boolean
          example: false
          writeOnly: true
          default: false
          description: If true, the pickup is saved in blocked state and not forwarded
            to the logistics operator until explicitly unblocked
    ReverseBusinessProcess:
      type: string
      description: The business process
      example: UNSUBSCRIPTION
      enum:
      - UNSUBSCRIPTION
      - WITHDRAWAL
      - CANCELLATION
      - FINALPAYMENT
      - BREAKDOWN_PICKUP
      - MIGRATION_PICKUP
      - CANCELLATION_SHOP
    PickupShipping:
      type: object
      description: Shipping information for a pickup
      required:
      - contact_data
      - transport_data
      - address
      properties:
        address:
          $ref: '#/components/schemas/Address'
        contact_data:
          $ref: '#/components/schemas/Client'
        transport_data:
          $ref: '#/components/schemas/PickupTransportData'
    PickupTransportData:
      type: object
      description: Data delivery information
      required:
      - courier_id
      properties:
        courier_id:
          $ref: '#/components/schemas/CourierIdEnum'
        delivery_service:
          $ref: '#/components/schemas/DeliveryServiceIdEnum'
          description: The delivery service. (Optional value to be deleted, please
            not send this field)
        exclusive:
          type: boolean
          example: true
          description: Delivery to exact person. (Optional value to be deleted, please
            not send this field)
        verify_identity:
          type: boolean
          example: false
          description: The carrier must verify the identity document. (Optional value
            to be deleted, please not send this field)
        retrieve_contract:
          type: boolean
          example: false
          description: The carrier must return the signed document. (Optional value
            to be deleted, please not send this field)
        secure_delivery:
          type: boolean
          description: Defines if delivery should be secure
          example: false
        delivery_point_id:
          type: string
          description: The delivery point identifier. Normally the store SFID. Mandatory
            for orders with delivery type SHOP.
          example: SEUR-1234
        delivery_shop_name:
          type: string
          description: The delivery shop name. Mandatory for orders with delivery
            type SHOP.
          example: Mas Life Plaza España
        return_code:
          type: string
          readOnly: true
          description: The return code provided by the courier (Read only parameter,
            only for GET requests)
          example: A1234
        delivery_type:
          $ref: '#/components/schemas/DeliveryTypeEnum'
    Pickup:
      type: object
      description: Info about the Expedition
      required:
      - order
      - shipping
      - products
      - client
      properties:
        order:
          $ref: '#/components/schemas/PickupData'
        data_sales:
          $ref: '#/components/schemas/DataSales'
        client:
          $ref: '#/components/schemas/Client'
        shipping:
          $ref: '#/components/schemas/PickupShipping'
        products:
          type: array
          description: Info about the pickup Product
          writeOnly: true
          items:
            $ref: '#/components/schemas/PickupProductBasic'
    PickupProductBasic:
      required:
      - product_code
      - product_type
      - subscription_device_id
      allOf:
      - $ref: '#/components/schemas/ProductBasic'
      - type: object
        description: Basic information about a product in a pickup
        properties:
          technology:
            type: string
            example: FTTH
            description: Technology type for routers pickups
            enum:
            - FTTH
            - ADSL
          status:
            $ref: '#/components/schemas/AcceptanceStatus'
    ArrayOfPickups:
      allOf:
      - $ref: '#/components/schemas/Pagination'
      - type: object
        description: List of Pickups
        properties:
          pickups:
            type: array
            description: List of Pickups
            items:
              $ref: '#/components/schemas/Pickup'
    ReverseCancellationRequest:
      type: object
      description: Request to cancel a whole pickup, no partial cancellations allowed.
      properties:
        reason:
          type: string
          description: The reason of the cancellation.
          example: DUPLICATE
    Swap:
      type: object
      description: Represents an order with its main details.
      required:
      - swap
      properties:
        swap:
          $ref: '#/components/schemas/SwapData'
        order:
          $ref: '#/components/schemas/SwapOrderData'
        pickup:
          $ref: '#/components/schemas/SwapPickupData'
        client:
          $ref: '#/components/schemas/Client'
        shipping:
          $ref: '#/components/schemas/SwapShipping'
    CreateSwap:
      type: object
      description: The needed data to create a swap
      required:
      - swap
      - client
      - shipping
      - products
      properties:
        swap:
          $ref: '#/components/schemas/SwapData'
        client:
          $ref: '#/components/schemas/Client'
        shipping:
          $ref: '#/components/schemas/SwapShipping'
        products:
          type: object
          required:
          - delivery
          properties:
            delivery:
              type: array
              items:
                $ref: '#/components/schemas/Product'
            pickup:
              type: array
              items:
                $ref: '#/components/schemas/PickupProductBasic'
    CreateSwapResponse:
      type: object
      description: The returned data when created a swap
      required:
      - swap
      - client
      - shipping
      - products
      properties:
        swap:
          $ref: '#/components/schemas/SwapData'
        order:
          $ref: '#/components/schemas/SwapOrderData'
        pickup:
          $ref: '#/components/schemas/SwapPickupData'
        client:
          $ref: '#/components/schemas/Client'
        shipping:
          $ref: '#/components/schemas/SwapShipping'
        products:
          type: object
          required:
          - delivery
          properties:
            delivery:
              type: array
              items:
                $ref: '#/components/schemas/Product'
            pickup:
              type: array
              items:
                $ref: '#/components/schemas/PickupProductBasic'
    SwapData:
      type: object
      description: Main swap data, including ID and essential details
      required:
      - business_process
      properties:
        swap_id:
          type: string
          description: The swap identifier in mas-logistics domain. (Read only parameter,
            only for GET requests)
          example: S01ABC123DEF456G
          readOnly: true
        swap_id_crm:
          type: string
          maxLength: 45
          description: The order identifier of the request. It is mandatory to sent
            the OT in router unsubscription process.
          example: '4640528'
        subscription_id:
          description: Identifier of a customer subscription, it can have several
            subscription_device_id associated to its line.
          type: string
          example: '2203846'
        business_process:
          $ref: '#/components/schemas/SwapBusinessProcess'
          example: BREAKDOWN
        expedition_type:
          type: string
          description: The expedition type (Read only parameter, only for GET requests)
          readOnly: true
          enum:
          - SINGLE_EXPEDITION
          - DOUBLE_EXPEDITION
        swap_date:
          description: 'Swap date in ISO 8601 format. Example: 2021-05-24T09:00:00Z
            (Read only parameter, only for GET requests)'
          type: string
          format: date-time
          example: '2021-05-25T09:00:00Z'
        reason:
          type: string
          example: Extraordinary swap due to bad condition product delivered
          description: The reason of the pickup
        language:
          $ref: '#/components/schemas/Language'
    SwapOrderData:
      type: object
      description: Main order data, including ID and essential details
      properties:
        order_id:
          type: string
          readOnly: true
          example: E01ABC123DEF456G
          description: The order identifier in mas-logistics domain. (Read only parameter,
            only for GET requests)
        order_id_external:
          type: string
          readOnly: true
          example: '484543418'
          description: The order identifier given by the logistics operator. (Read
            only parameter, only for GET requests)
        business_process:
          $ref: '#/components/schemas/SwapDeliveryBusinessProcess'
    SwapPickupData:
      type: object
      description: Pickup data, only available to swaps with expedition_type DOUBLE_EXPEDITION
      properties:
        pickup_id:
          type: string
          readOnly: true
          example: R01ABC123DEF456G
          description: The pickup identifier in mas-logistics domain. (Read only parameter,
            only for GET requests)
        order_id_external:
          type: string
          readOnly: true
          example: YG24011009607
          description: The order identifier given by the logistics operator. (Read
            only parameter, only for GET requests)
        business_process:
          $ref: '#/components/schemas/SwapPickupBusinessProcess'
    SwapBusinessProcess:
      type: string
      description: The business process
      enum:
      - SWAP
      - FIX
      - BREAKDOWN
      - MIGRATION
      example: SWAP
      default: SWAP
    SwapDeliveryBusinessProcess:
      type: string
      description: The delivery business process of a swap
      enum:
      - SWAP
      - FIX
      - BREAKDOWN_DELIVERY
      - MIGRATION_DELIVERY
    SwapPickupBusinessProcess:
      type: string
      description: The pickup business process of a swap
      enum:
      - BREAKDOWN_PICKUP
      - MIGRATION_PICKUP
    SwapShipping:
      type: object
      description: Shipping details, including address and delivery info
      required:
      - delivery
      properties:
        delivery:
          $ref: '#/components/schemas/DeliveryShipping'
        pickup:
          $ref: '#/components/schemas/PickupShipping'
    SwapProductWithExpedition:
      allOf:
      - $ref: '#/components/schemas/ProductWithExpedition'
      - type: object
        properties:
          swap_mode:
            type: string
            enum:
            - DELIVERED
            - COLLECTED
    ArrayOfSwaps:
      allOf:
      - $ref: '#/components/schemas/Pagination'
      - type: object
        description: List of Swaps
        properties:
          orders:
            type: array
            description: List of Swaps
            items:
              $ref: '#/components/schemas/Swap'
    ArrayOfSwapProductWithExpedition:
      allOf:
      - $ref: '#/components/schemas/Pagination'
      - type: object
        description: List of products with expeditions
        properties:
          products:
            type: array
            description: Info about the product with the expedition
            items:
              $ref: '#/components/schemas/SwapProductWithExpedition'
    DataTransport:
      type: object
      properties:
        courier_id:
          $ref: '#/components/schemas/CourierIdEnum'
        delivery_service:
          $ref: '#/components/schemas/DeliveryServiceIdEnum'
        verify_identity:
          type: boolean
          description: The carrier must verify the identity document
          example: false
    Tracking:
      type: object
      description: Info about the tracking of the order
      properties:
        tracking_link:
          type: string
          description: tracking link for the delivery
          nullable: true
          example: http://gls.es/111
        return_code:
          type: string
          description: Code for returning the device
          nullable: true
          example: '1029373622'
    Expedition:
      type: object
      description: Info about the Expedition
      properties:
        expedition_id:
          type: string
          minLength: 0
          maxLength: 200
          description: Expedition id
          example: a13a4674f6547447ff1f8813f33b5a90f6616ec2514e3f6e162acc5b88e9cfcb-R0
        created_date:
          type: string
          example: '2023-11-26'
        transport:
          $ref: '#/components/schemas/DataTransport'
        tracking:
          $ref: '#/components/schemas/Tracking'
        status_history:
          type: array
          description: List of status
          items:
            $ref: '#/components/schemas/Status'
        products:
          type: array
          description: List of products
          items:
            $ref: '#/components/schemas/ProductInExpedition'
    ProductInExpedition:
      allOf:
      - $ref: '#/components/schemas/Product'
      - type: object
        description: Product with associated order ID for expeditions
        properties:
          order_id:
            type: string
            readOnly: true
            description: The order ID this product belongs to. Each product in an
              expedition can belong to a different order.
            example: order-12345
    ArrayOfExpeditions:
      allOf:
      - $ref: '#/components/schemas/Pagination'
      - type: object
        description: List of expeditions
        properties:
          expeditions:
            type: array
            description: Info about the Expeditions
            items:
              $ref: '#/components/schemas/Expedition'
    ExternalOrder:
      type: object
      required:
      - order_id_external
      - reexpedition
      - delivery_type
      - journeys
      - status
      properties:
        order_id_external:
          type: string
          minLength: 1
          maxLength: 256
          description: External order identifier generated by the logistics operator
            (For example, the MasLola id). Must be constant for the same order
          example: '12334567'
        expedition_id_external:
          type: string
          minLength: 1
          maxLength: 256
          description: External expedition identifier generated by the logistics operator
            (For example, the EuroLogistics id). It may change during the order process
          example: '12334567'
        reexpedition:
          type: string
          minLength: 1
          maxLength: 3
          description: Reexpedition identifier
          example: R0
        order_date:
          type: string
          description: Order date in ISO 8601 format and UTC
          example: '2021-03-24T13:31:16.425Z'
        logistics_operator:
          type: string
          description: logistic operator
          enum:
          - INTERBOX
          - ANOVO
          - EUROLOGISTICA
          - DHL
          - CEX
        delivery_type:
          type: string
          description: Delivery type.
          example: HOME
          enum:
          - HOME
          - AGENCY
          - SHOP
          - COURIER
        process_type:
          type: string
          minLength: 1
          maxLength: 40
          description: Logistics process type.
          enum:
          - SWAP
          - PEDIDO
          - BAJA
          - DESISTIMIENTO
          - CANCELACION
          - FIX
          - DOA
          - FINALPAYMENT
          - BREAKDOWN_DELIVERY
          - BREAKDOWN_PICKUP
          - MIGRATION_DELIVERY
          - MIGRATION_PICKUP
          - CANCELLATION_SHOP
          example: SWAP
        logistic_operation:
          type: string
          description: Logistic operation.
          enum:
          - DELIVERY
          - PICKUP
          example: DELIVERY
        portability:
          type: boolean
          description: order with associated portability
          example: true
        business:
          type: string
          minLength: 0
          maxLength: 50
          description: Business name
        status:
          $ref: '#/components/schemas/ExternalStatus'
        journeys:
          type: array
          items:
            $ref: '#/components/schemas/Journey'
          minItems: 1
        documentation_only:
          type: boolean
          description: order with only documentation
          example: true
          default: false
        documentation:
          $ref: '#/components/schemas/ExternalDocumentation'
        customer_delivering_info:
          $ref: '#/components/schemas/CustomerDeliveringInfo'
    Journey:
      type: object
      required:
      - devices
      properties:
        devices:
          type: array
          items:
            $ref: '#/components/schemas/Device'
          minItems: 1
        transport:
          $ref: '#/components/schemas/Transport'
    ExternalDocumentation:
      type: array
      items:
        type: object
        properties:
          preprinted:
            type: boolean
          total_pages:
            type: number
            example: 10
            description: Total printed pages
          documents:
            type: array
            items:
              type: object
              properties:
                recipient:
                  type: string
                  description: Recipient of the documentation
                  enum:
                  - CLIENT
                  - COMPANY
                document_type:
                  type: string
                  description: Type of document
                  enum:
                  - WL
                  - INE
                  - CONTRACT
                  - INVOICE
                  - SEPA
                  - MIGRATION
                  - PARTICULAR_CONDITIONS
                  - FINANCING_CONDITIONS
                  - PORTABILITY_VALIDATION
                quantity:
                  type: number
                  description: Quantity of this document
                  example: 1
    Transport:
      type: object
      required:
      - courier
      - service
      properties:
        delivery_details:
          type: object
          properties:
            package:
              type: object
              properties:
                weight:
                  type: number
                  description: Weight in kg.
                  example: 2.5
                dimensions:
                  type: number
                  description: Volume.
            coverage:
              type: boolean
              description: Is covered by insurance
              example: true
            secure_delivery:
              type: boolean
              description: Defines if delivery should be secure
              example: false
            remaining_payment:
              $ref: '#/components/schemas/Price'
            recipient_verification:
              type: object
              properties:
                exclusive_delivery:
                  type: boolean
                  description: The carrier must verify the identity document
                  example: false
                verification:
                  type: object
                  properties:
                    required:
                      type: boolean
                      description: The carrier must take photo the identity document
                      example: true
                    completed:
                      type: boolean
                      description: The carrier successfully has taken photo the identity
                        document
                      example: false
        delivery_date:
          type: string
          format: date
          description: Expected delivery date (YYYY-MM-DD).
          example: '2025-11-10'
        courier:
          $ref: '#/components/schemas/CourierIdEnum'
        service:
          type: string
          description: Logistics Service type
          example: 24h
          enum:
          - DELIVERY_24
          - DELIVERY_10AM
          - DELIVERY_14AM
          - DELIVERY_72
          - DELIVERY_SECURED
          - DELIVERY_INSTALL
          - DELIVERY_STANDARD
          - DEFAULT
        tracking_link:
          type: string
          minLength: 0
          maxLength: 256
          description: Tracking link
          example: https://www.trackinglink.com/trackinglink/38383
        expedition_number:
          type: string
          minLength: 0
          maxLength: 256
          description: The expedition number of the courier when its postal office
          example: '28272272722'
        delivery_note:
          type: object
          properties:
            delivery_note_id:
              type: string
              description: Identificative number  of the delivery note
              example: '111222333444'
            link:
              type: string
              description: Link to the delivery note
              example: https://www.gls.com/deliverynotelink/38383
    BaseDevice:
      type: object
      properties:
        subscription:
          $ref: '#/components/schemas/Subscription'
        type:
          $ref: '#/components/schemas/DeviceType'
        reference:
          type: string
          minLength: 0
          maxLength: 256
          description: Device reference
          example: 8U8474JE3748
        replacement:
          type: string
          minLength: 0
          maxLength: 1
          description: replacement , posible values "Y" or "N"
          example: Y
        identifier:
          type: string
          minLength: 0
          maxLength: 256
          description: Device's identifier
          example: 10C25AD5580A
        additional_identifier:
          type: string
          minLength: 0
          maxLength: 256
          description: Additional identifier, if exists
        active:
          type: boolean
          description: The flag will be true if the device has been delivered and
            false if it has been collected
          default: true
        subscription_device_id:
          type: string
          description: Subscription device Id
          example: XXXXXXXXX
        price:
          type: object
          properties:
            markup:
              $ref: '#/components/schemas/Price'
            no_markup:
              $ref: '#/components/schemas/Price'
    Device:
      allOf:
      - $ref: '#/components/schemas/BaseDevice'
      required:
      - subscription
      - reference
      properties:
        reference:
          type: string
          minLength: 1
          maxLength: 256
          description: Device reference
          example: 8U8474JE3748
        subscription:
          required:
          - order_id
          allOf:
          - $ref: '#/components/schemas/Subscription'
    PickingDevice:
      allOf:
      - $ref: '#/components/schemas/BaseDevice'
      required:
      - identifier
      - subscription
      properties:
        subscription:
          required:
          - order_id
          allOf:
          - $ref: '#/components/schemas/Subscription'
    DeviceType:
      type: object
      properties:
        action_id:
          type: string
          minLength: 0
          maxLength: 2
          description: Action id
          example: '1'
        family_id:
          type: string
          minLength: 0
          maxLength: 2
          description: Family code
          example: '17'
        id:
          type: string
          description: Device type identifier. NULLABLE.
          enum:
          - SIM
          - TERMINAL
          - ROUTER
          - SMART_TV
          - SMARTHOME
          - STB
          - STB_APPLE
          - GENERIC
          - WIFIMESH
          example: ROUTER
    Subscription:
      type: object
      properties:
        subscription_id:
          type: string
          nullable: true
          minLength: 0
          maxLength: 256
          description: Subscription identifier
          example: SUBS-ID
        order_id:
          type: string
          minLength: 1
          maxLength: 256
          description: Order identifier
          example: CRM-ID
        msisdn:
          type: string
          nullable: true
          minLength: 0
          maxLength: 9
          description: Mobile Station International Subscriber Directory Number. MSISDN
            associated for the order associated to the device.
          example: '666777888'
    ExternalClient:
      type: object
      required:
      - identity
      - contact_phone
      properties:
        identity:
          $ref: '#/components/schemas/ExternalIdentity'
        contact_phone:
          $ref: '#/components/schemas/ExternalPhone'
        name:
          type: string
          description: Client name
          example: Juan
        surnames:
          type: array
          items:
            type: string
            example: Perez
        email:
          type: string
          description: Client email
          example: example@gmail.com
        commercial_name:
          type: string
          description: Client commercial name
          example: BUSINESS SA
    ExternalIdentity:
      type: object
      required:
      - document_id
      - document_type
      properties:
        document_id:
          type: string
          minLength: 1
          maxLength: 20
          description: Identity Document Id
          example: 00557788T
        document_type:
          type: string
          description: Identity Document Type
          enum:
          - NIF
          - CIF
          - NIE
          - PASSPORT
    Price:
      type: object
      properties:
        total:
          type: number
          description: Total Amount
          example: 24.5
        currency:
          type: string
          maxLength: 3
          description: Currency as ISO 4217 code
          example: EUR
    ExternalPhone:
      type: object
      required:
      - phone_number
      properties:
        phone_number:
          type: string
          description: Phone Number
          minLength: 1
          maxLength: 9
          example: '666777888'
        prefix:
          type: string
          description: Phone prefix
          example: '+34'
    CustomerDeliveringInfo:
      type: object
      description: Customer delivering information. Mandatory if the order is not
        present or if the customer delivering info has been changed from last status
        (Marked as updated).
      required:
      - client
      properties:
        address:
          $ref: '#/components/schemas/ExternalAddress'
        client:
          $ref: '#/components/schemas/ExternalClient'
        language:
          type: string
          description: Preferred language as ISO 639-1 code
          enum:
          - ES
          - CA
          - EU
          - EN
          - PT
          - GL
          example: ES
        updated:
          type: boolean
          description: Indicates if the customer delivery info has been changed from
            last status
    ExternalStatus:
      type: object
      required:
      - id
      - timestamp
      properties:
        id:
          type: string
          minLength: 1
          maxLength: 36
          description: Status id
          example: '3'
        description:
          type: string
          minLength: 0
          maxLength: 256
          description: Description about status
          example: Description about status
        timestamp:
          type: string
          description: Order status timestamp in ISO 8601 format and UTC
          example: '2021-05-24T09:00:00Z'
        reason:
          type: object
          properties:
            code:
              type: string
              description: The reason code of the status
              maxLength: 256
              example: INCOMPLETE
            description:
              type: string
              description: The reason description of the status
              maxLength: 256
              example: Missing components or equipment
    ExternalAddress:
      type: object
      properties:
        building_street_type:
          type: string
          minLength: 0
          maxLength: 256
          description: Street type
          example: Calle
        building_street_name:
          type: string
          minLength: 0
          maxLength: 256
          description: Street name
          example: Mayor
        building_number:
          type: string
          minLength: 0
          maxLength: 256
          description: Building number
          example: '208'
        building_floor:
          type: string
          minLength: 0
          maxLength: 256
          description: Building floor
          example: A
        building_others:
          type: string
          minLength: 0
          maxLength: 256
          description: Other address parameters
        city:
          type: string
          minLength: 0
          maxLength: 256
          description: City
          example: Leganes
        zipcode:
          type: string
          minLength: 0
          maxLength: 5
          description: Zip code
          example: '28912'
        region:
          type: string
          minLength: 0
          maxLength: 256
          description: Region
          example: Madrid
        country:
          type: string
          minLength: 0
          maxLength: 2
          description: Country ISO 3166
          example: ES
    Obsolescence:
      type: object
      required:
      - reference
      properties:
        reference:
          type: string
          maxLength: 256
          description: Unique reference identifier (primary key)
          example: DEV-1234
        obsolete:
          type: boolean
          nullable: true
          description: Whether the device is considered obsolete
          example: true
        breakdowns_maximum:
          type: integer
          format: int32
          nullable: true
          description: Maximum number of breakdowns allowed before considering obsolete
          example: 3
        days_obsolescence:
          type: integer
          format: int32
          nullable: true
          description: Number of days since creation to mark as obsolete
          example: 365
    DeleteResponse:
      type: object
      properties:
        message:
          type: string
          example: Obsolescence record successfully deleted
        reference:
          type: string
          example: DEV-1234
    ArrayOfObsolescences:
      allOf:
      - $ref: '#/components/schemas/Pagination'
      - type: object
        properties:
          obsolescences:
            type: array
            items:
              $ref: '#/components/schemas/Obsolescence'
    Communication:
      type: object
      required:
      - alias
      - templateId
      properties:
        communicationId:
          type: integer
          format: int64
          description: Unique communication identifier (auto-generated)
          example: 1
          readOnly: true
        alias:
          type: string
          maxLength: 256
          description: Unique alias for the communication
          example: order-confirmation
        description:
          type: string
          description: Description of the communication
          example: Send order confirmation to customer
        templateId:
          type: string
          maxLength: 256
          description: Template identifier from mas-communications
          example: TEMPLATE_ORDER_CONFIRMATION
        notifyChannels:
          type: boolean
          nullable: true
          description: Whether to notify through specified channels
          example: true
        channels:
          type: array
          items:
            type: string
            enum:
            - EMAIL
            - SMS
          nullable: true
          description: Communication channels
          example:
          - EMAIL
          - SMS
        maxDelayFromOrderCreation:
          type: string
          nullable: true
          pattern: ^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$
          description: Maximum delay from order creation (ISO-8601 duration format)
          example: PT24H
        maxDelayFromStatusReport:
          type: string
          nullable: true
          pattern: ^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$
          description: Maximum delay from status report (ISO-8601 duration format)
          example: PT2H
        documentationOnly:
          type: boolean
          nullable: true
          description: Whether this communication is for documentation purposes only
          example: false
        tenants:
          type: array
          items:
            type: string
          nullable: true
          description: List of tenants this communication applies to
          example:
          - yoigo
          - masmovil
        allowedDevices:
          type: array
          items:
            type: string
          nullable: true
          description: List of device references this communication applies to
          example:
          - DEVICE-123
          - DEVICE-456
        arguments:
          type: object
          nullable: true
          description: Additional arguments as JSON object
          example:
            key: value
        exclusions:
          type: object
          nullable: true
          description: Exclusion criteria as JSON object
          example:
            courier:
            - GLS
        createDate:
          type: string
          format: date-time
          description: Creation timestamp
          readOnly: true
        updateDate:
          type: string
          format: date-time
          description: Last update timestamp
          readOnly: true
        triggers:
          type: array
          items:
            $ref: '#/components/schemas/CommunicationTrigger'
          description: List of trigger states associated with this communication
    CommunicationTrigger:
      type: object
      required:
      - uuidStatus
      properties:
        communicationTriggerId:
          type: integer
          format: int64
          description: Unique trigger identifier (auto-generated)
          example: 1
          readOnly: true
        communicationId:
          type: integer
          format: int64
          description: Reference to parent communication
          example: 1
        uuidStatus:
          type: string
          maxLength: 256
          description: UUID status that triggers this communication
          example: STATUS_DELIVERED
        deliveryTypes:
          type: array
          items:
            $ref: '#/components/schemas/DeliveryTypeEnum'
          nullable: true
          description: Delivery types that trigger this communication
          example:
          - HOME
          - SHOP
        reminder:
          type: boolean
          nullable: true
          description: Whether this trigger enables reminders
          example: true
        reminderDelay:
          type: string
          nullable: true
          pattern: ^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$
          description: Delay before sending reminder (ISO-8601 duration format)
          example: PT48H
        arguments:
          type: object
          nullable: true
          description: Additional arguments as JSON object
          example:
            key: value
        createDate:
          type: string
          format: date-time
          description: Creation timestamp
          readOnly: true
        updateDate:
          type: string
          format: date-time
          description: Last update timestamp
          readOnly: true
    ArrayOfCommunications:
      allOf:
      - $ref: '#/components/schemas/Pagination'
      - type: object
        properties:
          communications:
            type: array
            items:
              $ref: '#/components/schemas/Communication'
  responses:
    BadRequest:
      description: Response for client error when some field in the request is missing
        or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Errors'
    InternalServerError:
      description: Response when an internal or unexpected error occurs.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Errors'
    NewOrderSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreateOrder'
    GetOrderByIdSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Order'
    NewCancellationRequestSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CancellationRequest'
    ConfirmDeliverySuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DeliveryConfirmationRequest'
    ReservationSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ReservationCreateResponse'
    ReservationUpdateSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ReservationStatus'
    GetOrderProductsSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ArrayOfProductWithExpedition'
    GetOrderProductSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ProductWithExpedition'
    GetOrderDocumentsSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ArrayOfDocuments'
    GetOrderDocumentSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DocumentWithUrl'
    GetOrderCommunicationsSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ArrayOfOrderCommunications'
    SingDocumentsSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SignDocumentsResponse'
    GetOrderSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ArrayOfOrders'
    StockSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ArrayOfStockItem'
    NewPickupSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Pickup'
    ReverseNewCancellationRequestSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ReverseCancellationRequest'
    GetPickupsSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ArrayOfPickups'
    GetPickupProductsSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ArrayOfProductWithExpedition'
    GetPickupProductSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ProductWithExpedition'
    GetPickupCommunicationsSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ArrayOfOrderCommunications'
    NewSwapSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreateSwapResponse'
    GetSwaps:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ArrayOfSwaps'
    GetSwapById:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Swap'
    GetSwapProducts:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ArrayOfSwapProductWithExpedition'
    GetSwapProductById:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ProductWithExpedition'
    GetExpeditionsSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ArrayOfExpeditions'
    GetExpeditionSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Expedition'
    Success:
      description: Success
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: number
              subcode:
                type: number
              message:
                type: string
          example:
            code: 0
            subcode: 0
            message: Operation executed correctly.
    GetObsolescencesSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ArrayOfObsolescences'
    GetCommunicationsSuccess:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ArrayOfCommunications'
  securitySchemes:
    AuthnTokenMasLogistics:
      type: http
      scheme: bearer
      bearerFormat: JWT
