openapi: 3.1.0
info:
  title: AbaNinja Warehouse API - Products
  version: 3.0.0
  x-domain-id: warehouse
servers:
  - url: https://api.abaninja.ch
    description: The AbaNinja API server
tags:
  - name: warehouse-products
    description: Manage warehouse products
    x-displayName: Warehouse Products
security:
  - ApiToken: []
paths:
  /accounts/{accountUuid}/warehouse/v2/warehouse-products/{productUuid}:
    get:
      tags:
        - warehouse-products
      summary: Get warehouse product
      description: Get the warehouse product
      operationId: warehouse_get_warehouse_products
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: productUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                properties:
                  data:
                    title: Warehouse Product Resource
                    properties:
                      active:
                        type: boolean
                      calculationStartDate:
                        type:
                          - string
                          - 'null'
                        format: date
                    type: object
                  message:
                    title: message
                    type: string
                  status:
                    example: 200
                  meta:
                    title: meta
                    type:
                      - object
                      - 'null'
                required:
                  - data
                  - message
                  - status
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/warehouse
      x-legacy-operation-id: 567e7db3be3cd87cc4fdc98da7ce2565
      x-required-scopes:
        - warehouse
    patch:
      tags:
        - warehouse-products
      summary: Update warehouse product
      description: Update the warehouse product
      operationId: warehouse_update_warehouse_products
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: productUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: Update warehouse product
        required: true
        content:
          application/json:
            schema:
              $schema: https://json-schema.org/draft/2020-12/schema
              $id: https://api.abaninja.ch/schemas/2.0.0/warehouse-product.schema.json
              description: A schema for modifying warehouse products in the warehouse in AbaNinja over the API
              type: object
              properties:
                calculationStartDate:
                  type:
                    - string
                    - 'null'
                  format: date
              required:
                - calculationStartDate
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                properties:
                  data:
                    title: Warehouse Product Resource
                    properties:
                      active:
                        type: boolean
                      calculationStartDate:
                        type:
                          - string
                          - 'null'
                        format: date
                    type: object
                  message:
                    title: message
                    type: string
                  status:
                    example: 200
                  meta:
                    title: meta
                    type:
                      - object
                      - 'null'
                required:
                  - data
                  - message
                  - status
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/warehouse
      x-legacy-operation-id: eb906e75c554d2c6c4b537d720f28425
      x-required-scopes:
        - warehouse
  /accounts/{accountUuid}/warehouse/v2/warehouse-products/{productUuid}/activate:
    post:
      tags:
        - warehouse-products
      summary: Activate warehouse product
      description: Activate a product for the warehouse
      operationId: warehouse_create_activate
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: productUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: Activate warehouse product
        required: true
        content:
          application/json:
            schema:
              $schema: https://json-schema.org/draft/2020-12/schema
              $id: https://api.abaninja.ch/schemas/2.0.0/warehouse-product-activation.schema.json
              description: A schema for activating products in the warehouse in AbaNinja over the API
              type: object
              properties:
                dateTime:
                  type: string
                  format: date-time
                initialAmount:
                  type: number
                  minimum: 0
              required:
                - dateTime
                - initialAmount
      responses:
        '200':
          description: Warehouse product successfully activated
          content:
            application/json:
              schema:
                properties:
                  data: {}
                  message:
                    title: message
                    type: string
                  status:
                    example: 200
                  meta:
                    title: meta
                    type:
                      - object
                      - 'null'
                required:
                  - data
                  - message
                  - status
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/warehouse
      x-legacy-operation-id: 4576cd153c82e1882c32bce4ec713018
      x-required-scopes:
        - warehouse
  /accounts/{accountUuid}/warehouse/v2/warehouse-products/{productUuid}/current-stock:
    get:
      tags:
        - warehouse-products
      summary: Get stock of warehouse product
      description: Get the current stock of the warehouse product
      operationId: warehouse_list_current_stock
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: productUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                properties:
                  data:
                    title: Warehouse Product Stock Resource
                    properties:
                      stock:
                        type: number
                        format: float
                      reservations:
                        type: number
                        format: float
                    type: object
                  message:
                    title: message
                    type: string
                  status:
                    example: 200
                  meta:
                    title: meta
                    type:
                      - object
                      - 'null'
                required:
                  - data
                  - message
                  - status
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/warehouse
      x-legacy-operation-id: e0e8f3cc14edc4d14f248fa838b23e7a
      x-required-scopes:
        - warehouse
  /accounts/{accountUuid}/warehouse/v2/warehouse-products/{productUuid}/deactivate:
    post:
      tags:
        - warehouse-products
      summary: Deactivate warehouse product
      description: Deactivate a product for the warehouse
      operationId: warehouse_create_deactivate
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: productUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Warehouse product successfully deactivated
          content:
            application/json:
              schema:
                properties:
                  data: {}
                  message:
                    title: message
                    type: string
                  status:
                    example: 200
                  meta:
                    title: meta
                    type:
                      - object
                      - 'null'
                required:
                  - data
                  - message
                  - status
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/warehouse
      x-legacy-operation-id: 5b72436a72d556e50b2fdfb85821419c
      x-required-scopes:
        - warehouse
  /accounts/{accountUuid}/warehouse/v2/warehouse-products/{productUuid}/status:
    get:
      tags:
        - warehouse-products
      summary: Get status of warehouse product
      description: Get the current status of the warehouse product
      operationId: warehouse_list_status_2
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: productUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                properties:
                  data:
                    title: Warehouse Product Status Resource
                    properties:
                      active:
                        type: boolean
                    type: object
                  message:
                    title: message
                    type: string
                  status:
                    example: 200
                  meta:
                    title: meta
                    type:
                      - object
                      - 'null'
                required:
                  - data
                  - message
                  - status
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/warehouse
      x-legacy-operation-id: a836e55614126e54881122e326b86282
      x-required-scopes:
        - warehouse
components:
  securitySchemes:
    ApiToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Bearer token authentication. Create tokens in Settings > API Token.
