openapi: 3.1.0
info:
  title: Comida Integracao API
  version: 1.0.0
  summary: API de compatibilidade no padrao iFood-like
  description: >
    Contrato ativo da API de integracao do ecossistema Comida.
    A superficie publica cobre autenticacao, merchant, catalogo, pedidos,
    eventos e webhook inbound. O bridge atual le e escreve no banco do
    admin para stores, categories, items, orders, order_details,
    order_payments, store_schedule, addon_categories e add_ons.
servers:
  - url: https://api.bera.food
    description: Producao
  - url: http://localhost:8000
    description: Local
tags:
  - name: Authentication
    description: Fluxos de login, user code e emissao de token.
  - name: Merchant
    description: Consulta e manutencao do estado do merchant.
  - name: Catalog
    description: Consulta e atualizacao do catalogo, itens, categorias e opcoes.
  - name: Events
    description: Polling e confirmacao de eventos de pedidos.
  - name: Orders
    description: Operacoes de ciclo de vida do pedido.
  - name: Webhook
    description: Recebimento de eventos assinados de parceiros.
paths:
  /health:
    get:
      summary: Verifica a saude do servico
      description: Retorna se a API esta online e informa a versao exposta pelo pod.
      tags: [Authentication]
      security: []
      responses:
        '200':
          description: Health check
          content:
            application/json:
              schema:
                type: object
                properties:
                  service: { type: string }
                  status: { type: string }
                  version: { type: string }
  /authentication/v1.0/oauth/userCode:
    post:
      summary: Gera o user code de autorizacao
      description: Inicia o fluxo de autorizacao e devolve o codigo para o parceiro concluir a validacao.
      tags: [Authentication]
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserCodeRequest'
      responses:
        '200':
          description: User code generated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserCodeResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /authentication/v1.0/oauth/token:
    post:
      summary: Emite token OAuth
      description: Converte credenciais ou authorization code em access token para acesso as rotas protegidas.
      tags: [Authentication]
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OAuthTokenRequest'
      responses:
        '200':
          description: Token emitted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuthTokenResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /merchant/v1.0/merchants:
    get:
      summary: Lista merchants disponiveis
      description: Retorna os merchants visiveis para o parceiro autenticado.
      tags: [Merchant]
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Merchant list
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MerchantSummary'
  /merchant/v1.0/merchants/{merchantId}:
    get:
      summary: Detalha um merchant
      description: Busca os dados completos do merchant informado por ID externo.
      tags: [Merchant]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
      responses:
        '200':
          description: Merchant detail
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantDetail'
  /merchant/v1.0/merchants/{merchantId}/status:
    get:
      summary: Consulta status do merchant
      description: Informa se o merchant esta aberto, fechado ou interrompido, com metadados de reabertura.
      tags: [Merchant]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
      responses:
        '200':
          description: Merchant status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantStatusResponse'
  /merchant/v1.0/merchants/{merchantId}/status/{operation}:
    get:
      summary: Consulta status de operacao do merchant
      description: Retorna o estado tecnico de uma operacao especifica relacionada ao merchant.
      tags: [Merchant]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
        - name: operation
          in: path
          required: true
          schema: { type: string }
      responses:
        '200':
          description: Operation status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantOperationStatusResponse'
  /merchant/v1.0/merchants/{merchantId}/interruptions:
    get:
      summary: Lista interrupcoes do merchant
      description: Retorna as interrupcoes cadastradas para o merchant.
      tags: [Merchant]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
      responses:
        '200':
          description: Merchant interruptions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InterruptionsResponse'
    post:
      summary: Cria interrupcao do merchant
      description: Registra uma nova interrupcao operacional para o merchant.
      tags: [Merchant]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InterruptionRequest'
      responses:
        '201':
          description: Interruption created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Interruption'
  /merchant/v1.0/merchants/{merchantId}/interruptions/{interruptionId}:
    delete:
      summary: Remove interrupcao do merchant
      description: Exclui uma interrupcao existente pelo seu identificador externo.
      tags: [Merchant]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
        - name: interruptionId
          in: path
          required: true
          schema: { type: string }
      responses:
        '200':
          description: Interruption removed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InterruptionDeleteResponse'
  /merchant/v1.0/merchants/{merchantId}/opening-hours:
    get:
      summary: Consulta horario de funcionamento
      description: Retorna os horarios de abertura e fechamento cadastrados para o merchant.
      tags: [Merchant]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
      responses:
        '200':
          description: Opening hours
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpeningHoursResponse'
    put:
      summary: Atualiza horario de funcionamento
      description: Substitui os horarios de funcionamento do merchant com os dados enviados.
      tags: [Merchant]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpeningHoursRequest'
      responses:
        '200':
          description: Opening hours updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpeningHoursResponse'
  /events/v1.0/events:polling:
    get:
      summary: Faz polling dos eventos pendentes
      description: Lista os eventos de pedido aguardando consumo, respeitando os filtros enviados.
      tags: [Events]
      security:
        - bearerAuth: []
      parameters:
        - name: X-Polling-Merchants
          in: header
          required: false
          schema: { type: string }
        - name: eventTypes
          in: query
          required: false
          schema:
            type: array
            items: { type: string }
          style: form
          explode: false
      responses:
        '200':
          description: Events
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/OrderEvent'
  /events/v1.0/events/acknowledgment:
    post:
      summary: Confirma recebimento dos eventos
      description: Marca eventos como processados para evitar reenvio no polling.
      tags: [Events]
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventAcknowledgmentRequest'
      responses:
        '200':
          description: Acknowledged
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventAcknowledgmentResponse'
  /catalog/v2.0/merchants/{merchantId}/catalogs:
    get:
      summary: Lista catalogos do merchant
      description: Retorna os catalogos associados ao merchant informado.
      tags: [Catalog]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
      responses:
        '200':
          description: Catalog list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CatalogListResponse'
  /catalog/v2.0/merchants/{merchantId}/catalogs/{catalogId}/categories:
    get:
      summary: Lista categorias do catalogo
      description: Retorna as categorias de um catalogo especifico.
      tags: [Catalog]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
        - $ref: '#/components/parameters/CatalogId'
      responses:
        '200':
          description: Categories
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CategoriesResponse'
    post:
      summary: Cria categoria no catalogo
      description: Cria ou atualiza uma categoria dentro do catalogo informado.
      tags: [Catalog]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
        - $ref: '#/components/parameters/CatalogId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CategoryUpsertRequest'
      responses:
        '201':
          description: Category created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Category'
  /catalog/v2.0/merchants/{merchantId}/categories/{categoryId}/items:
    get:
      summary: Lista itens da categoria
      description: Retorna os itens associados a uma categoria especifica.
      tags: [Catalog]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
        - $ref: '#/components/parameters/CategoryId'
      responses:
        '200':
          description: Items in category
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CategoryItemsResponse'
  /catalog/v2.0/merchants/{merchantId}/items/{itemId}/flat:
    get:
      summary: Consulta item detalhado
      description: Retorna o item em formato achatado com grupos de opcoes e opcoes anexadas.
      tags: [Catalog]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
        - $ref: '#/components/parameters/ItemId'
      responses:
        '200':
          description: Flat item
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FlatItemResponse'
  /catalog/v2.0/merchants/{merchantId}/catalogs/{catalogId}/sellableItems:
    get:
      summary: Lista itens vendaveis
      description: Retorna apenas os itens aptos para venda no catalogo informado.
      tags: [Catalog]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
        - $ref: '#/components/parameters/CatalogId'
      responses:
        '200':
          description: Sellable items
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Item'
  /catalog/v2.0/merchants/{merchantId}/items:
    put:
      summary: Cria ou atualiza item
      description: Persiste um item completo no catalogo do merchant.
      tags: [Catalog]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ItemUpsertRequest'
      responses:
        '201':
          description: Item stored
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Item'
  /catalog/v2.0/merchants/{merchantId}/items/price:
    patch:
      summary: Atualiza preco de itens
      description: Aplica atualizacoes de preco em lote para um ou mais itens.
      tags: [Catalog]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ItemPricePatchRequest'
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobAcceptedResponse'
  /catalog/v2.0/merchants/{merchantId}/items/status:
    patch:
      summary: Atualiza status do item
      description: Marca um item como disponivel ou indisponivel.
      tags: [Catalog]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ItemStatusPatchRequest'
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobAcceptedResponse'
  /catalog/v2.0/merchants/{merchantId}/items/externalCode:
    patch:
      summary: Atualiza codigo externo do item
      description: Sincroniza o externalCode do item com o sistema parceiro.
      tags: [Catalog]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ItemExternalCodePatchRequest'
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobAcceptedResponse'
  /catalog/v2.0/merchants/{merchantId}/options/price:
    patch:
      summary: Atualiza preco de opcoes
      description: Ajusta os valores das opcoes vinculadas ao catalogo.
      tags: [Catalog]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OptionPatchRequest'
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobAcceptedResponse'
  /catalog/v2.0/merchants/{merchantId}/options/status:
    patch:
      summary: Atualiza status de opcoes
      description: Ativa ou desativa opcoes do catalogo.
      tags: [Catalog]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OptionStatusPatchRequest'
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobAcceptedResponse'
  /catalog/v2.0/merchants/{merchantId}/options/externalCode:
    patch:
      summary: Atualiza codigo externo de opcoes
      description: Sincroniza o externalCode das opcoes com o parceiro.
      tags: [Catalog]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OptionExternalCodePatchRequest'
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobAcceptedResponse'
  /item/v1.0/ingestion/{merchantId}:
    post:
      summary: Ingestao completa de itens
      description: Recebe uma carga completa de itens para processamento e persistencia.
      tags: [Catalog]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IngestionRequest'
      responses:
        '201':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IngestionResponse'
    patch:
      summary: Ingestao parcial de itens
      description: Atualiza parcialmente itens existentes sem reenviar a carga completa.
      tags: [Catalog]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/MerchantId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IngestionRequest'
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IngestionResponse'
  /order/v1.0/orders/{orderId}:
    get:
      summary: Consulta pedido
      description: Retorna o pedido completo em seu estado atual.
      tags: [Orders]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/OrderId'
      responses:
        '200':
          description: Order detail
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
  /order/v1.0/orders/{orderId}/confirm:
    post:
      summary: Confirma pedido
      description: Registra a confirmacao do pedido pelo merchant.
      tags: [Orders]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/OrderId'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderCommandRequest'
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandAcceptedResponse'
  /order/v1.0/orders/{orderId}/startPreparation:
    post:
      summary: Inicia preparo do pedido
      description: Sinaliza que o pedido entrou em producao.
      tags: [Orders]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/OrderId'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderCommandRequest'
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandAcceptedResponse'
  /order/v1.0/orders/{orderId}/readyToPickup:
    post:
      summary: Marca pedido pronto para retirada
      description: Informa que o pedido esta pronto para coleta ou retirada.
      tags: [Orders]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/OrderId'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderCommandRequest'
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandAcceptedResponse'
  /order/v1.0/orders/{orderId}/dispatch:
    post:
      summary: Despacha pedido
      description: Marca o pedido como despachado para entrega.
      tags: [Orders]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/OrderId'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderCommandRequest'
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandAcceptedResponse'
  /order/v1.0/orders/{orderId}/deliver:
    post:
      summary: Marca pedido entregue
      description: Finaliza o pedido informando que a entrega foi concluida.
      tags: [Orders]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/OrderId'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderCommandRequest'
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandAcceptedResponse'
  /order/v1.0/orders/{orderId}/cancel:
    post:
      summary: Cancela pedido
      description: Cancela o pedido informando motivo e observacoes quando aplicavel.
      tags: [Orders]
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/OrderId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderCancelRequest'
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandAcceptedResponse'
  /webhook:
    post:
      summary: Recebe webhook de parceiro
      description: Valida a assinatura do webhook e processa eventos inbound enviados pelo parceiro.
      tags: [Webhook]
      security: []
      parameters:
        - name: X-IFood-Signature
          in: header
          required: true
          schema: { type: string }
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
      responses:
        '200':
          description: Event received
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookAck'
        '202':
          description: Keepalive accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookAck'
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Bearer
  parameters:
    MerchantId:
      name: merchantId
      in: path
      required: true
      schema: { type: string }
    CatalogId:
      name: catalogId
      in: path
      required: true
      schema: { type: string }
    CategoryId:
      name: categoryId
      in: path
      required: true
      schema: { type: string }
    ItemId:
      name: itemId
      in: path
      required: true
      schema: { type: string }
    OrderId:
      name: orderId
      in: path
      required: true
      schema: { type: string }
  responses:
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  schemas:
    ErrorEnvelope:
      type: object
      properties:
        error:
          type: object
          properties:
            code: { type: string }
            message: { type: string }
    UserCodeRequest:
      type: object
      required: [clientId, clientSecret]
      properties:
        clientId: { type: string }
        clientSecret: { type: string }
    UserCodeResponse:
      type: object
      required: [userCode, authorizationCodeVerifier, verificationUrl, verificationUrlComplete, expiresIn, createdAt]
      properties:
        userCode: { type: string }
        authorizationCodeVerifier: { type: string }
        verificationUrl: { type: string }
        verificationUrlComplete: { type: string }
        expiresIn: { type: integer }
        createdAt: { type: string, format: date-time }
    OAuthTokenRequest:
      type: object
      required: [grantType, clientId, clientSecret]
      properties:
        grantType:
          type: string
          enum: [client_credentials, authorization_code, refresh_token]
        clientId: { type: string }
        clientSecret: { type: string }
        authorizationCode: { type: string }
        authorizationCodeVerifier: { type: string }
        refreshToken: { type: string }
        scope: { type: string }
    OAuthTokenResponse:
      type: object
      required: [type, scope, expiresIn, accessToken, refreshToken, createdAt, issuer]
      properties:
        type: { type: string, example: Bearer }
        scope: { type: string }
        expiresIn: { type: integer }
        accessToken: { type: string }
        refreshToken: { type: string }
        createdAt: { type: string, format: date-time }
        issuer: { type: string }
    MerchantSummary:
      type: object
      properties:
        id: { type: string }
        name: { type: string }
        corporateName: { type: string }
        status:
          type: object
          properties:
            current: { type: string }
    MerchantDetail:
      allOf:
        - $ref: '#/components/schemas/MerchantSummary'
        - type: object
          properties:
            phone: { type: string }
            email: { type: string }
            address:
              type: object
              additionalProperties: true
            timezone: { type: string }
            openingHours:
              type: array
              items:
                type: object
                additionalProperties: true
            interruptions:
              type: array
              items:
                $ref: '#/components/schemas/Interruption'
            updatedAt:
              type: string
              format: date-time
            source: { type: string }
    MerchantStatusResponse:
      type: object
      properties:
        merchantId: { type: string }
        status: { type: string }
        reopenable:
          type: object
          properties:
            identifier: { type: string }
            type: { type: string }
            reopenable: { type: boolean }
        message:
          type: [string, 'null']
    MerchantOperationStatusResponse:
      type: object
      properties:
        merchantId: { type: string }
        operation: { type: string }
        status:
          type: object
          additionalProperties: true
        reopenable:
          type: object
          additionalProperties: true
    InterruptionRequest:
      type: object
      additionalProperties: true
    Interruption:
      type: object
      properties:
        id: { type: string }
        description: { type: string }
        start: { type: string, format: date-time }
        end: { type: string, format: date-time }
    InterruptionsResponse:
      type: object
      properties:
        merchantId: { type: string }
        interruptions:
          type: array
          items:
            $ref: '#/components/schemas/Interruption'
    InterruptionDeleteResponse:
      type: object
      properties:
        id: { type: string }
        deleted: { type: boolean }
    OpeningHoursRequest:
      type: object
      additionalProperties: true
    OpeningHoursResponse:
      type: object
      properties:
        merchantId: { type: string }
        openingHours:
          type: array
          items:
            type: object
            additionalProperties: true
    CatalogListResponse:
      type: object
      properties:
        catalogs:
          type: array
          items:
            type: object
            properties:
              catalogId: { type: string }
              merchantId: { type: string }
              context: { type: string }
              name: { type: string }
              status: { type: string }
              itemCount: { type: integer }
              modifiedAt:
                type: string
                format: date-time
              source: { type: string }
    CategoriesResponse:
      type: object
      properties:
        catalogId: { type: string }
        categories:
          type: array
          items:
            type: object
            properties:
              id: { type: string }
              catalogId: { type: string }
              name: { type: string }
              status: { type: string }
              index: { type: integer }
              itemCount: { type: integer }
              source: { type: string }
    CategoryUpsertRequest:
      type: object
      additionalProperties: true
    CategoryItemsResponse:
      type: object
      properties:
        categoryId: { type: string }
        items:
          type: array
          items:
            $ref: '#/components/schemas/Item'
    Price:
      type: object
      properties:
        value: { type: number }
        originalValue: { type: number }
        currency: { type: string }
    Item:
      type: object
      properties:
        id: { type: string }
        merchantId: { type: string }
        catalogId: { type: string }
        categoryId: { type: string }
        name: { type: string }
        description: { type: string }
        externalCode: { type: string }
        active: { type: boolean }
        status: { type: string }
        inventory:
          type: object
          additionalProperties: true
        prices:
          type: object
          properties:
            price: { type: number }
            promotionPrice: { type: number }
        scalePrices:
          type: array
          items:
            type: object
            additionalProperties: true
        channels:
          type: array
          items: { type: string }
        optionGroups:
          type: array
          items:
            type: object
            additionalProperties: true
        options:
          type: array
          items:
            type: object
            additionalProperties: true
        shifts:
          type: array
          items:
            type: object
            additionalProperties: true
        updatedAt: { type: string, format: date-time }
        source: { type: string }
    FlatItemResponse:
      type: object
      properties:
        item:
          $ref: '#/components/schemas/Item'
        optionGroups:
          type: array
          items:
            type: object
            additionalProperties: true
        options:
          type: array
          items:
            type: object
            additionalProperties: true
    ItemUpsertRequest:
      type: object
      additionalProperties: true
    ItemPricePatchRequest:
      type: object
      properties:
        items:
          type: array
          items:
            type: object
            additionalProperties: true
    ItemStatusPatchRequest:
      type: object
      properties:
        itemId: { type: string }
        status: { type: string, enum: [AVAILABLE, UNAVAILABLE] }
    ItemExternalCodePatchRequest:
      type: object
      properties:
        itemId: { type: string }
        externalCode: { type: string }
    OptionPatchRequest:
      type: object
      additionalProperties: true
    OptionStatusPatchRequest:
      type: object
      additionalProperties: true
    OptionExternalCodePatchRequest:
      type: object
      additionalProperties: true
    JobAcceptedResponse:
      type: object
      properties:
        jobId: { type: string }
        status: { type: string }
    IngestionRequest:
      type: object
      additionalProperties: true
    IngestionResponse:
      type: object
      properties:
        jobId: { type: string }
        status: { type: string }
        partial: { type: boolean }
        items:
          type: array
          items:
            type: object
            additionalProperties: true
    OrderEvent:
      type: object
      properties:
        id: { type: string }
        code: { type: string }
        fullCode: { type: string }
        orderId: { type: string }
        merchantId: { type: string }
        createdAt: { type: string, format: date-time }
    EventAcknowledgmentRequest:
      type: object
      additionalProperties: true
    EventAcknowledgmentResponse:
      type: object
      properties:
        status: { type: string }
        count: { type: integer }
        events:
          type: array
          items:
            type: object
            additionalProperties: true
    Order:
      type: object
      properties:
        id: { type: string }
        displayId: { type: string }
        orderType: { type: string }
        orderTiming: { type: string }
        createdAt: { type: string, format: date-time }
        updatedAt: { type: string, format: date-time }
        isTest: { type: boolean }
        merchant:
          type: object
          additionalProperties: true
        customer:
          type: object
          additionalProperties: true
        items:
          type: array
          items:
            type: object
            additionalProperties: true
        payments:
          type: array
          items:
            type: object
            additionalProperties: true
        total:
          type: object
          additionalProperties: true
        delivery:
          type: object
          additionalProperties: true
        additionalInfo:
          type: object
          additionalProperties: true
        status: { type: string }
    OrderCommandRequest:
      type: object
      additionalProperties: true
    CommandAcceptedResponse:
      type: object
      properties:
        orderId: { type: string }
        action: { type: string }
        status: { type: string }
        received:
          type: object
          additionalProperties: true
    OrderCancelRequest:
      type: object
      additionalProperties: true
    WebhookAck:
      type: object
      properties:
        status: { type: string }
        event: { type: string }
