openapi: 3.0.3
info:
  title: Stock API
  description: I am stock API.
  contact:
    name: MasLogistics Squad
    email: mas_logistics@masmovil.com
  version: 1.8.11
servers:
  - url: 'https://logistics-stock.sta.masstack.com/v1/'
    description: Staging
  - url: 'https://logistics-stock.masstack.com/v1/'
    description: Production
tags:
  - name: Base products
    description: Operations to get base products
  - name: Products
    description: Operations to get products
  - name: Characteristics
    description: Operations to get characteristics
  - name: Delivery commitment
    description: Operations to get delivery commitment
  - name: Inputs
    description: Operations with inputs
  - name: Input Types
    description: Operations with input types
  - name: Outputs
    description: Operations with outputs
  - name: Output Types
    description: Operations with output types
  - name: Stock
    description: Operations with stock
  - name: Physical Warehouse
    description: Operations with physical warehouse
  - name: Virtual Warehouse
    description: Operations with virtual warehouse
  - name: Returns
    description: Operations with returns
  - name: Devices
    description: Operations with devices
paths:
  /orgs/{orgId}/base_products:
    post:
      tags:
        - Base products
      summary: Insert a base product
      description: Insert a base product
      operationId: 'insertBaseProduct'
      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 insert a base product
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProductBaseDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductBaseDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/base_products/search:
    post:
      tags:
        - Base products
      summary: Get a list of base products searched
      description: Get a list of all existing base products with the query search, can search by any parameters in a base product, its necessary at leaste one query parameter
      operationId: 'searchBaseProducts'
      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 update a base product
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchProductBaseDto'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ProductBaseDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/base_products/{baseId}:
    get:
      tags:
        - Base products
      summary: Get base product by product base id
      description: Get a base products with their characteristics searching by product base id
      operationId: 'getBaseProduct'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: baseId
          in: path
          description: product base id
          required: true
          schema:
            type: integer
            minimum: 1
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ProductBaseDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    put:
      tags:
        - Base products
      summary: Update a base product by its id
      description: Update a base product by its id
      operationId: 'updateBaseProduct'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: baseId
          in: path
          description: Base product id to update
          required: true
          schema:
            type: integer
          example: 1
      requestBody:
        description: Information needed to update a base product
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProductBaseDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductBaseDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/base_products/{baseId}/characteristics:
    post:
      tags:
        - Characteristics
      summary: Add characteristics to a base product
      description: Add characteristics to a base product
      operationId: 'createBaseProductCharacteristic'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: baseId
          in: path
          description: product base id
          required: true
          schema:
            type: integer
      requestBody:
        description: Characteristics to add
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/Characteristic'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: result of the operation
                    example: "2 characteristics updated"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    delete:
      tags:
        - Characteristics
      summary: Delete base product characteristics
      description: Delete base product characteristics
      operationId: 'deleteBaseProductCharacteristics'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: baseId
          in: path
          description: product base id
          required: true
          schema:
            type: integer
      requestBody:
        description: Characteristics to delete
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/Characteristic'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: result of the operation
                    example: "2 characteristics updated"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/base_products/{baseId}/products:
    post:
      tags:
        - Products
      summary: Insert a product
      description: Insert a product asssociated to base product id
      operationId: 'createProduct'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: baseId
          in: path
          description: base product id
          required: true
          schema:
            type: integer
            minimum: 1
          example: 1
      requestBody:
        description: Information needed to insert a product
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProductDto'
        required: true
      responses:
        201:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    get:
      tags:
        - Products
      summary: Get product by product base id
      description: Get a list of all existing products with their characteristics
      operationId: 'getProducts'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: baseId
          in: path
          description: product base id
          required: true
          schema:
            type: string
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  products:
                    type: array
                    items:
                      $ref: '#/components/schemas/ProductDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/base_products/products/search:
    post:
      tags:
        - Products
      summary: Get a list of all existing products searched
      description: Get a list of all existing products with the query search, can search by any parameters in a product, its necessary at least one query parameter
      operationId: 'searchProducts'
      requestBody:
        description: Information needed to update a base product
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchProductDto'
      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:
            $ref: '#/components/schemas/ProductSortEnum'
          example: STATUS
        - name: grouped
          in: query
          description: Group value, multiple values allowed, separte with coma
          required: false
          schema:
            $ref: '#/components/schemas/ProductSortEnum'
          example: STATUS
        - name: order
          in: query
          description: Sorting order
          required: false
          schema:
            $ref: '#/components/schemas/SortEnum'
          example: ASC
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedProductDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/base_products/{baseId}/products/{productId}:
    get:
      tags:
        - Products
      summary: Get a concrete product with its characteristics.
      description: Get a concrete product with its characteristics. If bundle retrieves bundle info.
      operationId: 'getProduct'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: baseId
          in: path
          description: product base id
          required: true
          schema:
            type: integer
        - name: productId
          in: path
          description: product id
          required: true
          schema:
            type: integer
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    put:
      tags:
        - Products
      summary: Update a product by its id and its base productId
      description: Update a product by its id and its base productId
      operationId: 'updateProduct'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: baseId
          in: path
          description: Base product id to update
          required: true
          schema:
            type: string
          example: 1
        - name: productId
          in: path
          description: Product id to update
          required: true
          schema:
            type: string
          example: 1
      requestBody:
        description: Information needed to update a product
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateProductDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/base_products/{baseId}/products/{productId}/characteristics:
    post:
      tags:
        - Characteristics
      summary: Add characteristics to a product
      description: Add characteristics to a product
      operationId: 'createProductCharacteristic'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: baseId
          in: path
          description: product base id
          required: true
          schema:
            type: integer
        - name: productId
          in: path
          description: product id
          required: true
          schema:
            type: integer
      requestBody:
        description: Characteristics to add
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/Characteristic'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: result of the operation
                    example: "2 characteristics updated"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    delete:
      tags:
        - Characteristics
      summary: Delete product characteristics
      description: Delete product characteristics
      operationId: 'deleteProductCharacteristics'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: baseId
          in: path
          description: product base id
          required: true
          schema:
            type: integer
        - name: productId
          in: path
          description: product id
          required: true
          schema:
            type: integer
      requestBody:
        description: Characteristics to delete
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/Characteristic'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: result of the operation
                    example: "2 characteristics updated"
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/base_products/{baseId}/products/{productId}/delivery_commitment:
    get:
      tags:
        - Delivery commitment
      summary: Get the default commitment for orders from the provider.
      description: Get the default commitment for orders from the provider.If provider not specified, gives all commitments from all providers for that product.
      operationId: 'getProductDeliveryCommitment'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: baseId
          in: path
          description: product base id
          required: true
          schema:
            type: integer
        - name: productId
          in: path
          description: product id
          required: true
          schema:
            type: integer
        - name: providerId
          in: query
          description: status
          required: false
          schema:
            type: integer
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DeliveryCommitmentDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/inputs:
    post:
      tags:
        - Inputs
      summary: Insert an input.
      description: Insert an input.
      operationId: 'createInput'
      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 insert a input
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInputDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InputDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    get:
      tags:
        - Inputs
      summary: Get input by params and/or date ranges.
      description: Get input by params and/or date ranges.
      operationId: 'getInputs'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: 'yoigo'
        - name: product
          in: query
          description: Product id
          required: false
          schema:
            type: integer
          example: 1
        - name: from
          in: query
          description: Initial week to search for, in wwyyyy format
          required: false
          schema:
            type: string
          example: '012022'
        - name: to
          in: query
          description: Final week to search for, in wwyyyy format
          required: false
          schema:
            type: string
          example: '522022'
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
          example: 1
        - name: size
          in: query
          description: Page size for pagination
          required: false
          schema:
            type: integer
          example: 10
        - name: type
          in: query
          description: input type
          required: false
          explode: false
          schema:
            type: array
            items:
              type: integer
          example: [ 1,2,3 ]
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/InputDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/inputtypes:
    get:
      tags:
        - Input Types
      summary: Get the input types info.
      description: Get all entries related to input types.
      operationId: 'getInputTypes'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/InputTypesDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/inputs/{inputId}:
    get:
      tags:
        - Inputs
      summary: Get an input by its id.
      description: Get an input by its id.
      operationId: 'getInput'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: inputId
          in: path
          description: input id to update
          required: true
          schema:
            type: integer
          example: 1
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InputDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    put:
      tags:
        - Inputs
      summary: Update an input by its id.
      description: Update an input by its id. The json must contain the full object with all attributes except input_id
      operationId: 'updateInput'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: inputId
          in: path
          description: input id to update
          required: true
          schema:
            type: integer
          example: 1
      requestBody:
        description: Input dto
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateInputDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InputDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/inputs/details:
    post:
      tags:
        - Inputs
      summary: Insert multiple device with details.
      description: Insert multiple device with details.
      operationId: 'createInputWithDetails'
      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 insert a device
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InputDeviceWithDetailsRequestDto'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DeviceDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/inputs/search:
    post:
      tags:
        - Inputs
      summary: Search inputs.
      description: Get a list of all existing inputs with the query search , can be search by any parameters in an input, at least one parameter is needed to search
      operationId: 'searchInputs'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
          example: 1
        - name: size
          in: query
          description: Page size for pagination
          required: false
          schema:
            type: integer
          example: 10
      requestBody:
        description: At least one of the next parameters in needed to search an input
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InputDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/InputDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/outputs/search:
    post:
      tags:
        - Outputs
      summary: Get a list of outputs
      description: Get a list of all outputs with the query search, can search by any parameters in a output, its necessary at least one query parameter
      operationId: 'searchOutputs'
      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 search an output
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OutputDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AllOutputs'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/outputs/grouped:
    get:
      tags:
        - Outputs
      summary: Find outputs grouped.
      description: Get a list of all existing outputs grouped by product, warehouse and day
      operationId: 'getOutputsGrouped'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: by
          in: query
          description: Grouping option. Valid options are {product_id_and_vwarehouse_id}
          required: true
          schema:
            type: string
          example: product_id_and_vwarehouse_id
        - name: page
          in: query
          description: Page number for pagination, page and size must be used together
          required: false
          schema:
            type: integer
          example: 1
        - name: size
          in: query
          description: Page size for pagination, page and size must be used together
          required: false
          schema:
            type: integer
          example: 10
        - name: from
          in: query
          description: Initial date in iso format, from and to must be used together
          required: false
          schema:
            type: string
          example: '2025-05-05'
        - name: to
          in: query
          description: Final date in iso format, from and to must be used together
          required: false
          schema:
            type: string
          example: '2025-05-05'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OutputsByProductAndWarehouseResponseDtoList'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/outputs:
    post:
      tags:
        - Outputs
      summary: Insert an output
      description: Insert an output
      operationId: 'createOutput'
      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 insert an output
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOutputDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OutputDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    get:
      tags:
        - Outputs
      summary: Get outputs by query params.
      description: Get outputs by query params
      operationId: 'getOutputs'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: product
          in: query
          description: product id
          required: false
          schema:
            type: integer
          example: 1
        - name: from
          in: query
          description: initial week in a year
          required: false
          schema:
            type: string
          example: "012022"
        - name: to
          in: query
          description: final week in a year
          required: false
          schema:
            type: string
          example: "102022"
        - name: type
          in: query
          description: output type
          required: false
          explode: false
          schema:
            type: integer
          example: 1
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AllOutputs'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/outputtypes:
    get:
      tags:
        - Output Types
      summary: Get the output types info.
      description: Get all entries related to output types.
      operationId: 'getOutputTypes'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/OutputTypesDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/outputs/{outputId}:
    get:
      tags:
        - Outputs
      summary: Get an output by its id
      description: Get an output by its id
      operationId: 'getOutput'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: outputId
          in: path
          description: Output id to update
          required: true
          schema:
            type: integer
            minimum: 1
          example: 1
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OutputDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    put:
      tags:
        - Outputs
      summary: Update an output by its id
      description: Update an output by its id
      operationId: 'updateOutput'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: outputId
          in: path
          description: Output id to update
          required: true
          schema:
            type: integer
            minimum: 1
          example: 1
      requestBody:
        description: Input dto
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateOutputDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OutputDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/stock:
    get:
      tags:
        - Stock
      summary: Get stock by date.
      description: Get stock by date.
      operationId: 'getStocks'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: 'yoigo'
        - name: date
          in: query
          description: Date
          required: true
          schema:
            type: string
          example: '2022-09-24'
        - name: references
          in: query
          description: References separated by comma
          schema:
            type: string
          example: 'REF1,REF2'
        - name: vwarehouseIds
          in: query
          description: Virtual warehouse ids separated by comma
          schema:
            type: string
          example: '1,2'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/StockDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    post:
      tags:
        - Stock
      summary: Insert a stock's item.
      description: Insert a stock's item.
      operationId: 'createStock'
      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 insert a stock's item
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateStockDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StockDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/pwarehouse:
    get:
      tags:
        - Physical Warehouse
      summary: Get all physical warehouse.
      description: Get all entries related to physical warehouse.
      operationId: 'getPhysicalWarehouses'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AllPhysicalWarehouse'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    post:
      tags:
        - Physical Warehouse
      summary: Insert a physical warehouse.
      description: Insert a physical warehouse.
      operationId: 'createPhysicalWarehouse'
      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 insert a physical warehouse
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePhysicalWarehouseDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhysicalWarehouseDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/pwarehouse/{id}:
    get:
      tags:
        - Physical Warehouse
      summary: Get a physical warehouse with its id.
      description: Get all entries related to physical warehouse.
      operationId: 'getPhysicalWarehouse'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: id
          in: path
          description: warehouse id
          required: true
          schema:
            type: integer
          example: 1
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhysicalWarehouseAndCharacteristicsDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/pwarehouse/{pWarehouseId}/vwarehouse:
    post:
      tags:
        - Virtual Warehouse
      summary: Insert a virtual warehouse from a physical warehouse id.
      description: Insert a virtual warehouse from a physical warehouse id.
      operationId: 'createVirtualWarehouse'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: pWarehouseId
          in: path
          description: Physical warehouse id
          required: true
          schema:
            type: integer
          example: 1
      requestBody:
        description: Information needed to insert a virtual warehouse
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateVirtualWarehouseDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualWarehouseDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    get:
      tags:
        - Virtual Warehouse
      summary: Get a virtual warehouse from physical warehouse id.
      description: Get all virtual warehouse related to physical warehouse id.
      operationId: 'getVirtualWarehouses'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: pWarehouseId
          in: path
          description: Physical warehouse id
          required: true
          schema:
            type: integer
          example: 1
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualWarehouseReceptorsDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/pwarehouse/{pWarehouseId}/vwarehouse/{vWarehouseId}:
    get:
      tags:
        - Virtual Warehouse
      summary: Get a concrete virtual warehouse from physical warehouse id.
      description: Get a concrete virtual warehouse from physical warehouse id.
      operationId: 'getVirtualWarehouse'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: pWarehouseId
          in: path
          description: Physical warehouse id
          required: true
          schema:
            type: integer
          example: 1
        - name: vWarehouseId
          in: path
          description: Virtual warehouse id
          required: true
          schema:
            type: integer
          example: 1
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualWarehouseReceptorDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/vwarehouse/search:
    post:
      tags:
        - Virtual Warehouse
      summary: Search virtual warehouse.
      description: Search virtual warehouse from multiple parameters.
      operationId: 'searchVirtualWarehouse'
      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 insert a virtual warehouse
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VirtualWarehouseDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/VirtualWarehouseDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/providers:
    get:
      tags:
        - Providers
      summary: Get providers
      description: Get providers
      operationId: 'getProviders'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: 'yoigo'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ProviderDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/logisticsOperator:
    get:
      tags:
        - Logistic Operators
      summary: Get Logistic Operators
      description: Get Logistic Operators
      operationId: 'getLogisticOperators'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: 'yoigo'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/LogisticsOperatorDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/commercialbrands:
    get:
      tags:
        - Commercial Brands
      summary: Get the commercial brands.
      description: Get all commercial brands.
      operationId: 'getCommercialBrands'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CommercialBrandsDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/status:
    get:
      tags:
        - Status
      summary: Get the statuses.
      description: Get all statuses.
      operationId: 'getStatuses'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/StatusDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/categories:
    get:
      tags:
        - Categories
      summary: Get the categories info.
      description: Get all entries related to categories and their families.
      operationId: 'getCategories'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CategoryDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/purposes:
    get:
      tags:
        - Purposes
      summary: Get the purposes info.
      description: Get all entries related to purposes.
      operationId: 'getPurposes'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PurposeDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/regions:
    get:
      tags:
        - Regions
      summary: Get the regions info.
      description: Get all entries related to regions.
      operationId: 'getRegions'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RegionDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/countries:
    get:
      tags:
        - Countries
      summary: Get the countries info.
      description: Get all entries related to countries.
      operationId: 'getCountries'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CountryDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/receptors:
    get:
      tags:
        - Receptors
      summary: Get the receptors info.
      description: Get all entries related to receptors.
      operationId: 'getReceptors'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ReceptorsDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/characteristics-values:
    get:
      tags:
        - Characteristics Values
      summary: Get characteristics values.
      description: Get characteristics values.
      operationId: 'getCharacteristicsValues'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: 'yoigo'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CharacteristicsValuesDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/saleschannels:
    get:
      tags:
        - Sales Channel
      summary: Get sales channels
      description: Get sales channels
      operationId: 'getSalesChannels'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: 'yoigo'
      responses:
        200:
          description: success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SalesChannelDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/tenantGroupBrand:
    get:
      tags:
        - Tenant group brand
      summary: Get all brands.
      description: Get all brands.
      operationId: 'getTenantGroupBrand'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: masmovil
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TenantGroupBrandDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/returns:
    get:
      tags:
        - Returns
      summary: Get returns
      description: Get returns with sales channel, product, virtual warehouse and return reason, includes search between dates, id and pagination.
      operationId: 'getReturns'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: 'yoigo'
        - name: id
          in: query
          description: returns id
          required: false
          schema:
            type: integer
          example: 1
        - name: from
          in: query
          description: Initial week to search for, in wwyyyy format
          required: false
          schema:
            type: string
          example: '012022'
        - name: to
          in: query
          description: Final week to search for, in wwyyyy format
          required: false
          schema:
            type: string
          example: '522022'
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
          example: 1
        - name: size
          in: query
          description: Page size for pagination
          required: false
          schema:
            type: integer
          example: 10
      responses:
        200:
          description: success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ReturnsDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    post:
      tags:
        - Returns
      summary: Insert a return.
      description: Insert a return.
      operationId: 'createReturn'
      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 insert a return
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateReturnDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnsDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/returns/search:
    post:
      tags:
        - Returns
      summary: Search returns.
      description: Search return by any parameter included in request body example, at least one parameter is needed to search.
      operationId: 'searchReturns'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
          example: 1
        - name: size
          in: query
          description: Page size for pagination
          required: false
          schema:
            type: integer
          example: 10
      requestBody:
        description: At least one of the next parameters in needed to search an input
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateReturnDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ReturnsDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/returns/{returnId}:
    get:
      tags:
        - Returns
      summary: Get a return by its id.
      description: Get an output by its id.
      operationId: 'getReturn'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: returnId
          in: path
          description: Return id
          required: true
          schema:
            type: integer
            minimum: 1
          example: 1
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnsDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    put:
      tags:
        - Returns
      summary: Update a return.
      description: Update a return.
      operationId: 'updateReturn'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: returnId
          in: path
          description: Return id
          required: true
          schema:
            type: integer
            minimum: 1
          example: 123
      requestBody:
        description: Information needed to update a return
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateReturnDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnsDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/device/{deviceId}:
    get:
      tags:
        - Devices
      summary: Get device by the deviceId
      description: Get device by the deviceId
      operationId: 'getDevice'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: 'yoigo'
        - name: deviceId
          in: path
          description: Identifier of the device
          required: true
          schema:
            type: integer
            format: int64
          example: 1
      responses:
        200:
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/device:
    get:
      tags:
        - Devices
      summary: Get device by any identifier
      description: Get device by any identifier
      operationId: 'getDevices'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: 'yoigo'
        - name: identifier
          in: query
          description: The imei or the device serial number
          required: true
          schema:
            type: string
          example: '867379061165148'
        - name: identifierType
          in: query
          description: The type of identifier provided
          schema:
            type: string
            enum: [ 'IMEI', "SERIALNUMBER" ]
          example: 'IMEI'
      responses:
        200:
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    post:
      tags:
        - Devices
      summary: Insert a device.
      description: Insert a device.
      operationId: 'createDevice'
      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 insert a device
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceDto'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    put:
      tags:
        - Devices
      summary: Update a device.
      description: Update a device.
      operationId: 'updateDevice'
      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 update a device
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/device/search:
    post:
      tags:
        - Devices
      summary: Search a device.
      description: Search a device by multiple params.
      operationId: 'searchDevice'
      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 to search a device
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceDto'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DeviceDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/organizations:
    get:
      tags:
        - Organizations
      summary: Get the organizations info.
      description: Get all entries related to organizations.
      operationId: 'getOrganizations'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/OrganizationDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/sap_ordering/search:
    post:
      tags:
        - Sap Ordering
      summary: Get a list of sap ordering searched
      description: Get a list of all existing sap ordering with the query search, can search by any parameters in a sap ordering, its necessary at leaste one query parameter
      operationId: 'searchSapOrdering'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
          example: 1
        - name: size
          in: query
          description: Page size for pagination
          required: false
          schema:
            type: integer
          example: 10
        - name: sort
          in: query
          description: Sort by a field
          required: false
          schema:
            type: string
          example: 'sapOrderingId'
        - name: order
          in: query
          description: Order by a field
          required: false
          schema:
            type: string
            enum: [ 'ASC', 'DESC' ]
          example: 'ASC'
        - name: group
          in: query
          description: Group by a field
          required: false
          schema:
            type: string
          example: 'sapOrderingId'
      requestBody:
        description: Information needed to search a sap ordering
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SapOrderingDto'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedSapOrderingDtos'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
  /orgs/{orgId}/report_importer:
    get:
      tags:
        - Report importer
      summary: Get all report importer details
      description: Get all report importer details
      operationId: 'getReportImporters'
      parameters:
        - name: orgId
          in: path
          description: Organization name as it is registered in mas-stack
          required: true
          schema:
            type: string
          example: yoigo
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ReportImporterDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    post:
      tags:
        - Report importer
      summary: Create a report importer
      description: Create a report importer
      operationId: 'createReportImporter'
      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 report importer
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReportImporterDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportImporterDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
    put:
      tags:
        - Report importer
      summary: Update a report importer
      description: Update a report importer
      operationId: 'updateReportImporter'
      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 update a report importer
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReportImporterDto'
        required: true
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportImporterDto'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        404:
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
components:
  schemas:
    ProductBaseDto:
      type: object
      required:
        - name
        - commercialBrand
        - category
        - puchasePrice
        - purchaseCurrency
      properties:
        productBaseId:
          type: integer
          example: 1
        name:
          type: string
          minLength: 1
          maxLength: 100
          example: Smartphone
        commercialBrand:
          type: integer
          example: 53
        category:
          type: integer
          example: 5
        vatTax:
          type: number
          example: 2.5
        digitalCanon:
          type: number
          example: 1.3
        unitsInPalet:
          type: integer
          example: 1500
        unitsInBox:
          type: integer
          example: 5
        eolDate:
          type: string
          format: date
          example: "2021-09-24"
        substitute:
          type: string
          minLength: 0
          maxLength: 50
          example: mobile2
        swapsRate:
          type: number
          example: 1.5
        billingCategory:
          type: string
          minLength: 0
          maxLength: 15
          example: sim
        organization:
          type: string
          example: "MM"
        characteristics:
          $ref: '#/components/schemas/CharacteristicValuesProductDto'
    CreateProductBaseDto:
      type: object
      required:
        - name
        - commercialBrand
        - category
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 50
          example: Smartphone
        commercialBrand:
          type: integer
          minimum: 1
          example: 53
        category:
          type: integer
          minimum: 1
          example: 5
        vatTax:
          type: number
          example: 2.5
        digitalCanon:
          type: number
          example: 1.3
        unitsInPalet:
          type: integer
          example: 1500
        unitsInBox:
          type: integer
          example: 5
        eolDate:
          type: string
          format: date
          example: "2021-09-24"
        substitute:
          type: string
          minLength: 0
          maxLength: 50
          example: mobile2
        swapsRate:
          type: number
          example: 1.5
        billingCategory:
          type: string
          minLength: 0
          maxLength: 15
          example: sim
        organization:
          type: string
          example: "MM"
    SearchProductBaseDto:
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
          example: Smartphone
        commercialBrand:
          type: integer
          example: 53
        category:
          type: integer
          example: 5
        vatTax:
          type: number
          example: 2.5
        digitalCanon:
          type: number
          example: 1.3
        unitsInPalet:
          type: integer
          example: 1500
        unitsInBox:
          type: integer
          example: 5
        eolDate:
          type: string
          format: date
          example: "2021-09-24"
        substitute:
          type: string
          minLength: 0
          maxLength: 50
          example: mobile2
        swapsRate:
          type: number
          example: 1.5
        billingCategory:
          type: string
          minLength: 0
          maxLength: 15
          example: sim
        organization:
          type: string
          example: "MM"
    ProductDto:
      type: object
      properties:
        productId:
          type: integer
          example: 1
        productBase:
          $ref: '#/components/schemas/ProductBaseDtoWithReferences'
        status:
          $ref: '#/components/schemas/StatusDto'
        isbundle:
          type: boolean
          example: false
        phReference:
          type: string
          minLength: 0
          maxLength: 50
          example: 2
        upcEan:
          type: string
          minLength: 0
          maxLength: 50
          example: 2
        partnumber:
          type: string
          minLength: 0
          maxLength: 50
          example: 1
        releaseDate:
          type: string
          format: date
          example: "2021-09-24"
        retireDate:
          type: string
          format: date
          example: "2021-09-24"
        sapOrderingAux:
          $ref: '#/components/schemas/SapOrderingDto'
        retrievable:
          type: boolean
          example: true
        name:
          type: string
          example: Smartphone
          minLength: 1
          maxLength: 60
        purpose:
          $ref: '#/components/schemas/PurposeDto'
        inwarehousePrice:
          type: number
          example: 0.0
        reference:
          type: string
          example: 'REF223'
        currency:
          type: string
          example: 'EUR'
        phPrice:
          type: number
          example: 123.90
        purchasePrice:
          type: number
          example: 12.90
        createdDate:
          type: string
          format: date
          example: "2021-09-24"
        updatedDate:
          type: string
          format: date
          example: "2021-09-24"
        bundle:
          type: array
          items:
            $ref: '#/components/schemas/BundleDto'
        stockProperty:
          type: string
          enum: ["Propiedad", "Cesión", "Consigna"]
    CreateProductDto:
      type: object
      required:
        - name
        - status
        - isbundle
        - sapOrderingAux
      properties:
        name:
          type: string
          example: Smartphone
          minLength: 1
          maxLength: 60
        status:
          type: integer
          example: 1
        isbundle:
          type: boolean
          example: false
        phReference:
          type: string
          minLength: 0
          maxLength: 50
          example: 2
        upcEan:
          type: string
          minLength: 0
          maxLength: 50
          example: 2
        partnumber:
          type: string
          minLength: 0
          maxLength: 50
          example: 1
        releaseDate:
          type: string
          format: date
          example: "2021-09-24"
        retireDate:
          type: string
          format: date
          example: "2021-09-24"
        sapOrderingAux:
          $ref: '#/components/schemas/SapOrderingDto'
        retrievable:
          type: boolean
          example: true
        purchasePrice:
          type: number
          example: 180.5
        phPrice:
          type: number
          example: 24.99
        reference:
          type: string
          minLength: 1
          maxLength: 50
          example: reference
        inwarehousePrice:
          type: number
          example: 50.5
        currency:
          type: string
          minLength: 3
          maxLength: 3
          example: EUR
        purpose:
          type: integer
          example: 1
        productsInBundle:
          type: array
          items:
            $ref: '#/components/schemas/CreateBundleDto'
        stockProperty:
          type: string
          enum: ["Propiedad", "Cesión", "Consigna"]
    SearchProductDto:
      type: object
      properties:
        productId:
          type: integer
          example: 1
        productBaseId:
          type: integer
          example: 1
        name:
          type: string
          example: Smartphone
          minLength: 1
          maxLength: 60
        status:
          type: integer
          example: 1
        isbundle:
          type: boolean
          example: false
        phReference:
          type: string
          minLength: 0
          maxLength: 50
          example: 2
        upcEan:
          type: string
          minLength: 0
          maxLength: 50
          example: 2
        partNumber:
          type: string
          minLength: 0
          maxLength: 50
          example: 1
        releaseDate:
          type: string
          format: date
          example: "2021-09-24"
        retireDate:
          type: string
          format: date
          example: "2021-09-24"
        sapOrderingAuxId:
          type: integer
          example: 10
        retrievable:
          type: boolean
          example: true
        purchasePrice:
          type: number
          example: 180.5
        phPrice:
          type: number
          example: 24.99
        reference:
          type: string
          minLength: 1
          maxLength: 50
          example: reference
        inwarehousePrice:
          type: number
          example: 50.5
        currency:
          type: string
          minLength: 3
          maxLength: 3
          example: EUR
        purpose:
          type: integer
          example: 1
        stockProperty:
          type: string
          enum: ["Propiedad", "Cesión", "Consigna"]
    UpdateProductDto:
      type: object
      required:
        - name
        - status
        - isbundle
        - sapOrderingAux
      properties:
        name:
          type: string
          example: Smartphone
          minLength: 1
          maxLength: 60
        status:
          type: integer
          example: 1
        isbundle:
          type: boolean
          example: false
        phReference:
          type: string
          minLength: 0
          maxLength: 50
          example: 2
        upcEan:
          type: string
          minLength: 0
          maxLength: 50
          example: 2
        partnumber:
          type: string
          minLength: 0
          maxLength: 50
          example: 1
        releaseDate:
          type: string
          format: date
          example: "2021-09-24"
        retireDate:
          type: string
          format: date
          example: "2021-09-24"
        sapOrderingAux:
          $ref: '#/components/schemas/SapOrderingDto'
        retrievable:
          type: boolean
          example: true
        purchasePrice:
          type: number
          example: 180.5
        phPrice:
          type: number
          example: 24.99
        reference:
          type: string
          minLength: 1
          maxLength: 50
          example: reference
        inwarehousePrice:
          type: number
          example: 50.5
        currency:
          type: string
          minLength: 3
          maxLength: 3
          example: EUR
        purpose:
          type: integer
          example: 1
        productsInBundle:
          items:
            $ref: '#/components/schemas/BundleDto'
          type: array
        stockProperty:
          type: string
          enum: ["Propiedad", "Cesión", "Consigna"]
    PaginatedProductDto:
      allOf:
        - $ref: '#/components/schemas/PaginationResponse'
        - type: object
          properties:
            products:
              type: array
              items:
                $ref: '#/components/schemas/ProductDto'
    DeliveryCommitmentDto:
      type: object
      properties:
        productId:
          type: integer
          example: 1
        providerId:
          type: integer
          example: 1
        minWeeks:
          type: integer
          example: 10
        maxWeeks:
          type: integer
          example: 1
        deliveryWeeks:
          type: integer
          example: 2
    BundleDto:
      type: object
      properties:
        bundleId:
          type: integer
          example: 1
        productId:
          type: integer
          example: 1
        quantity:
          type: integer
          example: 1
    CreateBundleDto:
      type: object
      properties:
        productId:
          type: integer
          example: 1
        quantity:
          type: integer
          example: 1
    Characteristic:
      type: object
      required:
        - name
        - value
      properties:
        name:
          type: string
          example: Color
        value:
          type: string
          example: Blue
    CommercialBrandsDto:
      type: object
      properties:
        commercialBrandId:
          type: integer
          example: 1
        name:
          type: string
          example: Alcatel
        contactInfoId:
          type: integer
          example: 1
    StatusDto:
      type: object
      properties:
        statusId:
          type: integer
          example: 1
        name:
          type: string
          example: status
    PurposeDto:
      type: object
      properties:
        purposeId:
          type: integer
          example: 1
        name:
          type: string
          example: purpose
    InputTypesDto:
      type: object
      properties:
        typeId:
          type: integer
          example: 1
        description:
          type: string
          example: description
    RegionDto:
      type: object
      properties:
        regionId:
          type: integer
          example: 1
        name:
          type: string
          example: region
    CountryDto:
      type: object
      properties:
        countryIso:
          type: string
          example: ES
    ReceptorsDto:
      type: object
      properties:
        receptorId:
          type: integer
          example: 1
        name:
          type: string
          example: receptor
    OutputTypesDto:
      type: object
      properties:
        typeId:
          type: integer
          example: 1
        description:
          type: string
          example: type
    CategoryDto:
      type: object
      properties:
        categoryId:
          type: integer
          example: 1
        family:
          $ref: '#/components/schemas/FamilyDto'
        subfamily:
          type: string
          example: subfamily
    FamilyDto:
      type: object
      properties:
        familyId:
          type: integer
          example: 1
        name:
          type: string
          example: family
    InputDto:
      properties:
        inputId:
          type: integer
          minimum: 1
          example: 1
        reference:
          type: string
          example: 1
        productId:
          type: integer
          example: 1
        amount:
          type: integer
          example: 10
        orderId:
          type: string
          example: "1234ABCD"
        orderPositionId:
          type: integer
          example: 1
        inputDate:
          type: string
          format: date
          example: "2021-09-24"
        orderOlId:
          type: string
          minLength: 1
          maxLength: 50
          example: 1
        inWarehousePrice:
          type: number
          example: 50.5
        courierBill:
          type: string
          example: 10
        billId:
          type: string
          example: "12ABC"
        receptionDate:
          type: string
          format: date
          example: "2021-09-24"
        incident:
          type: boolean
          example: true
        facturable:
          type: boolean
          example: false
        inWareHousePriceCurrency:
          type: string
          minLength: 0
          maxLength: 50
          example: eu
        type:
          type: string
          example: 1
        ean:
          type: string
          example: 1
        billableCompany:
          type: string
          example: 1
        pWarehouseId:
          type: integer
          example: 1
        comments:
          type: string
          example: "comments"
    UpdateInputDto:
      allOf:
        - $ref: '#/components/schemas/InputDto'
        - type: object
          required:
            - productId
            - pWarehouseId
            - amount
            - inputDate
            - orderOlId
            - inWarehousePrice
          properties: { }
    CreateInputDto:
      type: object
      required:
        - pWarehouseId
        - amount
        - inputDate
        - orderOlId
        - inWarehousePrice
      properties:
        reference:
          type: string
          example: 1
        pWarehouseId:
          type: integer
          example: 1
        amount:
          type: integer
          example: 10
        orderId:
          type: string
          example: "1234ABCD"
        orderPositionId:
          type: integer
          example: 1
        inputDate:
          type: string
          format: date
          example: "2021-09-24"
        orderOlId:
          type: string
          minLength: 1
          maxLength: 50
          example: 1
        inWarehousePrice:
          type: number
          example: 50
        courierBill:
          type: string
          example: 10
        billId:
          type: string
          example: "12ABC"
        receptionDate:
          type: string
          format: date
          example: "2021-09-24"
        incident:
          type: boolean
          example: true
          default: false
        facturable:
          type: boolean
          example: false
        inWareHousePriceCurrency:
          type: string
          minLength: 3
          maxLength: 3
          example: EUR
        type:
          type: string
          example: 1
        ean:
          type: string
          example: 112312
        billableCompany:
          type: string
          example: "XFERA"
        comments:
          type: string
          example: "comments"
    OutputsByProductAndWarehouseResponseDto:
      type: object
      properties:
        reference:
          type: string
          example: ABCD123
        productId:
          type: integer
          example: 1
        vwarehouseId:
          type: integer
          example: 10
        amount:
          type: integer
          example: 50
        outputDate:
          type: string
          format: date
          example: "2021-09-24"
    OutputDto:
      type: object
      properties:
        outputId:
          type: integer
          example: 1
        reference:
          type: string
          example: reference
        productId:
          type: integer
          example: 1
        vwarehouseId:
          type: integer
          example: 10
        pWarehouseId:
          type: integer
          example: 10
        amount:
          type: integer
          example: 50
        salesChannel:
          type: integer
          example: 2
        outputDate:
          type: string
          format: date
          example: "2021-09-24"
        regularization:
          type: boolean
          example: true
        type:
          type: integer
          example: 2
        salesType:
          type: string
          example: salesType
        tenantGroupBrand:
          $ref: '#/components/schemas/TenantGroupBrandDto'
        orderId:
          type: string
          example: "1234ABCD"
        inWarehousePrice:
          type: number
          example: 50
        inWarehousePriceCurrency:
          type: string
          minLength: 3
          maxLength: 3
          example: EUR
    CreateOutputDto:
      type: object
      required:
        - tenantGroupBrand
        - vwarehouseId
        - amount
        - outputDate
      properties:
        reference:
          type: string
          maxLength: 50
          example: reference
        vwarehouseId:
          type: integer
          example: 10
        pWarehouseId:
          type: integer
          example: 10
        amount:
          type: integer
          example: 50
        salesChannel:
          type: integer
          example: 2
        tenantGroupBrand:
          type: string
          description: tenant or group band
          example: tenant
        outputDate:
          type: string
          format: date
          example: "2021-09-24"
        regularization:
          type: boolean
          example: true
        type:
          type: integer
          example: 2
        salesType:
          type: string
          maxLength: 20
          example: salesType
        orderId:
          type: string
          example: "1234ABCD"
        inWarehousePrice:
          type: number
          example: 50
        inWarehousePriceCurrency:
          type: string
          minLength: 3
          maxLength: 3
          example: EUR
    UpdateOutputDto:
      allOf:
        - $ref: '#/components/schemas/CreateOutputDto'
        - type: object
          required:
            - productId
          properties:
            productId:
              type: integer
              example: 1
    AllOutputs:
      type: array
      items:
        $ref: '#/components/schemas/OutputDto'
    OutputsByProductAndWarehouseResponseDtoList:
      type: array
      items:
        $ref: '#/components/schemas/OutputsByProductAndWarehouseResponseDto'
    StockDto:
      type: object
      properties:
        stockId:
          type: integer
          example: 1
        productId:
          type: integer
          example: 10
        vwarehouseId:
          type: integer
          example: 56
        totalAmount:
          type: integer
          example: 25
        availableAmount:
          type: integer
          example: 100
        reservedAmount:
          type: integer
          example: 45
        stockDate:
          type: string
          example: 2022-02-20
        reference:
          type: string
          example: reference1
        prepickingOrders:
          type: integer
          example: 10
    CreateStockDto:
      type: object
      properties:
        stockId:
          type: integer
          example: 1
        productId:
          type: integer
          example: 10
        vwarehouseId:
          type: integer
          example: 56
        totalAmount:
          type: integer
          example: 25
        availableAmount:
          type: integer
          example: 100
        reservedAmount:
          type: integer
          example: 45
        stockDate:
          type: string
          example: 2022-02-20
        reference:
          type: string
          example: reference1
        prepickingOrders:
          type: integer
          example: 10
    PhysicalWarehouseDto:
      type: object
      properties:
        pwarehouseId:
          type: integer
          example: 1
        name:
          type: string
          example: name
        logisticOperator:
          type: integer
          example: 1
        regionId:
          type: integer
          example: 1
        country:
          type: string
          example: ES
        address:
          type: string
          example: address
        contactInfoId:
          type: integer
          example: 20
    CreatePhysicalWarehouseDto:
      type: object
      properties:
        name:
          type: string
          example: name
        logisticOperator:
          type: integer
          example: 1
        regionId:
          type: integer
          example: 1
        country:
          type: string
          example: ES
        address:
          type: string
          example: address
        contactInfoId:
          type: integer
          example: 20
    PhysicalWarehouseAndCharacteristicsDto:
      type: object
      properties:
        pwarehouseId:
          type: integer
          example: 1
        name:
          type: string
          example: name
        country:
          type: string
          example: ES
        address:
          type: string
          example: address
        regionName:
          type: string
          example: Peninsula
        logisticOperators:
          $ref: '#/components/schemas/LogisticsOperatorDto'
    LogisticsOperatorDto:
      type: object
      properties:
        logisticOperatorId:
          type: integer
          example: 1
        name:
          type: string
          example: name
        cif:
          type: string
          example: cif
        address:
          type: string
          example: address
        corporateName:
          type: string
          example: corporate
        contactInfo:
          $ref: '#/components/schemas/ContactInfoDto'
    ContactInfoDto:
      type: object
      properties:
        contactInfoId:
          type: integer
          example: 1
        contactName:
          type: string
          example: name
        contactEmail:
          type: string
          example: email
        contactPhone:
          type: string
          example: phone
    AllPhysicalWarehouse:
      type: array
      items:
        $ref: '#/components/schemas/PhysicalWarehouseDto'
    VirtualWarehouseReceptorDto:
      type: object
      properties:
        vwarehouseId:
          type: integer
          example: 1
        name:
          type: string
          example: name
        receptors:
          $ref: '#/components/schemas/ReceptorsDto'
    VirtualWarehouseReceptorsDto:
      type: array
      items:
        $ref: '#/components/schemas/VirtualWarehouseReceptorDto'
    CreateVirtualWarehouseDto:
      type: object
      properties:
        name:
          type: string
          example: name
        receptorId:
          type: integer
          example: 10
    VirtualWarehouseDto:
      type: object
      properties:
        vwarehouseId:
          type: integer
          example: 15
        name:
          type: string
          example: name
        receptorId:
          type: integer
          example: 1
    CharacteristicsValuesDto:
      type: array
      items:
        $ref: '#/components/schemas/CharacteristicsValueDto'
    CharacteristicsValueDto:
      type: object
      properties:
        name:
          type: string
          example: Color
        values:
          type: array
          items:
            type: string
            example: Black, Green
    CharacteristicValuesProductDto:
      type: array
      items:
        type: object
        properties:
          name:
            type: string
            example: Color
          value:
            type: string
            example: Black
    SapOrderingDto:
      type: object
      properties:
        sapOrderingAuxId:
          type: integer
          example: 1
        companyInvoice:
          type: string
          example: company
        productSapCode:
          type: string
          example: 1
        productSapDescription:
          type: string
          example: description
        productSapMaterial:
          type: string
          example: material
        productSapFamilyCode:
          type: string
          example: 1
        providerId:
          type: integer
          example: 1
        supplierToProviderId:
          type: integer
          example: 1
    PaginatedSapOrderingDtos:
      allOf:
        - $ref: '#/components/schemas/PaginationResponse'
        - type: object
          properties:
            sapOrderingDtos:
              type: array
              items:
                $ref: '#/components/schemas/SapOrderingDto'
    SalesChannelDto:
      type: object
      properties:
        id:
          type: integer
          example: 10
        name:
          type: string
          example: txt
        masterChannel:
          type: object
          properties:
            id:
              type: integer
              example: 1
            name:
              type: string
              example: nombre
            direct:
              type: boolean
              example: true
    TenantGroupBrandDto:
      type: object
      properties:
        id:
          type: integer
          example: 10
        name:
          type: string
          example: masmovil
    ReturnsDto:
      type: object
      properties:
        returnId:
          type: integer
          example: 1
        reference:
          type: string
          example: 123456
        product:
          type: object
          properties:
            productId:
              type: integer
              example: 1
            productBaseId:
              type: integer
              example: 1
            status:
              type: integer
              example: 1
            isbundle:
              type: boolean
              example: false
            phReference:
              type: string
              minLength: 0
              maxLength: 50
              example: 2
            upcEan:
              type: string
              minLength: 0
              maxLength: 50
              example: 2
            partnumber:
              type: string
              minLength: 0
              maxLength: 50
              example: 1
            releaseDate:
              type: string
              format: date
              example: "2021-09-24"
            retireDate:
              type: string
              format: date
              example: "2021-09-24"
            sapOrderingAux:
              $ref: '#/components/schemas/SapOrderingDto'
            retrievable:
              type: boolean
              example: true
            name:
              type: string
              example: Smartphone
              minLength: 1
              maxLength: 50
            purpose:
              type: integer
              example: 1
            inwarehousePrice:
              type: number
              example: 50
            reference:
              type: string
              minLength: 1
              maxLength: 50
              example: reference
            currency:
              type: string
              minLength: 3
              maxLength: 3
              example: EUR
            purchasePrice:
              type: number
              example: 180.5
            phPrice:
              type: number
              example: 24.99
        vwarehouse:
          type: object
          properties:
            vwarehouseId:
              type: number
              example: 4
            name:
              type: string
              example: Canarias Yoigo Renove
            receptors:
              type: object
              properties:
                receptorId:
                  type: number
                  example: 6
                name:
                  type: string
                  example: Renove
        amount:
          type: string
          example: '3'
        tenantGroupBrand:
          type: string
          example: de
        returnDate:
          type: string
          example: '2021-02-03'
        returnReason:
          type: object
          properties:
            name:
              type: string
              example: tienda
            description:
              type: string
              example: description
        relatedOrderId:
          type: string
          example: 123654
        salesChannel:
          type: object
          properties:
            id:
              type: number
              example: 10
            name:
              type: string
              example: phone
            masterChannel:
              type: object
              properties:
                id:
                  type: number
                  example: 1
                name:
                  type: string
                  example: aux
                direct:
                  type: boolean
                  example: true
        salesType:
          type: string
          example: 'tipo'
    CreateReturnDto:
      type: object
      properties:
        reference:
          type: string
          example: 123456
        productId:
          type: number
          example: 4
        vwarehouse:
          type: string
          example: 4
        amount:
          type: string
          example: '3'
        tenantGroupBrand:
          type: string
          example: de
        returnDate:
          type: string
          example: '2021-02-03'
        returnReason:
          type: string
          example: tienda
        relatedOrderId:
          type: string
          maxLength: 45
          example: '123654'
        salesChannel:
          type: string
          example: 10
        salesType:
          type: string
          example: 'tipo'
    InputDeviceWithDetailsRequestDto:
      type: object
      properties:
        order_number:
          type: string
          example: '4000003264'
        provider_delivery_id:
          type: string
          minLength: 1
          maxLength: 50
          example: '3'
        input_date:
          type: string
          format: date
          example: '2009-01-13'
        details:
          type: array
          items:
            $ref: '#/components/schemas/InputDetailsDto'
    InputDetailsDto:
      type: object
      properties:
        reference:
          type: string
          example: 'G034W54G2'
        model:
          type: string
          example: 'Samsung Galaxy Watch5 44mm BT Silver'
        color:
          type: string
          example: 'Plata'
        device_type:
          type: string
          example: 'SmartWatch'
        brand:
          type: string
          example: 'Samsung'
        quantity:
          type: integer
          example: 10
        devices:
          type: array
          items:
            $ref: '#/components/schemas/DevicesDetailDto'
    DevicesDetailDto:
      type: object
      properties:
        imei:
          type: string
          example: '864467060074057'
        imei2:
          type: string
          example: '864467060074057'
        serial_number:
          type: string
          example: 'RFAT73D511Z'
    DeviceDto:
      type: object
      properties:
        deviceId:
          type: integer
          format: int64
        imei:
          type: string
          example: '864467060074057'
        imei2:
          type: string
          example: '864467060074057'
        serialNumber:
          type: string
          example: 'RFAT73D511Z'
        brand:
          type: string
          example: 'Samsung'
        model:
          type: string
          example: 'Samsung Galaxy Watch5 44mm BT Silver'
        reference:
          type: string
          example: 'G034W54G2'
        color:
          type: string
          example: 'Plata'
        deviceType:
          type: string
          example: 'SmartWatch'
        orderNumber:
          type: string
          example: '4000003264'
        providerDeliveryId:
          type: string
          minLength: 1
          maxLength: 50
          example: '3'
        loadDate:
          type: string
          format: date
          example: '2009-01-13'
        inputDate:
          type: string
          format: date
          example: '2009-01-13'
        createDate:
          type: string
          format: date
          example: '2009-01-13'
        updateDate:
          type: string
          format: date
          example: '2009-01-13'
    ProductBaseDtoWithReferences:
      type: object
      properties:
        productBaseId:
          type: integer
          example: 1
        name:
          type: string
          minLength: 1
          maxLength: 100
          example: Smartphone
        commercialBrand:
          $ref: '#/components/schemas/CommercialBrandsDto'
        category:
          $ref: '#/components/schemas/CategoryDto'
        vatTax:
          type: number
          example: 2.5
        digitalCanon:
          type: number
          example: 1.3
        unitsInPalet:
          type: integer
          example: 1500
        unitsInBox:
          type: integer
          example: 5
        eolDate:
          type: string
          format: date
          example: "2021-09-24"
        substitute:
          type: string
          minLength: 0
          maxLength: 50
          example: mobile2
        swapsRate:
          type: number
          example: 1.5
        organization:
          type: string
          example: "MM"
        billingCategory:
          type: string
          example: "MM"
        characteristics:
          $ref: '#/components/schemas/CharacteristicValuesProductDto'
    OrganizationDto:
      type: object
      properties:
        organizationId:
          type: string
          example: "MM"
        description:
          type: string
          example: "Mas Movil"
    ProviderDto:
      type: object
      required:
        - providerId
        - name
        - cif
        - address
        - contactInfoId
        - corporateName
      properties:
        providerId:
          type: integer
          example: 1
        name:
          type: string
          minLength: 1
          maxLength: 50
          example: ADOC
        cif:
          type: string
          minLength: 1
          maxLength: 50
        address:
          type: string
          minLength: 1
          maxLength: 50
          example: Direccion
        contactInfoId:
          type: integer
          example: 1
        corporateName:
          type: string
          minLength: 1
          maxLength: 50
        purchaseCentralCode:
          type: string
          example: '2AD'
        wholeSale:
          type: boolean
          example: true
        providerSapCode:
          type: string
          minLength: 1
          maxLength: 50
        contactInfo:
          $ref: '#/components/schemas/ContactInfoDto'
    ReportImporterDto:
      type: object
      properties:
        reportId:
          type: integer
          example: 1
        reportName:
          type: string
          example: "Report name"
        tabName:
          type: string
          example: "Excel tab name"
        lastRead:
          type: integer
          format: int64
          example: 1
        lastExecution:
          type: string
          example: "2021-09-24T00:00:00Z"

    #pagination
    PaginationResponse:
      type: object
      properties:
        pageSize:
          type: integer
          example: 123
          description: 'Page size'
        totalPages:
          type: integer
          example: 10
          description: 'Total pages for page size'
        currentPage:
          type: integer
          example: 1
          description: 'Current page'
        totalElements:
          type: integer
          example: 3000
          description: 'Total element'

    #enums
    ProductSortEnum:
      type: string
      description: "Product sort values"
      enum:
        - "PRODUCT_ID"
        - "PRODUCT_BASE"
        - "STATUS"
        - "BUNDLE"
        - "PH_REFERENCE"
        - "SAP_ORDERING"
        - "RETRIEVABLE"
        - "RETIRE_DATE"
        - "RELEASE_DATE"
        - "PURPOSE"
        - "REFERENCE"
        - "NAME"
    SortEnum:
      type: string
      description: "Sort values"
      enum:
        - "ASC"
        - "DESC"

    #error response
    Error400:
      type: object
      properties:
        code:
          type: integer
          example: 2
        subcode:
          type: integer
          example: 2000
        message:
          type: string
          example: Bad request
    Error404:
      type: object
      properties:
        code:
          type: integer
          example: 4
        subcode:
          type: integer
          example: 4001
        message:
          type: string
          example: Resource not found
    Error500:
      type: object
      properties:
        code:
          type: integer
          example: 5
        subcode:
          type: integer
          example: 5001
        message:
          type: string
          example: Internal server error
  securitySchemes:
    AuthnTokenMasLogistics:
      type: http
      scheme: bearer
      bearerFormat: JWT
security:
  - AuthnTokenMasLogistics: [ ]