{
  "openapi": "3.1.1",
  "info": {
    "title": "Centriaa — API de Integração (ERP externo)",
    "description": "Superfície de ingestão do Centriaa para o **adapter de ERP externo** (ADR-0042).\nContém **apenas** os endpoints sob `/api/v1/integration/*` — o hub é agnóstico ao ERP\nde origem. Namespace nomeado pela **capacidade** (integração), não pelo parceiro.\n\n## Autenticação — Refresh Token Rotation (RTR)\n\nNão há segredo estático permanente. Dois planos de credencial:\n\n1. **Provisionamento (Admin do tenant)**: `POST /api/v1/integration/credentials` cria/reseta a\n   credencial e emite o **1º token longo** (refresh). Re-provisionar revoga a cadeia anterior.\n2. **Operação (ERP, server-to-server)**: `POST /api/v1/integration/auth/refresh` gira o par\n   **access + refresh** — o token longo rotaciona a cada refresh e o **access JWT** curto\n   (`Authorization: Bearer <access>`) autentica os endpoints de negócio.\n\n## Convenções\n\n- **Tenant sempre do token**, nunca do corpo/query. Recurso de outro tenant responde **404**\n  (anti-IDOR), nunca 403.\n- **Endereçamento por GUID canônico** do Centriaa (`8-4-4-4-12`) — sem id externo do ERP.\n- **Push unidirecional** de estoque/preço com resolução **Last-Write-Wins por `occurredAt`**\n  (ISO-8601 com offset). Precisão sem arredondamento silencioso: quantidade `numeric(20,10)`,\n  preço `numeric(18,4)`.\n- **Idempotência de criação** pelo header `Idempotency-Key`.\n- Erros em ProblemDetails (RFC 7807) com `code`/`correlationId`.\n\n## Guia completo\n\nO contrato em prosa (fluxos, exemplos, catálogo de erros) é a fonte de verdade em\n`docs/api/integration-adapter.md` (ADR-0042). Em divergência, o código em `develop` vence.",
    "version": "v1"
  },
  "paths": {
    "/api/v1/integration/auth/refresh": {
      "post": {
        "tags": [
          "IntegrationAuth"
        ],
        "summary": "Rotaciona o par de tokens",
        "description": "Troca o token longo atual por um novo access JWT curto (48h) + um novo token longo (7d), girando ambos.\nO token longo pode vir no corpo (`{ \"refreshToken\": \"…\" }`) OU no header\n`Authorization: Bearer &lt;token longo&gt;`. Aplica a janela de graça até o 1º uso do sucessor\n(refresh do anterior é idempotente enquanto o novo não foi usado) e a detecção de reuso (apresentar o\nanterior depois de o sucessor ter sido usado revoga a cadeia inteira). O novo token longo é retornado\nem plaintext <b>apenas nesta resposta</b>.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/RefreshIntegrationTokenRequestDto"
                  }
                ]
              }
            },
            "text/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/RefreshIntegrationTokenRequestDto"
                  }
                ]
              }
            },
            "application/*+json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/RefreshIntegrationTokenRequestDto"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Par rotacionado: novo access + novo token longo",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/RefreshIntegrationTokenResponseDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefreshIntegrationTokenResponseDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefreshIntegrationTokenResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Token longo inválido, expirado, ou reuso detectado (cadeia revogada)",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/credentials": {
      "post": {
        "tags": [
          "IntegrationCredentials"
        ],
        "summary": "Provisiona a credencial de integração",
        "description": "Provisiona (ou recupera/reseta) a credencial de integração do tenant corrente e emite o 1º token longo.\nDevolve o token longo plaintext <b>apenas nesta resposta</b> — só o hash SHA-256 é persistido\n(irrecuperável, SH-B18). Se já existir credencial ativa, mantém a mesma identidade (`client_id`) e\n<b>revoga a cadeia anterior</b> de tokens longos (recuperação/reset).\n\n**Requer:** role de Admin (token de acesso de usuário/API key — não é o token longo da integração).",
        "responses": {
          "200": {
            "description": "Credencial provisionada/resetada; token longo retornado (exibido uma única vez)",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProvisionIntegrationCredentialResponseDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProvisionIntegrationCredentialResponseDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProvisionIntegrationCredentialResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Não autenticado",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Sem permissão (role insuficiente ou token de tipo inadequado)",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Provisão concorrente da credencial (INTEGRATION_CREDENTIAL_PROVISION_CONCURRENCY) — re-tentar",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/listings": {
      "post": {
        "tags": [
          "IntegrationListings"
        ],
        "summary": "Cria um anúncio",
        "description": "Cria o ANÚNCIO INTEIRO: um item com `variations[]` (ao menos UMA — anúncio sem variação não\nexiste no canal). O `marketplace` é o TIPO (string), nunca GUID de conexão. Regra PxV por\nentrada: produto COM variações exige `variantId` em todas; produto simples aceita exatamente uma\nentrada sem `variantId` (nível-produto). `title`/`description` são OPCIONAIS —\nnulo/ausente/em branco herda o nome/descrição do produto na publicação; o teto do título é POR CANAL\n(Mercado Livre 60, Shopee 120; sem limite documentado → 200). Preço por variação: &gt; 0 → nasce fonte\n`fixed` (auditoria + evento na mesma transação); `0`/nulo → nasce fonte `table`. Envie\num header `Idempotency-Key` para que retries retornem o mesmo GUID sem duplicar.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationListingCreateDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationListingCreateDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationListingCreateDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Criado — retorna o GUID do ANÚNCIO (o item); `Location` aponta para o GET.\n    Os ids das variações saem no GET.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationListingCreatedDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationListingCreatedDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationListingCreatedDto"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação, tipo de anúncio inválido/não configurado, regra PxV violada,\n    título acima do teto do canal ou bloco de preço inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Produto/variante não existe ou pertence a outro tenant, ou o tenant não tem\n    conexão do tipo enviado.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Mais de uma conexão do tipo (alvo ambíguo); o anúncio já existe para\n    (produto, conexão, tipo de anúncio) — a metadata aponta o `listingItemId` a endereçar com\n    GET/PUT; ou corrida de criação concorrente (retentável).",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "IntegrationListings"
        ],
        "summary": "Lista anúncios",
        "description": "Lista os ANÚNCIOS do tenant (página de ITENS com `variations` aninhadas; projeção minimizada;\nordem estável por criação). Filtros de query opcionais: `productId` e `marketplace` (o TIPO,\ncomo string). O tamanho da página é limitado a 100 no servidor. Estado de sync em DOIS grãos:\n`syncStatus`/`lastSyncedAt` do item são da publicação da CASCA; cada variação carrega os do\nMODELO. `title`/`description` são os ARMAZENADOS — `null` = herda do produto na\npublicação.",
        "parameters": [
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "productId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "marketplace",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/MarketplaceType"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Uma página de anúncios (itens com variações).",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfIntegrationListingDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfIntegrationListingDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfIntegrationListingDto"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/listings/{id}": {
      "get": {
        "tags": [
          "IntegrationListings"
        ],
        "summary": "Lê um anúncio",
        "description": "Lê o ANÚNCIO pelo GUID do item: identidade, editorial armazenado (`null` = herda do produto),\nestado da CASCA no canal (`syncStatus`/`externalItemId`) e as variações vivas — cada uma com\nseu bloco de preço fixo, `priceSource` (`fixed`/`table`) e estado do MODELO\n(`externalModelId`). O `variations[].id` é o id que o contrato ANTERIOR devolvia — use-o\npara montar o de-para da migração.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A visão do anúncio (item + variações).",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationListingDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationListingDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationListingDto"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Anúncio não existe, foi removido ou pertence a outro tenant — ou o id é de uma\n    VARIAÇÃO do contrato antigo (`INTEGRATION_LISTING_ID_IS_VARIATION`, com o `listingItemId` a\n    usar na metadata).",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "IntegrationListings"
        ],
        "summary": "Substitui um anúncio",
        "description": "SUBSTITUIÇÃO do anúncio inteiro (id = ITEM): o JSON é o estado final. Variação ausente de\n`variations[]` é REMOVIDA (soft-delete); nova é criada; presente tem o bloco de preço fixo\nsubstituído — bloco idêntico ao atual é no-op silencioso (sem auditoria/evento; re-push deliberado é o\nendpoint de sync). As flags `removePrice`/`removePromotion` NÃO EXISTEM MAIS: `price: 0`\nou `null` limpa o preço fixo (a variação volta à fonte `table`, com o fallback efetivo\nresolvido NA HORA e propagado no evento — sem fallback resolvível o evento sai com preço nulo e o\nconsumer registra o skip auditável); omitir a promoção a remove. A identidade\n(produto/marketplace/tipo de anúncio) NÃO é editável. Lista vazia = 400 (para apagar use DELETE).\nEditorial é substituição: nulo/em branco volta a herdar do produto. Não dispara re-sync do anúncio.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationListingReplaceDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationListingReplaceDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationListingReplaceDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Substituído — retorna a visão atual do anúncio (item + variações).",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationListingDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationListingDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationListingDto"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação, regra PxV violada, título acima do teto do canal, bloco de\n    preço inválido ou lista de variações vazia.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Anúncio não existe, foi removido ou pertence a outro tenant — ou o id é de uma\n    VARIAÇÃO do contrato antigo (`INTEGRATION_LISTING_ID_IS_VARIATION`, com o `listingItemId` a\n    usar na metadata).",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Corrida com outra escrita concorrente do mesmo anúncio (retentável).",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "IntegrationListings"
        ],
        "summary": "Exclui um anúncio",
        "description": "Remove (soft-delete) o ANÚNCIO INTEIRO pelo GUID do item: o item e TODAS as variações vivas caem na\nMESMA transação (cascade). O hub deixa de gerenciar o anúncio; o item NÃO é encerrado no canal\n(comportamento atual documentado). Recriar o mesmo (produto, marketplace, tipo) depois cria um anúncio\nNOVO (id novo). Anúncio ausente/já removido/de outro tenant é 404 (anti-IDOR + idempotência).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Removido (soft) — item e variações vivas."
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Anúncio não existe, já foi removido ou pertence a outro tenant — ou o id é de uma\n    VARIAÇÃO do contrato antigo (`INTEGRATION_LISTING_ID_IS_VARIATION`, com o `listingItemId` a\n    usar na metadata).",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/logistics-demands": {
      "post": {
        "tags": [
          "IntegrationLogisticsDemands"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationLogisticsDemandRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationLogisticsDemandRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationLogisticsDemandRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationLogisticsDemandResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationLogisticsDemandResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationLogisticsDemandResponse"
                }
              }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationLogisticsDemandResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationLogisticsDemandResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationLogisticsDemandResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/logistics-demands/{id}/update": {
      "post": {
        "tags": [
          "IntegrationLogisticsDemands"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateIntegratedLogisticsDemandRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateIntegratedLogisticsDemandRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateIntegratedLogisticsDemandRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegratedLogisticsDemandDetailsResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegratedLogisticsDemandDetailsResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegratedLogisticsDemandDetailsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/logistics-demands/{id}/cancel": {
      "post": {
        "tags": [
          "IntegrationLogisticsDemands"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelIntegratedLogisticsDemandRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelIntegratedLogisticsDemandRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CancelIntegratedLogisticsDemandRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegratedLogisticsDemandDetailsResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegratedLogisticsDemandDetailsResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegratedLogisticsDemandDetailsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/logistics-demands/{id}": {
      "get": {
        "tags": [
          "IntegrationLogisticsDemands"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegratedLogisticsDemandDetailsResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegratedLogisticsDemandDetailsResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegratedLogisticsDemandDetailsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/logistics-demands/by-origin/{documentId}": {
      "get": {
        "tags": [
          "IntegrationLogisticsDemands"
        ],
        "parameters": [
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegratedLogisticsDemandDetailsResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegratedLogisticsDemandDetailsResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegratedLogisticsDemandDetailsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/marketplaces": {
      "get": {
        "tags": [
          "IntegrationMarketplaces"
        ],
        "summary": "Lista marketplaces/conexões",
        "description": "Lista as conexões de marketplace do tenant. Conjunto de referência limitado (um punhado de lojas) — sem paginação.\nCada item é enriquecido com o nome amigável e o CNPJ do operador (do catálogo GLOBAL, resolvido por tipo).",
        "responses": {
          "200": {
            "description": "As conexões de marketplace do tenant (tipo, nome da conexão, shop id, nome, CNPJ).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/IntegrationMarketplaceDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/IntegrationMarketplaceDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/IntegrationMarketplaceDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/marketplaces/catalog": {
      "get": {
        "tags": [
          "IntegrationMarketplaces"
        ],
        "summary": "Lista o catálogo GLOBAL de marketplaces",
        "description": "Referência GLOBAL (não filtrada por tenant): mapeia cada tipo de marketplace ao nome amigável e ao CNPJ do\noperador (formatado, ou `null` quando a plataforma não tem CNPJ central — ex.: Loja Integrada).\nConjunto de referência (poucas linhas) — sem paginação. Ordem estável por tipo.",
        "responses": {
          "200": {
            "description": "O catálogo de marketplaces (tipo como string, nome, CNPJ ou null).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/IntegrationMarketplaceCatalogDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/IntegrationMarketplaceCatalogDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/IntegrationMarketplaceCatalogDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/product-brands": {
      "post": {
        "tags": [
          "IntegrationProductBrands"
        ],
        "summary": "Cria uma marca",
        "description": "Cria uma única marca. O servidor gera o GUID canônico e o retorna. Envie um header\n`Idempotency-Key` para que retries retornem o mesmo GUID sem duplicar.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductBrandDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductBrandDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductBrandDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Criado — retorna o GUID da marca; `Location` aponta para o GET.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductBrandResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductBrandResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductBrandResultDto"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação do payload (ex.: nome vazio/duplicado).",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "IntegrationProductBrands"
        ],
        "summary": "Lista marcas",
        "description": "Lista as marcas do tenant (paginado). Filtros `searchTerm` (nome) + `isActive` opcionais; tamanho da página limitado a 100.",
        "parameters": [
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "searchTerm",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "isActive",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Uma página de marcas.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfIntegrationProductBrandResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfIntegrationProductBrandResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfIntegrationProductBrandResultDto"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/product-brands/{id}": {
      "get": {
        "tags": [
          "IntegrationProductBrands"
        ],
        "summary": "Lê uma marca",
        "description": "Lê uma marca pelo seu GUID canônico.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A visão da marca.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductBrandResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductBrandResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductBrandResultDto"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Marca não existe ou pertence a outro tenant.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "IntegrationProductBrands"
        ],
        "summary": "Atualiza uma marca",
        "description": "Atualiza uma marca pelo seu GUID canônico. O id vem do path — nunca do corpo.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductBrandDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductBrandDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductBrandDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Atualizado — retorna a marca atual.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductBrandResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductBrandResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductBrandResultDto"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação do payload.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Marca não existe ou pertence a outro tenant.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "IntegrationProductBrands"
        ],
        "summary": "Exclui uma marca",
        "description": "Remove (soft-delete) uma marca pelo seu GUID canônico (delega ao delete do Catálogo — filtrado por\ntenant, mesma semântica da UI). Uma marca ausente/de outro tenant (ou já removida) é 404; uma marca ainda\nusada por produtos é 409 (`PRODUCT_BRAND_IN_USE`).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Removido (soft)."
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Marca não existe ou pertence a outro tenant.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Marca ainda é usada por um ou mais produtos.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/product-categories": {
      "post": {
        "tags": [
          "IntegrationProductCategories"
        ],
        "summary": "Cria uma categoria",
        "description": "Cria uma única categoria. O servidor gera o GUID canônico e o retorna. Envie um header\n`Idempotency-Key` para que retries retornem o mesmo GUID sem duplicar. Quando um\n`parentId` está presente, ele deve ser uma categoria já registrada deste tenant (resolve-or-fail).",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductCategoryDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductCategoryDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductCategoryDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Criado — retorna o GUID da categoria; `Location` aponta para o GET.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductCategoryResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductCategoryResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductCategoryResultDto"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação do payload (ex.: nome vazio/duplicado).",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "O `parentId` referenciado não existe para o tenant.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "IntegrationProductCategories"
        ],
        "summary": "Lista categorias",
        "description": "Lista as categorias do tenant (paginado). Filtros `searchTerm` (nome) + `isActive` opcionais; tamanho da página limitado a 100.",
        "parameters": [
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "searchTerm",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "isActive",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Uma página de categorias.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfIntegrationProductCategoryResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfIntegrationProductCategoryResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfIntegrationProductCategoryResultDto"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/product-categories/{id}": {
      "get": {
        "tags": [
          "IntegrationProductCategories"
        ],
        "summary": "Lê uma categoria",
        "description": "Lê uma categoria pelo seu GUID canônico.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A visão da categoria.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductCategoryResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductCategoryResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductCategoryResultDto"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Categoria não existe ou pertence a outro tenant.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "IntegrationProductCategories"
        ],
        "summary": "Atualiza uma categoria",
        "description": "Atualiza os atributos de uma categoria pelo seu GUID canônico. O id vem do path — nunca do corpo.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductCategoryDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductCategoryDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductCategoryDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Atualizado — retorna a categoria atual.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductCategoryResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductCategoryResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductCategoryResultDto"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação do payload.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Categoria não existe ou pertence a outro tenant.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "IntegrationProductCategories"
        ],
        "summary": "Exclui uma categoria",
        "description": "Remove (soft-delete) uma categoria pelo seu GUID canônico (delega ao delete do Catálogo — filtrado por\ntenant, mesma semântica da UI). Uma categoria ausente/de outro tenant (ou já removida) é 404. Uma\ncategoria que tem categorias-filhas falha com `PRODUCT_CATEGORY_HAS_CHILDREN`, que o mapeador de erro\ncompartilhado (`ResultExtensions`) mapeia para <b>400</b> — o MESMO status que a UI retorna.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Removido (soft)."
          },
          "400": {
            "description": "Categoria tem categorias-filhas (`PRODUCT_CATEGORY_HAS_CHILDREN`).",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Categoria não existe ou pertence a outro tenant.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/product-models": {
      "post": {
        "tags": [
          "IntegrationProductModels"
        ],
        "summary": "Cria um modelo",
        "description": "Cria um único modelo. O servidor gera o GUID canônico e o retorna. Envie um header\n`Idempotency-Key` para que retries retornem o mesmo GUID sem duplicar.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductModelDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductModelDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductModelDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Criado — retorna o GUID do modelo; `Location` aponta para o GET.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductModelResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductModelResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductModelResultDto"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação do payload (ex.: nome vazio/duplicado).",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "IntegrationProductModels"
        ],
        "summary": "Lista modelos",
        "description": "Lista os modelos do tenant (paginado). Filtros `searchTerm` (nome) + `isActive` opcionais; tamanho da página limitado a 100.",
        "parameters": [
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "searchTerm",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "isActive",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Uma página de modelos.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfIntegrationProductModelResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfIntegrationProductModelResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfIntegrationProductModelResultDto"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/product-models/{id}": {
      "get": {
        "tags": [
          "IntegrationProductModels"
        ],
        "summary": "Lê um modelo",
        "description": "Lê um modelo pelo seu GUID canônico.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A visão do modelo.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductModelResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductModelResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductModelResultDto"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Modelo não existe ou pertence a outro tenant.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "IntegrationProductModels"
        ],
        "summary": "Atualiza um modelo",
        "description": "Atualiza um modelo pelo seu GUID canônico. O id vem do path — nunca do corpo.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductModelDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductModelDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductModelDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Atualizado — retorna o modelo atual.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductModelResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductModelResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductModelResultDto"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação do payload.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Modelo não existe ou pertence a outro tenant.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "IntegrationProductModels"
        ],
        "summary": "Exclui um modelo",
        "description": "Remove (soft-delete) um modelo pelo seu GUID canônico (delega ao delete do Catálogo — filtrado por\ntenant, mesma semântica da UI). Um modelo ausente/de outro tenant (ou já removido) é 404; um modelo ainda\nusado por produtos é 409 (`PRODUCT_MODEL_IN_USE`).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Removido (soft)."
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Modelo não existe ou pertence a outro tenant.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Modelo ainda é usado por um ou mais produtos.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/products": {
      "post": {
        "tags": [
          "IntegrationProducts"
        ],
        "summary": "Cria um produto",
        "description": "Cria um único produto. O servidor gera o GUID canônico; a resposta o inclui junto do GUID de cada\nvariante criada (para o ERP externo endereçar estoque/preço por variante depois). Envie um header\n`Idempotency-Key` para que retries retornem o mesmo GUID sem duplicar.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Criado — retorna o GUID do produto + GUIDs das variantes; `Location` aponta para o GET.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductWriteResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductWriteResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductWriteResultDto"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação do payload, ou uma regra de variante/cauda foi violada.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Um auxiliar referenciado (marca/modelo/categoria/unidade) não existe para o tenant.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "IntegrationProducts"
        ],
        "summary": "Lista produtos",
        "description": "Lista os produtos do tenant (paginado, projeção minimizada). Os filtros de query opcionais são apenas o\nsubconjunto da integração: `searchTerm` (nome) e `isActive`; o tamanho da página é limitado a 100 no servidor.",
        "parameters": [
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "searchTerm",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "isActive",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Uma página de itens de produto.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfIntegrationProductListItemDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfIntegrationProductListItemDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedResultOfIntegrationProductListItemDto"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/products/{id}": {
      "get": {
        "tags": [
          "IntegrationProducts"
        ],
        "summary": "Lê um produto",
        "description": "Lê um produto pelo seu GUID canônico, incluindo variantes e seus GUIDs.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A visão do produto.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductDetailDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductDetailDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductDetailDto"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Produto não existe ou pertence a outro tenant.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "IntegrationProducts"
        ],
        "summary": "Atualiza um produto",
        "description": "Atualiza um produto por merge pelo seu GUID canônico (PUT — puro in-place, adendo do ADR-0042). O id vem\ndo path — nunca do corpo. Todo campo `null` = manter (só valores não nulos são gravados; um campo\nnão pode ser limpo por esta rota). Variantes são casadas pelo seu GUID (`variations[].id`): COM id\naltera in-place (GUID preservado); SEM id adiciona uma nova variante; variantes existentes não citadas\npermanecem intactas (nunca removidas — desative com `active:false`). A resposta retorna os GUIDs de\nvariante atuais (existentes inalteradas + novas) para reconciliação.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductUpdateDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductUpdateDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationProductUpdateDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Atualizado — retorna o GUID do produto + GUIDs de variante atuais (inalteradas + novas).",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductWriteResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductWriteResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductWriteResultDto"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação do payload, ou uma regra de variante/cauda foi violada.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Produto/variante não existe ou pertence a outro tenant, ou um auxiliar referenciado está ausente.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "IntegrationProducts"
        ],
        "summary": "Exclui um produto",
        "description": "Remove (soft-delete) um produto pelo seu GUID canônico (delega ao delete do Catálogo — filtrado por\ntenant, mesma semântica da UI). Um produto ausente/de outro tenant (ou já removido) é 404 (anti-IDOR + idempotência).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Removido (soft)."
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Produto não existe ou pertence a outro tenant.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/products/batch": {
      "post": {
        "tags": [
          "IntegrationProducts"
        ],
        "summary": "Cria produtos em lote",
        "description": "Cria um lote de produtos (criação em massa — sem id externo, um item de lote só pode criar). Sucesso\nparcial por item: um item que falha reporta seu código de erro + mensagens sem abortar os demais. Envie\num header `Idempotency-Key` para que retries retornem o mesmo resultado agregado.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/IntegrationProductDto"
                }
              }
            },
            "text/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/IntegrationProductDto"
                }
              }
            },
            "application/*+json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/IntegrationProductDto"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Resultados por item (criado / falhou).",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductBatchResultDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductBatchResultDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationProductBatchResultDto"
                }
              }
            }
          },
          "400": {
            "description": "Lista vazia.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "413": {
            "description": "Itens demais no lote.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/products/{id}/stock": {
      "put": {
        "tags": [
          "IntegrationProducts"
        ],
        "summary": "Atualiza o saldo de estoque",
        "description": "Fase 3 (ADR-0042 decisão 6) — o ERP envia o saldo autoritativo de uma célula de variante. Aplicado\nLast-Write-Wins por `occurredAt` em `stock_projection` (push-only Model B — sem pull/ack) e\nre-sincronizado ao marketplace. Omita `stockLocationId` para mirar o local padrão do tenant. O id do\nproduto é o GUID do path; o tenant vem do claim do token (ADR-0009), nunca do corpo.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationStockPushDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationStockPushDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationStockPushDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Aplicado (ou um no-op descartado pelo LWW quando `occurredAt` não é mais novo)."
          },
          "400": {
            "description": "Falha de validação do payload, ou nenhum local de estoque padrão para um corpo sem um.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Produto/variante/local não existe ou pertence a outro tenant.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integration/stock-locations": {
      "get": {
        "tags": [
          "IntegrationStockLocations"
        ],
        "summary": "Lista locais de estoque",
        "description": "Lista os locais de estoque ativos do tenant. Conjunto de referência limitado (tamanho de dropdown) — sem paginação.",
        "responses": {
          "200": {
            "description": "Os locais de estoque ativos do tenant (id, nome, flag de padrão).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/IntegrationStockLocationDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/IntegrationStockLocationDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/IntegrationStockLocationDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Token de integração ausente/inválido.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "BrazilProductOrigin": {
        "enum": [
          0,
          1,
          2,
          3,
          4,
          5,
          6,
          7,
          8
        ],
        "type": "integer",
        "description": "Origem fiscal do produto (código de origem da mercadoria, ICMS). 0 = Nacional; 1 = Estrangeira, importação direta; 2 = Estrangeira, adquirida no mercado interno; 3 = Nacional, conteúdo de importação entre 40% e 70%; 4 = Nacional, processos produtivos básicos (PPB); 5 = Nacional, conteúdo de importação até 40%; 6 = Estrangeira, importação direta, sem similar nacional; 7 = Estrangeira, mercado interno, sem similar nacional; 8 = Nacional, conteúdo de importação superior a 70%."
      },
      "CancelIntegratedLogisticsDemandRequest": {
        "required": [
          "expectedVersion"
        ],
        "type": "object",
        "properties": {
          "expectedVersion": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "IntegratedLogisticsDemandDetailsResponse": {
        "required": [
          "id",
          "type",
          "source",
          "businessCorrelationKey",
          "logisticsCycle",
          "status",
          "version",
          "origin",
          "destination",
          "items",
          "createdAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "businessCorrelationKey": {
            "type": "string"
          },
          "logisticsCycle": {
            "type": "integer",
            "format": "int32"
          },
          "status": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int32"
          },
          "origin": {
            "$ref": "#/components/schemas/IntegrationDemandOriginResponse"
          },
          "destination": {
            "$ref": "#/components/schemas/IntegrationDemandDestinationResponse"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationDemandItemResponse"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "IntegrationDemandDestinationRequest": {
        "required": [
          "recipientName",
          "contactPhone",
          "addressLine1",
          "addressLine2",
          "district",
          "city",
          "state",
          "postalCode",
          "country",
          "latitude",
          "longitude"
        ],
        "type": "object",
        "properties": {
          "recipientName": {
            "type": [
              "null",
              "string"
            ]
          },
          "contactPhone": {
            "type": [
              "null",
              "string"
            ]
          },
          "addressLine1": {
            "type": [
              "null",
              "string"
            ]
          },
          "addressLine2": {
            "type": [
              "null",
              "string"
            ]
          },
          "district": {
            "type": [
              "null",
              "string"
            ]
          },
          "city": {
            "type": [
              "null",
              "string"
            ]
          },
          "state": {
            "type": [
              "null",
              "string"
            ]
          },
          "postalCode": {
            "type": [
              "null",
              "string"
            ]
          },
          "country": {
            "type": [
              "null",
              "string"
            ]
          },
          "latitude": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "longitude": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          }
        }
      },
      "IntegrationDemandDestinationResponse": {
        "required": [
          "recipientName",
          "contactPhone",
          "addressLine1",
          "addressLine2",
          "district",
          "city",
          "state",
          "postalCode",
          "country",
          "latitude",
          "longitude"
        ],
        "type": "object",
        "properties": {
          "recipientName": {
            "type": "string"
          },
          "contactPhone": {
            "type": [
              "null",
              "string"
            ]
          },
          "addressLine1": {
            "type": "string"
          },
          "addressLine2": {
            "type": [
              "null",
              "string"
            ]
          },
          "district": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "postalCode": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "latitude": {
            "type": "number",
            "format": "double"
          },
          "longitude": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "IntegrationDemandItemRequest": {
        "required": [
          "sourceItemId",
          "productId",
          "sku",
          "barcode",
          "description",
          "unit",
          "quantity"
        ],
        "type": "object",
        "properties": {
          "sourceItemId": {
            "type": [
              "null",
              "string"
            ]
          },
          "productId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "sku": {
            "type": [
              "null",
              "string"
            ]
          },
          "barcode": {
            "type": [
              "null",
              "string"
            ]
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "unit": {
            "type": [
              "null",
              "string"
            ]
          },
          "quantity": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          }
        }
      },
      "IntegrationDemandItemResponse": {
        "required": [
          "sourceItemId",
          "productId",
          "sku",
          "barcode",
          "description",
          "unit",
          "quantity"
        ],
        "type": "object",
        "properties": {
          "sourceItemId": {
            "type": "string"
          },
          "productId": {
            "type": "string",
            "format": "uuid"
          },
          "sku": {
            "type": "string"
          },
          "barcode": {
            "type": [
              "null",
              "string"
            ]
          },
          "description": {
            "type": "string"
          },
          "unit": {
            "type": "string"
          },
          "quantity": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "IntegrationDemandOriginRequest": {
        "required": [
          "documentId",
          "documentNumber",
          "series",
          "finalizedAt"
        ],
        "type": "object",
        "properties": {
          "documentId": {
            "type": [
              "null",
              "string"
            ]
          },
          "documentNumber": {
            "type": [
              "null",
              "string"
            ]
          },
          "series": {
            "type": [
              "null",
              "string"
            ]
          },
          "finalizedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          }
        }
      },
      "IntegrationDemandOriginResponse": {
        "required": [
          "documentId",
          "documentNumber",
          "series",
          "finalizedAt"
        ],
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string"
          },
          "documentNumber": {
            "type": "string"
          },
          "series": {
            "type": "string"
          },
          "finalizedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "IntegrationListingCreatedDto": {
        "required": [
          "id"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "IntegrationListingCreateDto": {
        "required": [
          "productId",
          "marketplace"
        ],
        "type": "object",
        "properties": {
          "productId": {
            "type": "string",
            "format": "uuid"
          },
          "marketplace": {
            "$ref": "#/components/schemas/MarketplaceType"
          },
          "listingType": {
            "type": [
              "null",
              "string"
            ]
          },
          "title": {
            "type": [
              "null",
              "string"
            ]
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "variations": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/IntegrationListingVariationInputDto"
            }
          }
        }
      },
      "IntegrationListingDto": {
        "required": [
          "id",
          "productId",
          "marketplace",
          "listingType",
          "title",
          "description",
          "syncStatus",
          "lastSyncedAt",
          "externalItemId",
          "createdAt",
          "updatedAt",
          "variations"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "productId": {
            "type": "string",
            "format": "uuid"
          },
          "marketplace": {
            "$ref": "#/components/schemas/MarketplaceType"
          },
          "listingType": {
            "type": [
              "null",
              "string"
            ]
          },
          "title": {
            "type": [
              "null",
              "string"
            ]
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "syncStatus": {
            "$ref": "#/components/schemas/SyncStatus"
          },
          "lastSyncedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "externalItemId": {
            "type": [
              "null",
              "string"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "variations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationListingVariationDto"
            }
          }
        }
      },
      "IntegrationListingReplaceDto": {
        "type": "object",
        "properties": {
          "title": {
            "type": [
              "null",
              "string"
            ]
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "variations": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/IntegrationListingVariationInputDto"
            }
          }
        }
      },
      "IntegrationListingVariationDto": {
        "required": [
          "id",
          "variantId",
          "price",
          "promotionalPrice",
          "promotionStart",
          "promotionEnd",
          "priceSource",
          "syncStatus",
          "externalModelId",
          "lastSyncedAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "variantId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "price": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "promotionalPrice": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "promotionStart": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "promotionEnd": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "priceSource": {
            "type": "string"
          },
          "syncStatus": {
            "$ref": "#/components/schemas/SyncStatus"
          },
          "externalModelId": {
            "type": [
              "null",
              "string"
            ]
          },
          "lastSyncedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          }
        }
      },
      "IntegrationListingVariationInputDto": {
        "type": "object",
        "properties": {
          "variantId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "price": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "promotionalPrice": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "promotionStart": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "promotionEnd": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          }
        }
      },
      "IntegrationLogisticsDemandRequest": {
        "required": [
          "type",
          "source",
          "businessCorrelationKey",
          "logisticsCycle",
          "stockLocationId",
          "origin",
          "destination",
          "items"
        ],
        "type": "object",
        "properties": {
          "type": {
            "type": [
              "null",
              "string"
            ]
          },
          "source": {
            "type": [
              "null",
              "string"
            ]
          },
          "businessCorrelationKey": {
            "type": [
              "null",
              "string"
            ]
          },
          "logisticsCycle": {
            "type": [
              "null",
              "integer"
            ],
            "format": "int32"
          },
          "stockLocationId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "origin": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/IntegrationDemandOriginRequest"
              }
            ]
          },
          "destination": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/IntegrationDemandDestinationRequest"
              }
            ]
          },
          "items": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/IntegrationDemandItemRequest"
            }
          }
        }
      },
      "IntegrationLogisticsDemandResponse": {
        "required": [
          "id",
          "type",
          "source",
          "status",
          "version",
          "createdAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int32"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "IntegrationMarketplaceCatalogDto": {
        "required": [
          "type",
          "name",
          "cnpj"
        ],
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/MarketplaceType"
          },
          "name": {
            "type": "string"
          },
          "cnpj": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "IntegrationMarketplaceDto": {
        "required": [
          "marketplaceType",
          "connectionName",
          "shopId",
          "name",
          "cnpj"
        ],
        "type": "object",
        "properties": {
          "marketplaceType": {
            "$ref": "#/components/schemas/MarketplaceType"
          },
          "connectionName": {
            "type": "string"
          },
          "shopId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "cnpj": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "IntegrationProductBatchItemDto": {
        "required": [
          "index",
          "id",
          "variants",
          "success",
          "errorCode",
          "errors"
        ],
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "format": "int32"
          },
          "id": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationVariantRefDto"
            }
          },
          "success": {
            "type": "boolean"
          },
          "errorCode": {
            "type": [
              "null",
              "string"
            ]
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "IntegrationProductBatchResultDto": {
        "required": [
          "total",
          "created",
          "failed",
          "items"
        ],
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "format": "int32"
          },
          "created": {
            "type": "integer",
            "format": "int32"
          },
          "failed": {
            "type": "integer",
            "format": "int32"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationProductBatchItemDto"
            }
          }
        }
      },
      "IntegrationProductBrandDto": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "logoUrl": {
            "type": [
              "null",
              "string"
            ]
          },
          "website": {
            "type": [
              "null",
              "string"
            ]
          },
          "isActive": {
            "type": "boolean",
            "default": true
          }
        }
      },
      "IntegrationProductBrandResultDto": {
        "required": [
          "id",
          "name",
          "description",
          "logoUrl",
          "website",
          "isActive"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "logoUrl": {
            "type": [
              "null",
              "string"
            ]
          },
          "website": {
            "type": [
              "null",
              "string"
            ]
          },
          "isActive": {
            "type": "boolean"
          }
        }
      },
      "IntegrationProductCategoryDto": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "parentId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32",
            "default": 0
          }
        }
      },
      "IntegrationProductCategoryResultDto": {
        "required": [
          "id",
          "name",
          "description",
          "parentId",
          "sortOrder",
          "isActive"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "parentId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          },
          "isActive": {
            "type": "boolean"
          }
        }
      },
      "IntegrationProductDetailDto": {
        "required": [
          "id",
          "name",
          "description",
          "isActive",
          "hasVariations",
          "width",
          "height",
          "length",
          "weight",
          "packagedWidth",
          "packagedHeight",
          "packagedLength",
          "packagedWeight",
          "productModelId",
          "ncm",
          "origin",
          "brandId",
          "unitOfMeasureId",
          "categoryIds",
          "variants",
          "createdAt",
          "updatedAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "isActive": {
            "type": "boolean"
          },
          "hasVariations": {
            "type": "boolean"
          },
          "width": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "height": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "length": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "weight": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "packagedWidth": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "packagedHeight": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "packagedLength": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "packagedWeight": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "productModelId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "ncm": {
            "type": [
              "null",
              "string"
            ]
          },
          "origin": {
            "$ref": "#/components/schemas/BrazilProductOrigin"
          },
          "brandId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "unitOfMeasureId": {
            "type": "string",
            "format": "uuid"
          },
          "categoryIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationVariantDetailDto"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          }
        }
      },
      "IntegrationProductDto": {
        "required": [
          "name",
          "origin",
          "brandId",
          "description",
          "width",
          "height",
          "length",
          "weight",
          "packagedWidth",
          "packagedHeight",
          "packagedLength",
          "packagedWeight",
          "productModelId",
          "ncm",
          "unitOfMeasure",
          "categories",
          "images",
          "variations"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "origin": {
            "$ref": "#/components/schemas/BrazilProductOrigin"
          },
          "brandId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "width": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "height": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "length": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "weight": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "packagedWidth": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "packagedHeight": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "packagedLength": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "packagedWeight": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "productModelId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "ncm": {
            "type": [
              "null",
              "string"
            ]
          },
          "unitOfMeasure": {
            "enum": [
              "un",
              "pç",
              "cx",
              "pct",
              "dz",
              "par",
              "kg",
              "g",
              "mg",
              "t",
              "L",
              "mL",
              "m",
              "cm",
              "mm",
              "m²",
              "m³",
              "rolo",
              "fardo"
            ],
            "type": [
              "null",
              "string"
            ],
            "description": "Unidade de medida (abreviação). Conjunto global fixo de referência (ADR-0046)."
          },
          "categories": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "images": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/ProductImportImageDto"
            }
          },
          "variations": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/ProductImportVariationDto"
            }
          },
          "barcode": {
            "type": [
              "null",
              "string"
            ]
          },
          "gender": {
            "type": [
              "null",
              "string"
            ]
          },
          "warranty": {
            "type": [
              "null",
              "integer"
            ],
            "format": "int32"
          },
          "anatelCode": {
            "type": [
              "null",
              "string"
            ]
          },
          "anvisaCode": {
            "type": [
              "null",
              "string"
            ]
          },
          "inmetroCode": {
            "type": [
              "null",
              "string"
            ]
          },
          "mapaCode": {
            "type": [
              "null",
              "string"
            ]
          },
          "customFields": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/ProductImportCustomFieldDto"
            }
          }
        }
      },
      "IntegrationProductListItemDto": {
        "required": [
          "id",
          "name",
          "isActive",
          "hasVariations",
          "createdAt",
          "updatedAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "isActive": {
            "type": "boolean"
          },
          "hasVariations": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          }
        }
      },
      "IntegrationProductModelDto": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "isActive": {
            "type": "boolean",
            "default": true
          }
        }
      },
      "IntegrationProductModelResultDto": {
        "required": [
          "id",
          "name",
          "isActive"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "isActive": {
            "type": "boolean"
          }
        }
      },
      "IntegrationProductUpdateDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "null",
              "string"
            ]
          },
          "origin": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/BrazilProductOrigin"
              }
            ]
          },
          "brandId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "width": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "height": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "length": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "weight": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "packagedWidth": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "packagedHeight": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "packagedLength": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "packagedWeight": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "productModelId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "ncm": {
            "type": [
              "null",
              "string"
            ]
          },
          "unitOfMeasure": {
            "enum": [
              "un",
              "pç",
              "cx",
              "pct",
              "dz",
              "par",
              "kg",
              "g",
              "mg",
              "t",
              "L",
              "mL",
              "m",
              "cm",
              "mm",
              "m²",
              "m³",
              "rolo",
              "fardo"
            ],
            "type": [
              "null",
              "string"
            ],
            "description": "Unidade de medida (abreviação). Conjunto global fixo de referência (ADR-0046)."
          },
          "categories": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "images": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/ProductImportImageDto"
            }
          },
          "variations": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/IntegrationProductUpdateVariationDto"
            }
          },
          "barcode": {
            "type": [
              "null",
              "string"
            ]
          },
          "gender": {
            "type": [
              "null",
              "string"
            ]
          },
          "warranty": {
            "type": [
              "null",
              "integer"
            ],
            "format": "int32"
          },
          "anatelCode": {
            "type": [
              "null",
              "string"
            ]
          },
          "anvisaCode": {
            "type": [
              "null",
              "string"
            ]
          },
          "inmetroCode": {
            "type": [
              "null",
              "string"
            ]
          },
          "mapaCode": {
            "type": [
              "null",
              "string"
            ]
          },
          "customFields": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/ProductImportCustomFieldDto"
            }
          }
        }
      },
      "IntegrationProductUpdateVariationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "sku": {
            "type": [
              "null",
              "string"
            ]
          },
          "barcode": {
            "type": [
              "null",
              "string"
            ]
          },
          "active": {
            "type": [
              "null",
              "boolean"
            ]
          },
          "stock": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "values": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/ProductImportVariationValueDto"
            }
          },
          "netCost": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "supplierCost": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "averageCost": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          }
        }
      },
      "IntegrationProductWriteResultDto": {
        "required": [
          "id",
          "variants"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationVariantRefDto"
            }
          }
        }
      },
      "IntegrationStockLocationDto": {
        "required": [
          "id",
          "name",
          "isDefault"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "isDefault": {
            "type": "boolean"
          }
        }
      },
      "IntegrationStockPushDto": {
        "required": [
          "variantId",
          "stockLocationId",
          "quantity",
          "occurredAt"
        ],
        "type": "object",
        "properties": {
          "variantId": {
            "type": "string",
            "format": "uuid"
          },
          "stockLocationId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "quantity": {
            "type": "number",
            "format": "double"
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "IntegrationVariantDetailDto": {
        "required": [
          "id",
          "sku",
          "barcode",
          "isActive"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "sku": {
            "type": [
              "null",
              "string"
            ]
          },
          "barcode": {
            "type": [
              "null",
              "string"
            ]
          },
          "isActive": {
            "type": "boolean"
          }
        }
      },
      "IntegrationVariantRefDto": {
        "required": [
          "id",
          "sku"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "sku": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "MarketplaceType": {
        "enum": [
          "Shopee",
          "MercadoLivre",
          "LojaIntegrada"
        ]
      },
      "PagedResultOfIntegrationListingDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationListingDto"
            }
          },
          "pageNumber": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          },
          "hasPreviousPage": {
            "type": "boolean"
          },
          "hasNextPage": {
            "type": "boolean"
          }
        }
      },
      "PagedResultOfIntegrationProductBrandResultDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationProductBrandResultDto"
            }
          },
          "pageNumber": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          },
          "hasPreviousPage": {
            "type": "boolean"
          },
          "hasNextPage": {
            "type": "boolean"
          }
        }
      },
      "PagedResultOfIntegrationProductCategoryResultDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationProductCategoryResultDto"
            }
          },
          "pageNumber": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          },
          "hasPreviousPage": {
            "type": "boolean"
          },
          "hasNextPage": {
            "type": "boolean"
          }
        }
      },
      "PagedResultOfIntegrationProductListItemDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationProductListItemDto"
            }
          },
          "pageNumber": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          },
          "hasPreviousPage": {
            "type": "boolean"
          },
          "hasNextPage": {
            "type": "boolean"
          }
        }
      },
      "PagedResultOfIntegrationProductModelResultDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationProductModelResultDto"
            }
          },
          "pageNumber": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          },
          "hasPreviousPage": {
            "type": "boolean"
          },
          "hasNextPage": {
            "type": "boolean"
          }
        }
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": [
              "null",
              "string"
            ]
          },
          "title": {
            "type": [
              "null",
              "string"
            ]
          },
          "status": {
            "type": [
              "null",
              "integer"
            ],
            "format": "int32"
          },
          "detail": {
            "type": [
              "null",
              "string"
            ]
          },
          "instance": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "ProductImportCustomFieldDto": {
        "required": [
          "name",
          "value"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "value": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "ProductImportImageDto": {
        "required": [
          "sku",
          "order",
          "base64"
        ],
        "type": "object",
        "properties": {
          "sku": {
            "type": [
              "null",
              "string"
            ]
          },
          "order": {
            "type": "integer",
            "format": "int32"
          },
          "base64": {
            "type": "string"
          }
        }
      },
      "ProductImportVariationDto": {
        "required": [
          "sku",
          "barcode",
          "active",
          "stock",
          "values"
        ],
        "type": "object",
        "properties": {
          "sku": {
            "type": "string"
          },
          "barcode": {
            "type": [
              "null",
              "string"
            ]
          },
          "active": {
            "type": "boolean"
          },
          "stock": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "values": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/ProductImportVariationValueDto"
            }
          },
          "netCost": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "supplierCost": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "averageCost": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          }
        }
      },
      "ProductImportVariationValueDto": {
        "required": [
          "id",
          "name",
          "value"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": [
              "null",
              "string"
            ]
          },
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      },
      "ProvisionIntegrationCredentialResponseDto": {
        "required": [
          "clientId",
          "refreshToken",
          "expiresAt"
        ],
        "type": "object",
        "properties": {
          "clientId": {
            "type": "string"
          },
          "refreshToken": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "warning": {
            "type": "string"
          }
        }
      },
      "RefreshIntegrationTokenRequestDto": {
        "required": [
          "refreshToken"
        ],
        "type": "object",
        "properties": {
          "refreshToken": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "RefreshIntegrationTokenResponseDto": {
        "required": [
          "accessToken",
          "expiresIn",
          "accessTokenExpiresAt",
          "refreshToken",
          "refreshTokenExpiresAt"
        ],
        "type": "object",
        "properties": {
          "accessToken": {
            "type": "string"
          },
          "expiresIn": {
            "type": "integer",
            "format": "int32"
          },
          "accessTokenExpiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "refreshToken": {
            "type": "string"
          },
          "refreshTokenExpiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "tokenType": {
            "type": "string"
          }
        }
      },
      "SyncStatus": {
        "enum": [
          "Pending",
          "Synced",
          "Error",
          "Skipped",
          "PartialError"
        ]
      },
      "UpdateIntegratedLogisticsDemandRequest": {
        "required": [
          "expectedVersion",
          "destination",
          "items"
        ],
        "type": "object",
        "properties": {
          "expectedVersion": {
            "type": "integer",
            "format": "int32"
          },
          "destination": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/IntegrationDemandDestinationRequest"
              }
            ]
          },
          "items": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/IntegrationDemandItemRequest"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "http",
        "description": "Insira o token JWT no formato: Bearer {seu_token}\n\nExemplo: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\n\nObtenha o token através do endpoint POST /api/v1/auth/login",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      },
      "mobileToken": {
        "type": "http",
        "description": "Sessão operacional móvel com tokenType=mobile_access.",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      },
      "ApiKey": {
        "type": "apiKey",
        "description": "Insira a API Key gerada pelo sistema.\n\nExemplo: sk_abc12345...\n\nGere uma API Key através do endpoint POST /api/v1/api-keys (requer role Admin)",
        "name": "X-API-Key",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "Bearer": [ ],
      "ApiKey": [ ]
    }
  ],
  "tags": [
    {
      "name": "IntegrationAuth"
    },
    {
      "name": "IntegrationCredentials"
    },
    {
      "name": "IntegrationListings"
    },
    {
      "name": "IntegrationLogisticsDemands"
    },
    {
      "name": "IntegrationMarketplaces"
    },
    {
      "name": "IntegrationProductBrands"
    },
    {
      "name": "IntegrationProductCategories"
    },
    {
      "name": "IntegrationProductModels"
    },
    {
      "name": "IntegrationProducts"
    },
    {
      "name": "IntegrationStockLocations"
    }
  ]
}