paths:
  /genericClient/updateMenuItemAvailability:
    post:
      tags:
        - Menu Integration
      summary: Menu item availability update
      description: |
        The integrators can use this endpoint to change menu item availability
        (i.e., schedule transitions to IN STOCK or OUT OF STOCK).

        Each time a menu item availability request comes in, all other scheduled
        menu item availabilities for the SKUs in the current payload will be
        canceled. To schedule more than 2 transitions for the same item, both
        transitions should be specified in the same request.

        e.g., If you plan to move an item (with SKU = `"random-item-SKU"`) out of
        stock from 14:00 to 16:00, the integrator should send a single request
        with two availability transitions (one transition to OUT OF STOCK with
        the corresponding timestamp for 14:00, and a transition to IN STOCK with
        the timestamp for 16:00).

        Each menu push will clear item availabilities. It will take couple of
        minutes before tha availability change is visible in Bolt Food app.
      operationId: post-updateMenuItemAvailability
      parameters:
        - $ref: "../../common.yaml#/components/parameters/ExternalIntegratorId"
        - $ref: "../../common.yaml#/components/parameters/AuthorizationHmac"
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                provider_id:
                  type: string
                  description: Unique value for provider (given by Bolt Food)
                menu_item_availability_updates:
                  type: array
                  description: list of menu item availability transitions
                  items:
                    type: object
                    properties:
                      sku:
                        type: string
                        description: Dish SKU (stock keeping unit)
                      transition_to:
                        description: >-
                          The new availability for the menu items with a given
                          SKU
                        type: string
                        enum:
                          - in_stock
                          - out_of_stock
                          - hidden
                      transition_timestamp:
                        type: number
                        description: UNIX timestamp for when should the transition occur
                    required:
                      - sku
                      - transition_to
                      - transition_timestamp
                "":
                  type: string
              required:
                - provider_id
                - menu_item_availability_updates
            examples:
              example-1:
                value:
                  provider_id: RESTO_ID
                  menu_item_availability_updates:
                    - sku: sku-sglkijb012
                      transition_to: out_of_stock
                      transition_timestamp: 1608631675
                    - sku: sku-sglkijb012
                      transition_to: in_stock
                      transition_timestamp: 1608641675
      responses:
        "200":
          $ref: "../../common.yaml#/components/responses/OK"
        "304":
          $ref: "../../common.yaml#/components/responses/NotModified"
        "400":
          $ref: "../../common.yaml#/components/responses/BadRequest"
        "401":
          $ref: "../../common.yaml#/components/responses/Unauthorized"
        "403":
          $ref: "../../common.yaml#/components/responses/Forbidden"
        "404":
          $ref: "../../common.yaml#/components/responses/NotFound"
        "429":
          $ref: "../../common.yaml#/components/responses/TooManyRequests"
        "500":
          $ref: "../../common.yaml#/components/responses/InternalServerError"
