{
  "openapi": "3.1.0",
  "info": {
    "title": "API de Comunicação",
    "description": "Conversas (atendimento ao comprador) e Perguntas e Respostas dos anúncios.",
    "version": "1.0.0",
    "contact": {
      "name": "UniSupri"
    }
  },
  "servers": [
    {
      "url": "https://api.sandbox.samdevel.com.br",
      "description": "Sandbox (ambiente de homologação)"
    }
  ],
  "tags": [
    {
      "name": "Central de Atendimento",
      "description": "Atendimento entre **loja** e **comprador** ancorado em um pedido, com suporte a intervenção da plataforma.\n\nCada conversa tem um `type` que define o ciclo de vida:\n- `pre_delivery` — aberta automaticamente quando o pedido é pago; encerra ao confirmar entrega.\n- `post_delivery` — chamado pós-venda (troca, garantia, dúvida), aberto manualmente pelo comprador sobre um assunto do catálogo.\n\n**Participantes** (`participants[].type`):\n- `customer` — comprador\n- `store` — loja/seller (esta API)\n- `platform` — atendimento da plataforma (exposto assim para o seller; internamente persistido como `operator`)\n\n**Status** (`status`): `open`, `closed`. Quando encerrada, `closed_reason` indica o motivo (`order_delivered`, `customer_closed`, `admin_closed`, `auto_inactive`).\n\n**Identificadores**: todas as conversas, mensagens e anexos são expostos por **ULID** (`{conversation}`, `{attachment}`). IDs auto-increment internos nunca aparecem na API.\n\n**Anexos**: o envio é feito em duas etapas — primeiro um `attachments/intent` reserva o slot e devolve uma URL pré-assinada para upload direto (`PUT`); em seguida a mensagem é criada com o `attachment_ulid`. Para visualizar o arquivo, o cliente solicita uma URL temporária via `attachments/{attachment}/access`."
    },
    {
      "name": "Perguntas e Respostas",
      "description": "Gerencie as **Perguntas e Respostas (Q&A)** das publicações da loja autenticada.\n\nEste recurso é o canal direto entre o comprador e o seller no detalhe do produto. Perguntas só ficam visíveis publicamente depois de passar pela moderação (status `APPROVED`). O seller pode então respondê-las pelo portal.\n\n**Regras importantes:**\n- O seller só enxerga perguntas de publicações **vinculadas à sua loja** (via `publication.stores` ou `publication.storeDefault`).\n- A resposta é criada por padrão com status `PENDING` (entra na fila de moderação). Lojas com a *feature* `trusted_answers` têm a resposta publicada diretamente como `APPROVED`, sem moderação.\n- O contador de não respondidas em `/unanswered-count` considera **apenas** Questions já `APPROVED` que não possuem nenhuma Answer `APPROVED`. É a métrica usada nos widgets de dashboard do portal do seller.\n- Todos os identificadores públicos são **ULIDs** (26 caracteres, base32 Crockford).\n\n**Status do ciclo de moderação** (`InteractionStatus`):\n- `PENDING` — aguardando moderação\n- `APPROVED` — visível publicamente\n- `REJECTED` — recusado pela moderação"
    }
  ],
  "paths": {
    "/v1/seller/conversations": {
      "get": {
        "tags": [
          "Central de Atendimento"
        ],
        "summary": "Listar Conversas",
        "description": "Lista paginada das conversas da loja autenticada, ordenadas pela mensagem mais recente (`last_message_at` desc).\n\nAceita filtros simples por `status`, `type` e `subject_id` (categoria do chamado pós-venda), além de uma busca direta por `order_id` via parâmetro `q`.",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "example": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Itens por página. Default `20`.",
            "schema": {
              "type": "integer",
              "example": 20
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Filtra por status da conversa.",
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "closed"
              ]
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Filtra por tipo de conversa.",
            "schema": {
              "type": "string",
              "enum": [
                "pre_delivery",
                "post_delivery"
              ]
            }
          },
          {
            "name": "subject_id",
            "in": "query",
            "required": false,
            "description": "Filtra por assunto (slug do catálogo de assuntos pós-venda, ex: `defective_product`, `wrong_item`).",
            "schema": {
              "type": "string",
              "example": "defective_product"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Busca por `order_id` exato (ULID do pedido). Por enquanto este parâmetro só casa o pedido exato — busca textual por nome do cliente ainda não passa por aqui; filtre essas situações no seu lado.",
            "schema": {
              "type": "string",
              "example": "01K8PB2RORD00001ABCDEFGHJK"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Conversas listadas",
            "content": {
              "application/json": {
                "example": {
                  "success": true,
                  "message_code": "SUCCESS",
                  "data": {
                    "meta": {
                      "search_query": "",
                      "filters": [],
                      "pagination": {
                        "page": 1,
                        "per_page": 20,
                        "last_page": 3,
                        "has_prev_page": false,
                        "has_next_page": true,
                        "records": {
                          "from": 1,
                          "to": 20,
                          "records": 47
                        }
                      }
                    },
                    "data": [
                      {
                        "id": "01K8PB0KMM36AY2P0NKSZBP2NA",
                        "type": "pre_delivery",
                        "status": "open",
                        "closed_reason": null,
                        "subject_id": null,
                        "subject_label": null,
                        "order_id": "01K8PB2RORD00001ABCDEFGHJK",
                        "order": {
                          "ulid": "01K8PB2RORD00001ABCDEFGHJK",
                          "order_number": "ORD-000123",
                          "status": "preparing",
                          "status_label": "Em preparação",
                          "total": 239.9,
                          "created_at": "2026-05-15T10:14:22-03:00"
                        },
                        "store_id": 42,
                        "customer_id": 1234,
                        "customer": {
                          "name": "João Silva",
                          "display_name": "João Silva",
                          "email": "joao@example.com",
                          "avatar_url": null,
                          "avatar_color": "#16a34a"
                        },
                        "last_message_at": "2026-05-18T09:42:17-03:00",
                        "closed_at": null,
                        "created_at": "2026-05-15T10:20:08-03:00"
                      },
                      {
                        "id": "01K8PB0KMM36AY2P0NKSZBP2NB",
                        "type": "post_delivery",
                        "status": "closed",
                        "closed_reason": "customer_closed",
                        "subject_id": "wrong_item",
                        "subject_label": "Recebi item errado",
                        "order_id": "01K8PB2RORD00002ABCDEFGHJK",
                        "order": {
                          "ulid": "01K8PB2RORD00002ABCDEFGHJK",
                          "order_number": "ORD-000119",
                          "status": "delivered",
                          "status_label": "Entregue",
                          "total": 84.5,
                          "created_at": "2026-04-29T18:02:51-03:00"
                        },
                        "store_id": 42,
                        "customer_id": 1180,
                        "customer": {
                          "name": "Mariana Souza",
                          "display_name": "Mariana Souza",
                          "email": "mariana@example.com",
                          "avatar_url": null,
                          "avatar_color": "#F97316"
                        },
                        "last_message_at": "2026-05-12T17:08:00-03:00",
                        "closed_at": "2026-05-13T08:30:11-03:00",
                        "created_at": "2026-05-09T11:00:00-03:00"
                      }
                    ]
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/v1/seller/conversations/unread-count": {
      "get": {
        "tags": [
          "Central de Atendimento"
        ],
        "summary": "Contar Conversas Não Lidas",
        "description": "Retorna o total de **mensagens não lidas** pela loja, somando todas as conversas abertas (`status=open`).\n\nA contagem é feita do ponto de vista do participante `store` — mensagens enviadas pela própria loja não contam. Útil para badges no menu lateral do portal seller.",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Contagem obtida",
            "content": {
              "application/json": {
                "examples": {
                  "with_unread": {
                    "summary": "Existem mensagens não lidas",
                    "value": {
                      "success": true,
                      "message_code": "SUCCESS",
                      "data": {
                        "count": 7
                      }
                    }
                  },
                  "no_unread": {
                    "summary": "Tudo lido",
                    "value": {
                      "success": true,
                      "message_code": "SUCCESS",
                      "data": {
                        "count": 0
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/v1/seller/conversations/config": {
      "get": {
        "tags": [
          "Central de Atendimento"
        ],
        "summary": "Configuração da Central de Atendimento",
        "description": "Retorna as configurações globais aplicáveis ao seller para o módulo de conversas.\n\nExpõe o **SLA de resposta esperado**, em horas, definido pela plataforma (`platform settings → conversations.sla_response_hours`, default `24`) — frontends usam este valor para destacar conversas próximas do estouro de prazo — e o catálogo de **assuntos** (`subjects`) disponíveis para chamados, cada um com `id` (slug usado no filtro `subject_id`), `label` e `applies_to` (`pre`, `post` ou `both`). Apenas assuntos ativos são retornados.",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Configuração obtida",
            "content": {
              "application/json": {
                "example": {
                  "success": true,
                  "message_code": "SUCCESS",
                  "data": {
                    "sla_response_hours": 24,
                    "subjects": [
                      {
                        "id": "defective_product",
                        "label": "Produto com defeito",
                        "applies_to": "post"
                      },
                      {
                        "id": "wrong_item",
                        "label": "Recebi item errado",
                        "applies_to": "post"
                      },
                      {
                        "id": "shipping_question",
                        "label": "Dúvida sobre a entrega",
                        "applies_to": "both"
                      }
                    ]
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/v1/seller/conversations/{conversation}": {
      "get": {
        "tags": [
          "Central de Atendimento"
        ],
        "summary": "Detalhes da Conversa",
        "description": "Retorna a conversa completa, incluindo dados do pedido vinculado, dados resumidos do cliente e a lista de **participantes**.\n\nA conversa precisa pertencer à loja autenticada — caso contrário, retorna `403` (`CONVERSATION_NOT_PARTICIPANT`). ID inexistente retorna `404`. Mensagens são paginadas em endpoint separado (`/messages`).",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "conversation",
            "in": "path",
            "required": true,
            "description": "ULID da conversa.",
            "schema": {
              "type": "string",
              "example": "01K8PB0KMM36AY2P0NKSZBP2NA"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Conversa obtida",
            "content": {
              "application/json": {
                "examples": {
                  "pre_delivery_open": {
                    "summary": "Pré-entrega aberta",
                    "value": {
                      "success": true,
                      "message_code": "SUCCESS",
                      "data": {
                        "id": "01K8PB0KMM36AY2P0NKSZBP2NA",
                        "type": "pre_delivery",
                        "status": "open",
                        "closed_reason": null,
                        "subject_id": null,
                        "subject_label": null,
                        "order_id": "01K8PB2RORD00001ABCDEFGHJK",
                        "order": {
                          "ulid": "01K8PB2RORD00001ABCDEFGHJK",
                          "order_number": "ORD-000123",
                          "status": "preparing",
                          "status_label": "Em preparação",
                          "total": 239.9,
                          "created_at": "2026-05-15T10:14:22-03:00"
                        },
                        "store_id": 42,
                        "customer_id": 1234,
                        "customer": {
                          "name": "João Silva",
                          "display_name": "João Silva",
                          "email": "joao@example.com",
                          "avatar_url": null,
                          "avatar_color": "#16a34a"
                        },
                        "last_message_at": "2026-05-18T09:42:17-03:00",
                        "closed_at": null,
                        "created_at": "2026-05-15T10:20:08-03:00",
                        "participants": [
                          {
                            "type": "customer",
                            "display_name": null,
                            "participant_id": 1234
                          },
                          {
                            "type": "store",
                            "display_name": null,
                            "participant_id": 42
                          }
                        ]
                      }
                    }
                  },
                  "post_delivery_with_platform": {
                    "summary": "Pós-entrega com intervenção da plataforma",
                    "value": {
                      "success": true,
                      "message_code": "SUCCESS",
                      "data": {
                        "id": "01K8PB0KMM36AY2P0NKSZBP2NB",
                        "type": "post_delivery",
                        "status": "open",
                        "closed_reason": null,
                        "subject_id": "defective_product",
                        "subject_label": "Produto com defeito",
                        "order_id": "01K8PB2RORD00002ABCDEFGHJK",
                        "order": {
                          "ulid": "01K8PB2RORD00002ABCDEFGHJK",
                          "order_number": "ORD-000119",
                          "status": "delivered",
                          "status_label": "Entregue",
                          "total": 84.5,
                          "created_at": "2026-04-29T18:02:51-03:00"
                        },
                        "store_id": 42,
                        "customer_id": 1180,
                        "customer": {
                          "name": "Mariana Souza",
                          "display_name": "Mariana Souza",
                          "email": "mariana@example.com",
                          "avatar_url": null,
                          "avatar_color": "#F97316"
                        },
                        "last_message_at": "2026-05-19T11:30:55-03:00",
                        "closed_at": null,
                        "created_at": "2026-05-17T14:02:00-03:00",
                        "participants": [
                          {
                            "type": "customer",
                            "display_name": null,
                            "participant_id": 1180
                          },
                          {
                            "type": "store",
                            "display_name": null,
                            "participant_id": 42
                          },
                          {
                            "type": "platform",
                            "display_name": "Atendimento Plataforma",
                            "participant_id": null
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/seller/conversations/{conversation}/messages": {
      "get": {
        "tags": [
          "Central de Atendimento"
        ],
        "summary": "Listar Mensagens",
        "description": "Lista paginada das mensagens da conversa em ordem **cronológica ascendente** (mais antiga primeiro).\n\nPara polling incremental, informe `after_message_ulid` com o ULID da última mensagem já recebida — só virão mensagens mais novas que ela.\n\nCada mensagem tem `kind`:\n- `user` — escrita por um participante humano\n- `system` — gerada automaticamente pela plataforma (ex: \"Pedido marcado como entregue\")\n\nO bloco `sender` é enriquecido com `display_name`, `avatar_url` e `badge` resolvidos a partir do tipo do remetente — útil para renderizar o balão de chat sem novas requisições.",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "conversation",
            "in": "path",
            "required": true,
            "description": "ULID da conversa.",
            "schema": {
              "type": "string",
              "example": "01K8PB0KMM36AY2P0NKSZBP2NA"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "example": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Itens por página. Default `50`.",
            "schema": {
              "type": "integer",
              "example": 50
            }
          },
          {
            "name": "after_message_ulid",
            "in": "query",
            "required": false,
            "description": "Retorna apenas mensagens criadas **após** a mensagem indicada (uso típico em polling). Se o ULID não pertencer a esta conversa, o filtro é ignorado.",
            "schema": {
              "type": "string",
              "example": "01K8PBMSG00001VWXYZ12345678"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Mensagens listadas",
            "content": {
              "application/json": {
                "example": {
                  "success": true,
                  "message_code": "SUCCESS",
                  "data": {
                    "meta": {
                      "search_query": "",
                      "filters": [],
                      "pagination": {
                        "page": 1,
                        "per_page": 50,
                        "last_page": 1,
                        "has_prev_page": false,
                        "has_next_page": false,
                        "records": {
                          "from": 1,
                          "to": 4,
                          "records": 4
                        }
                      }
                    },
                    "data": [
                      {
                        "id": "01K8PBMSG00001VWXYZ12345678",
                        "body": "Olá! Confirmo que seu pedido já entrou em separação.",
                        "kind": "user",
                        "sender_type": "store",
                        "sender_id": 42,
                        "sender_user_type": "customer",
                        "sender_user_id": 88,
                        "created_at": "2026-05-15T10:21:44-03:00",
                        "sender": {
                          "type": "store",
                          "display_name": "Atendente Loja",
                          "avatar_url": null,
                          "avatar_color": "#2563eb",
                          "store_name": "Minha Loja Premium",
                          "badge": "Loja",
                          "participant_id": 42
                        },
                        "attachments": []
                      },
                      {
                        "id": "01K8PBMSG00002VWXYZ12345678",
                        "body": "Obrigado! Existe previsão de envio para hoje?",
                        "kind": "user",
                        "sender_type": "customer",
                        "sender_id": 1234,
                        "sender_user_type": null,
                        "sender_user_id": null,
                        "created_at": "2026-05-15T10:25:02-03:00",
                        "sender": {
                          "type": "customer",
                          "display_name": "João Silva",
                          "avatar_url": null,
                          "avatar_color": "#16a34a",
                          "store_name": null,
                          "badge": null,
                          "participant_id": 1234
                        },
                        "attachments": []
                      },
                      {
                        "id": "01K8PBMSG00003VWXYZ12345678",
                        "body": "Segue foto da etiqueta de envio.",
                        "kind": "user",
                        "sender_type": "store",
                        "sender_id": 42,
                        "sender_user_type": "customer",
                        "sender_user_id": 88,
                        "created_at": "2026-05-15T11:02:18-03:00",
                        "sender": {
                          "type": "store",
                          "display_name": "Atendente Loja",
                          "avatar_url": null,
                          "avatar_color": "#2563eb",
                          "store_name": "Minha Loja Premium",
                          "badge": "Loja",
                          "participant_id": 42
                        },
                        "attachments": [
                          {
                            "id": "01K8PBATT00001VWXYZ12345678",
                            "original_name": "etiqueta-envio.pdf",
                            "mime_type": "application/pdf",
                            "size_bytes": 184320,
                            "kind": "pdf",
                            "width": null,
                            "height": null,
                            "duration_seconds": null
                          }
                        ]
                      },
                      {
                        "id": "01K8PBMSG00004VWXYZ12345678",
                        "body": "Pedido marcado como entregue.",
                        "kind": "system",
                        "sender_type": "store",
                        "sender_id": 42,
                        "sender_user_type": null,
                        "sender_user_id": null,
                        "created_at": "2026-05-18T09:42:17-03:00",
                        "sender": {
                          "type": "store",
                          "display_name": null,
                          "avatar_url": null,
                          "avatar_color": null,
                          "store_name": null,
                          "badge": null,
                          "participant_id": 42
                        },
                        "attachments": []
                      }
                    ]
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "Central de Atendimento"
        ],
        "summary": "Enviar Mensagem",
        "description": "Envia uma nova mensagem na conversa como participante `store`.\n\nA mensagem pode conter apenas `body`, apenas `attachments` (até 5 ULIDs de anexos previamente reservados via `attachments/intent`), ou ambos. O backend valida participação na conversa e o status (não é possível enviar em conversas encerradas).\n\nAo retornar, o objeto inclui os anexos já enriquecidos e o bloco `sender` com `display_name` e `badge` da loja.",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "conversation",
            "in": "path",
            "required": true,
            "description": "ULID da conversa.",
            "schema": {
              "type": "string",
              "example": "01K8PB0KMM36AY2P0NKSZBP2NA"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "maxLength": 5000,
                    "nullable": true,
                    "description": "Texto da mensagem. Opcional quando `attachments` está presente."
                  },
                  "attachments": {
                    "type": "array",
                    "maxItems": 5,
                    "items": {
                      "type": "string",
                      "description": "ULID de anexo retornado por `POST /attachments/intent`."
                    }
                  }
                }
              },
              "examples": {
                "text_only": {
                  "summary": "Apenas texto",
                  "value": {
                    "body": "Boa tarde! O pedido já foi despachado, código de rastreio segue em anexo no próximo retorno."
                  }
                },
                "with_attachments": {
                  "summary": "Texto + anexos",
                  "value": {
                    "body": "Segue a nota fiscal e a foto da embalagem.",
                    "attachments": [
                      "01K8PBATT00001VWXYZ12345678",
                      "01K8PBATT00002VWXYZ12345678"
                    ]
                  }
                },
                "attachments_only": {
                  "summary": "Apenas anexos",
                  "value": {
                    "attachments": [
                      "01K8PBATT00003VWXYZ12345678"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Mensagem enviada",
            "content": {
              "application/json": {
                "example": {
                  "success": true,
                  "message_code": "SUCCESS",
                  "data": {
                    "id": "01K8PBMSG00005VWXYZ12345678",
                    "body": "Segue a nota fiscal e a foto da embalagem.",
                    "kind": "user",
                    "sender_type": "store",
                    "sender_id": 42,
                    "sender_user_type": "customer",
                    "sender_user_id": 88,
                    "created_at": "2026-05-19T11:32:08-03:00",
                    "sender": {
                      "type": "store",
                      "display_name": "Atendente Loja",
                      "avatar_url": null,
                      "avatar_color": "#2563eb",
                      "store_name": "Minha Loja Premium",
                      "badge": "Loja",
                      "participant_id": 42
                    },
                    "attachments": [
                      {
                        "id": "01K8PBATT00001VWXYZ12345678",
                        "original_name": "nota-fiscal.pdf",
                        "mime_type": "application/pdf",
                        "size_bytes": 92160,
                        "kind": "pdf",
                        "width": null,
                        "height": null,
                        "duration_seconds": null
                      },
                      {
                        "id": "01K8PBATT00002VWXYZ12345678",
                        "original_name": "embalagem.jpg",
                        "mime_type": "image/jpeg",
                        "size_bytes": 612400,
                        "kind": "image",
                        "width": 1024,
                        "height": 768,
                        "duration_seconds": null
                      }
                    ]
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Não participa da conversa",
            "content": {
              "application/json": {
                "examples": {
                  "not_participant": {
                    "summary": "Loja não é participante da conversa",
                    "value": {
                      "success": false,
                      "code": 403,
                      "message_code": "CONVERSATION_NOT_PARTICIPANT",
                      "description": "Você não participa desta conversa.",
                      "data": [],
                      "errors": [
                        "Você não participa desta conversa."
                      ],
                      "meta": []
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "Conversa encerrada, anexo inválido ou validação dos campos",
            "content": {
              "application/json": {
                "examples": {
                  "conversation_closed": {
                    "summary": "Conversa encerrada",
                    "value": {
                      "success": false,
                      "code": 422,
                      "message_code": "CONVERSATION_CLOSED",
                      "description": "Conversa encerrada.",
                      "data": [],
                      "errors": [
                        "Conversa encerrada."
                      ],
                      "meta": []
                    }
                  },
                  "attachment_not_confirmed": {
                    "summary": "Anexo ainda não confirmado",
                    "value": {
                      "success": false,
                      "code": 422,
                      "message_code": "CONVERSATION_ATTACHMENT_NOT_CONFIRMED",
                      "description": "Anexo ainda não foi confirmado no S3.",
                      "data": [],
                      "errors": [
                        "Anexo ainda não foi confirmado no S3."
                      ],
                      "meta": []
                    }
                  },
                  "validation": {
                    "summary": "Erro de validação dos campos",
                    "value": {
                      "success": false,
                      "code": 422,
                      "message_code": "VALIDATION_ERROR",
                      "description": "Os dados informados são inválidos.",
                      "data": [],
                      "errors": {
                        "body": [
                          "The body must not be greater than 5000 characters."
                        ],
                        "attachments": [
                          "The attachments must not have more than 5 items."
                        ]
                      },
                      "meta": []
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/seller/conversations/{conversation}/read": {
      "post": {
        "tags": [
          "Central de Atendimento"
        ],
        "summary": "Marcar como Lida",
        "description": "Atualiza o **ponteiro de leitura** da loja para a conversa, marcando como lida toda mensagem até (e incluindo) `last_message_ulid`.\n\nO contador de não lidas (`GET /unread-count`) usa esse ponteiro. Operação idempotente — chamar duas vezes com o mesmo ULID não tem efeito adicional. Retorna `204 No Content` em caso de sucesso.",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "conversation",
            "in": "path",
            "required": true,
            "description": "ULID da conversa.",
            "schema": {
              "type": "string",
              "example": "01K8PB0KMM36AY2P0NKSZBP2NA"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "last_message_ulid"
                ],
                "properties": {
                  "last_message_ulid": {
                    "type": "string",
                    "description": "ULID da última mensagem que a loja visualizou."
                  }
                }
              },
              "example": {
                "last_message_ulid": "01K8PBMSG00004VWXYZ12345678"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Ponteiro de leitura atualizado (sem corpo)."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/v1/seller/conversations/{conversation}/attachments/intent": {
      "post": {
        "tags": [
          "Central de Atendimento"
        ],
        "summary": "Reservar Upload de Anexo",
        "description": "Inicia o envio de um anexo em duas etapas: o servidor reserva um slot para o arquivo e devolve uma **URL pré-assinada** (`PUT`) para o cliente subir o conteúdo diretamente ao storage (S3/MinIO).\n\nFluxo completo:\n1. `POST /attachments/intent` com `original_name`, `mime_type` e `size_bytes` — recebe `attachment_ulid`, `upload_url` e `expires_at`.\n2. Cliente faz `PUT upload_url` com o binário do arquivo.\n3. `POST /messages` com `attachments: [attachment_ulid]` — o backend confirma o upload (verificando existência no storage) e vincula o anexo à mensagem.\n\nRestrições aplicadas pela plataforma:\n- **Tamanho máximo**: 25 MB (`CONVERSATIONS_ATTACHMENT_MAX_SIZE`).\n- **Tipos permitidos**: `image/jpeg`, `image/png`, `image/webp`, `image/gif`, `application/pdf`, `video/mp4`, `video/webm`, `video/quicktime`.\n- **URL de upload** expira em 15 minutos.",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "conversation",
            "in": "path",
            "required": true,
            "description": "ULID da conversa.",
            "schema": {
              "type": "string",
              "example": "01K8PB0KMM36AY2P0NKSZBP2NA"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "original_name",
                  "mime_type",
                  "size_bytes"
                ],
                "properties": {
                  "original_name": {
                    "type": "string",
                    "description": "Nome original do arquivo (com extensão)."
                  },
                  "mime_type": {
                    "type": "string",
                    "description": "MIME type do arquivo. Precisa estar na lista de permitidos.",
                    "enum": [
                      "image/jpeg",
                      "image/png",
                      "image/webp",
                      "image/gif",
                      "application/pdf",
                      "video/mp4",
                      "video/webm",
                      "video/quicktime"
                    ]
                  },
                  "size_bytes": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Tamanho do arquivo em bytes (máx. 26214400 = 25 MB)."
                  }
                }
              },
              "examples": {
                "image": {
                  "summary": "Foto da embalagem",
                  "value": {
                    "original_name": "embalagem.jpg",
                    "mime_type": "image/jpeg",
                    "size_bytes": 612400
                  }
                },
                "pdf": {
                  "summary": "Nota fiscal em PDF",
                  "value": {
                    "original_name": "nota-fiscal.pdf",
                    "mime_type": "application/pdf",
                    "size_bytes": 92160
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Slot reservado",
            "content": {
              "application/json": {
                "example": {
                  "success": true,
                  "message_code": "SUCCESS",
                  "data": {
                    "attachment_ulid": "01K8PBATT00001VWXYZ12345678",
                    "upload_url": "https://cdn-content.s3.amazonaws.com/01K8PB0KMM36AY2P0NKSZBP2NA/01K8PBBKT00001ABCDE/01K8PBATT00001VWXYZ12345678.jpg?X-Amz-Signature=...",
                    "method": "PUT",
                    "expires_at": "2026-05-19T11:47:08-03:00"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Loja não participa da conversa",
            "content": {
              "application/json": {
                "example": {
                  "success": false,
                  "code": 403,
                  "message_code": "CONVERSATION_NOT_PARTICIPANT",
                  "description": "Você não participa desta conversa.",
                  "data": [],
                  "errors": [
                    "Você não participa desta conversa."
                  ],
                  "meta": []
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "Arquivo rejeitado ou erro de validação",
            "content": {
              "application/json": {
                "examples": {
                  "too_large": {
                    "summary": "Excede 25 MB",
                    "value": {
                      "success": false,
                      "code": 422,
                      "message_code": "CONVERSATION_ATTACHMENT_TOO_LARGE",
                      "description": "Anexo excede o tamanho máximo permitido.",
                      "data": [],
                      "errors": [
                        "Anexo excede o tamanho máximo permitido."
                      ],
                      "meta": []
                    }
                  },
                  "mime_not_allowed": {
                    "summary": "Tipo de arquivo não permitido",
                    "value": {
                      "success": false,
                      "code": 422,
                      "message_code": "CONVERSATION_ATTACHMENT_MIME_NOT_ALLOWED",
                      "description": "Tipo de arquivo não permitido.",
                      "data": [],
                      "errors": [
                        "Tipo de arquivo não permitido."
                      ],
                      "meta": []
                    }
                  },
                  "validation": {
                    "summary": "Campos obrigatórios ausentes",
                    "value": {
                      "success": false,
                      "code": 422,
                      "message_code": "VALIDATION_ERROR",
                      "description": "Os dados informados são inválidos.",
                      "data": [],
                      "errors": {
                        "original_name": [
                          "The original name field is required."
                        ],
                        "mime_type": [
                          "The mime type field is required."
                        ],
                        "size_bytes": [
                          "The size bytes must be at least 1."
                        ]
                      },
                      "meta": []
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/seller/conversations/{conversation}/attachments/{attachment}/access": {
      "get": {
        "tags": [
          "Central de Atendimento"
        ],
        "summary": "URL Temporária de Acesso ao Anexo",
        "description": "Gera uma **URL pré-assinada de download** (GET) válida por 30 minutos para o anexo da conversa.\n\nA URL é entregue pelo storage (S3/MinIO) e bypassa o backend — o cliente deve fazer requisição direta a ela. A cada chamada é gerada uma URL nova; URLs antigas continuam válidas até expirarem.\n\nO acesso só é concedido a participantes da conversa (a loja precisa estar registrada como participante `store`).",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "conversation",
            "in": "path",
            "required": true,
            "description": "ULID da conversa.",
            "schema": {
              "type": "string",
              "example": "01K8PB0KMM36AY2P0NKSZBP2NA"
            }
          },
          {
            "name": "attachment",
            "in": "path",
            "required": true,
            "description": "ULID do anexo.",
            "schema": {
              "type": "string",
              "example": "01K8PBATT00001VWXYZ12345678"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "URL gerada",
            "content": {
              "application/json": {
                "example": {
                  "success": true,
                  "message_code": "SUCCESS",
                  "data": {
                    "url": "https://cdn-content.s3.amazonaws.com/01K8PB0KMM36AY2P0NKSZBP2NA/01K8PBBKT00001ABCDE/01K8PBATT00001VWXYZ12345678.jpg?X-Amz-Signature=...",
                    "expires_at": "2026-05-19T12:02:08-03:00"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Loja não participa da conversa",
            "content": {
              "application/json": {
                "example": {
                  "success": false,
                  "code": 403,
                  "message_code": "CONVERSATION_NOT_PARTICIPANT",
                  "description": "Você não participa desta conversa.",
                  "data": [],
                  "errors": [
                    "Você não participa desta conversa."
                  ],
                  "meta": []
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/seller/interactions/questions": {
      "get": {
        "tags": [
          "Perguntas e Respostas"
        ],
        "summary": "Listar Perguntas",
        "description": "Lista paginada de perguntas das publicações vinculadas à loja autenticada, ordenadas da mais recente para a mais antiga.\n\nCada item carrega:\n- Dados mínimos do **cliente** que perguntou (nome, avatar).\n- A **publicação** associada (item_id, título, thumbnail e link para o storefront).\n- As **respostas** já cadastradas, com seu status de moderação.\n\nPerguntas em qualquer status (`PENDING`, `APPROVED`, `REJECTED`) são retornadas — utilize o campo `status` para filtrar na UI.",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "example": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Quantidade de itens por página. Default: 15.",
            "schema": {
              "type": "integer",
              "example": 15
            }
          },
          {
            "name": "item_id",
            "in": "query",
            "required": false,
            "description": "Filtra perguntas de uma publicação específica pelo `item_id` (identificador público da publicação, ex.: `US123456`).",
            "schema": {
              "type": "string",
              "example": "US123456"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Perguntas listadas",
            "content": {
              "application/json": {
                "examples": {
                  "perguntas_mistas": {
                    "summary": "Lista com perguntas pendentes e respondidas",
                    "value": {
                      "success": true,
                      "message_code": "SUCCESS",
                      "data": {
                        "meta": {
                          "search_query": "",
                          "filters": [],
                          "pagination": {
                            "page": 1,
                            "per_page": 15,
                            "last_page": 2,
                            "has_prev_page": false,
                            "has_next_page": true,
                            "records": {
                              "from": 1,
                              "to": 15,
                              "records": 23
                            }
                          }
                        },
                        "data": [
                          {
                            "uid": "01K8PB0KMM36AY2P0NKSZBP2NA",
                            "content": "Esse produto é compatível com a versão 2024?",
                            "status": "APPROVED",
                            "created_at": "2026-05-18T14:32:11.000000Z",
                            "customer": {
                              "name": "João",
                              "avatar_url": null,
                              "avatar_color": "#F97316"
                            },
                            "publication": {
                              "item_id": "US123456",
                              "title": "Furadeira de Impacto 750W",
                              "type": "default",
                              "thumbnail_url": "https://cdn.example.com/produtos/furadeira-sm.webp",
                              "frontend_url": "https://www.minha-loja.com.br/furadeira-de-impacto-750w/p/US123456"
                            },
                            "answers": []
                          },
                          {
                            "uid": "01K8PB1QRT7XYZAB2P0NKSZBP2",
                            "content": "Acompanha maleta?",
                            "status": "APPROVED",
                            "created_at": "2026-05-17T09:10:00.000000Z",
                            "customer": {
                              "name": "Maria",
                              "avatar_url": "https://cdn.example.com/avatars/maria.webp",
                              "avatar_color": "#22C55E"
                            },
                            "publication": {
                              "item_id": "US123456",
                              "title": "Furadeira de Impacto 750W",
                              "type": "default",
                              "thumbnail_url": "https://cdn.example.com/produtos/furadeira-sm.webp",
                              "frontend_url": "https://www.minha-loja.com.br/furadeira-de-impacto-750w/p/US123456"
                            },
                            "answers": [
                              {
                                "uid": "01K8PB2ANSW00000000000000A",
                                "content": "Sim, acompanha maleta plástica com brocas.",
                                "status": "APPROVED",
                                "author_type": "App\\Domains\\Stores\\Models\\Store",
                                "created_at": "2026-05-17T15:42:00.000000Z"
                              }
                            ]
                          },
                          {
                            "uid": "01K8PB3PENDING000000000000",
                            "content": "Posso usar 220V direto?",
                            "status": "PENDING",
                            "created_at": "2026-05-19T08:00:00.000000Z",
                            "customer": {
                              "name": "Cliente",
                              "avatar_url": null,
                              "avatar_color": "#3B82F6"
                            },
                            "publication": {
                              "item_id": "US987654",
                              "title": "Cafeteira Elétrica 1.2L",
                              "type": "default",
                              "thumbnail_url": "https://cdn.example.com/produtos/cafeteira-sm.webp",
                              "frontend_url": "https://www.minha-loja.com.br/cafeteira-eletrica-1-2l/p/US987654"
                            },
                            "answers": []
                          }
                        ]
                      }
                    }
                  },
                  "lista_vazia": {
                    "summary": "Loja sem perguntas",
                    "value": {
                      "success": true,
                      "message_code": "SUCCESS",
                      "data": {
                        "meta": {
                          "search_query": "",
                          "filters": [],
                          "pagination": {
                            "page": 1,
                            "per_page": 15,
                            "last_page": 1,
                            "has_prev_page": false,
                            "has_next_page": false,
                            "records": {
                              "from": 0,
                              "to": 0,
                              "records": 0
                            }
                          }
                        },
                        "data": []
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/api/seller/interactions/questions/{uid}/answer": {
      "post": {
        "tags": [
          "Perguntas e Respostas"
        ],
        "summary": "Responder Pergunta",
        "description": "Cria uma resposta para a pergunta identificada por `uid`, em nome da loja autenticada.\n\n**Comportamento de moderação:**\n- Por padrão, a resposta entra como `PENDING` e aguarda moderação para se tornar visível ao público.\n- Se a loja tiver a *feature* `trusted_answers` habilitada, a resposta é publicada **imediatamente** como `APPROVED` (modo `asAdmin`).\n\nO `author_type` retornado será sempre `App\\Domains\\Stores\\Models\\Store` — o autor da resposta é a loja, não o usuário logado.",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "uid",
            "in": "path",
            "required": true,
            "description": "ULID da pergunta que será respondida.",
            "schema": {
              "type": "string",
              "example": "01K8PB0KMM36AY2P0NKSZBP2NA"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "content"
                ],
                "properties": {
                  "content": {
                    "type": "string",
                    "minLength": 2,
                    "description": "Texto da resposta. Mínimo de 2 caracteres."
                  }
                }
              },
              "example": {
                "content": "Sim, este produto é compatível com a versão 2024 e acompanha cabo USB-C."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Resposta criada",
            "content": {
              "application/json": {
                "examples": {
                  "resposta_pendente_moderacao": {
                    "summary": "Loja padrão — resposta entra em moderação",
                    "value": {
                      "success": true,
                      "message_code": "RESOURCE_CREATED",
                      "data": {
                        "uid": "01K8PB2ANSW00000000000000A",
                        "content": "Sim, este produto é compatível com a versão 2024 e acompanha cabo USB-C.",
                        "status": "PENDING",
                        "author_type": "App\\Domains\\Stores\\Models\\Store",
                        "created_at": "2026-05-19T10:15:42.000000Z"
                      }
                    }
                  },
                  "resposta_trusted_answers": {
                    "summary": "Loja com feature trusted_answers — resposta já aprovada",
                    "value": {
                      "success": true,
                      "message_code": "RESOURCE_CREATED",
                      "data": {
                        "uid": "01K8PB2ANSW00000000000000B",
                        "content": "Sim, este produto é compatível com a versão 2024 e acompanha cabo USB-C.",
                        "status": "APPROVED",
                        "author_type": "App\\Domains\\Stores\\Models\\Store",
                        "created_at": "2026-05-19T10:15:42.000000Z"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Usuário autenticado, porém sem loja associada",
            "content": {
              "application/json": {
                "example": {
                  "success": false,
                  "code": 403,
                  "message_code": "FORBIDDEN",
                  "description": "Você não tem permissão para acessar este recurso.",
                  "data": [],
                  "errors": [
                    "No store associated with user."
                  ],
                  "meta": []
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/api/seller/interactions/unanswered-count": {
      "get": {
        "tags": [
          "Perguntas e Respostas"
        ],
        "summary": "Contador de Perguntas Sem Resposta",
        "description": "Retorna o **número de perguntas aprovadas e ainda não respondidas** da loja autenticada, junto com a idade (em horas) da pergunta sem resposta mais antiga.\n\nUsado pelos *widgets* de dashboard do portal do seller para sinalizar atrasos no atendimento de Q&A.\n\n**Regra de contagem:** apenas `Question` com `status = APPROVED` que **não possuem nenhuma** `Answer` com `status = APPROVED`. Respostas pendentes ou rejeitadas não \"zeram\" o contador.\n\nO campo `deep_link` é um caminho relativo do portal do seller para a tela já filtrada por perguntas não respondidas.",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Contagem retornada",
            "content": {
              "application/json": {
                "examples": {
                  "com_perguntas_pendentes": {
                    "summary": "Loja com perguntas aguardando resposta",
                    "value": {
                      "success": true,
                      "message_code": "Perguntas sem resposta",
                      "data": {
                        "count": 2,
                        "oldest_age_hours": 14,
                        "deep_link": "/portal/interacoes/perguntas?status=unanswered"
                      }
                    }
                  },
                  "sem_pendencias": {
                    "summary": "Loja sem perguntas em aberto",
                    "value": {
                      "success": true,
                      "message_code": "Perguntas sem resposta",
                      "data": {
                        "count": 0,
                        "oldest_age_hours": null,
                        "deep_link": "/portal/interacoes/perguntas?status=unanswered"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "integrationToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "Token de Integração da loja (formato: sk_...). Criado em Configurações → Tokens de Integração no painel do seller."
      }
    },
    "schemas": {
      "Product": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "ID do produto (26 caracteres)"
          },
          "name": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "price_type": {
            "type": "string",
            "enum": [
              "default",
              "wholesale"
            ]
          },
          "base_unit": {
            "type": "string",
            "enum": [
              "un",
              "kg",
              "pc",
              "cx",
              "pct",
              "lt",
              "mt",
              "m2",
              "m3"
            ]
          },
          "dimensions": {
            "type": "object",
            "properties": {
              "width": {
                "type": "number",
                "description": "Largura em cm"
              },
              "height": {
                "type": "number",
                "description": "Altura em cm"
              },
              "length": {
                "type": "number",
                "description": "Comprimento em cm"
              },
              "weight": {
                "type": "number",
                "description": "Peso em kg"
              }
            }
          },
          "is_available_for_sale": {
            "type": "boolean",
            "description": "Indica se o produto está disponível para venda",
            "default": true
          },
          "is_industrializable": {
            "type": "boolean",
            "description": "Indica se o produto pode ser fabricado sob demanda"
          },
          "auto_wholesale_pricing": {
            "type": "boolean",
            "description": "Indica se os preços das faixas de atacado são derivados automaticamente do percentual de desconto"
          },
          "allow_sale_without_stock": {
            "type": "boolean",
            "description": "Permite venda sem estoque disponível (pedido sob encomenda)"
          },
          "dimensions_formatted": {
            "type": "object",
            "nullable": true,
            "description": "Dimensões formatadas para exibição (somente se include_dimensions_formatted=true)",
            "properties": {
              "width": {
                "type": "string",
                "nullable": true,
                "example": "10,00 cm"
              },
              "height": {
                "type": "string",
                "nullable": true,
                "example": "10,00 cm"
              },
              "length": {
                "type": "string",
                "nullable": true,
                "example": "10,00 cm"
              },
              "weight": {
                "type": "string",
                "nullable": true,
                "example": "500g"
              }
            }
          },
          "quantity": {
            "type": "number",
            "description": "Quantidade total em estoque"
          },
          "reserved_quantity": {
            "type": "number",
            "description": "Quantidade reservada"
          },
          "available_quantity": {
            "type": "number",
            "description": "Quantidade disponível para venda (quantity - reserved_quantity)"
          },
          "price": {
            "type": "number",
            "description": "Preço de venda (somente para price_type=default)"
          },
          "min_price": {
            "type": "number",
            "description": "Menor preço entre as faixas (somente para price_type=wholesale)"
          },
          "max_price": {
            "type": "number",
            "description": "Maior preço entre as faixas (somente para price_type=wholesale)"
          },
          "thumbnail": {
            "type": "object",
            "nullable": true,
            "description": "Imagem de destaque do produto (variantes thumbnail e md)",
            "properties": {
              "id": {
                "type": "string",
                "description": "ID da imagem"
              },
              "resources": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "Nome da variante (thumbnail, sm, md, lg)"
                    },
                    "size": {
                      "type": "string",
                      "description": "Dimensões da variante (ex: 400x400)"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "ProductInput": {
        "type": "object",
        "required": [
          "name",
          "sku",
          "base_unit",
          "price_type",
          "dimensions"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "sku": {
            "type": "string",
            "maxLength": 50,
            "description": "Deve ser único por loja"
          },
          "base_unit": {
            "type": "string",
            "enum": [
              "un",
              "kg",
              "pc",
              "cx",
              "pct",
              "lt",
              "mt",
              "m2",
              "m3"
            ]
          },
          "price_type": {
            "type": "string",
            "enum": [
              "default",
              "wholesale"
            ]
          },
          "is_available_for_sale": {
            "type": "boolean",
            "default": true
          },
          "is_industrializable": {
            "type": "boolean",
            "nullable": true
          },
          "allow_sale_without_stock": {
            "type": "boolean",
            "nullable": true,
            "description": "Permite venda sem estoque disponível (pedido sob encomenda)"
          },
          "auto_wholesale_pricing": {
            "type": "boolean",
            "description": "Opcional. Deriva automaticamente os preços das faixas de atacado a partir do percentual de desconto"
          },
          "dimensions": {
            "type": "object",
            "required": [
              "width",
              "height",
              "length",
              "weight"
            ],
            "properties": {
              "width": {
                "type": "number",
                "minimum": 0.001,
                "description": "Largura em cm"
              },
              "height": {
                "type": "number",
                "minimum": 0.001,
                "description": "Altura em cm"
              },
              "length": {
                "type": "number",
                "minimum": 0.001,
                "description": "Comprimento em cm"
              },
              "weight": {
                "type": "number",
                "minimum": 0.001,
                "description": "Peso em kg"
              }
            }
          }
        }
      },
      "ProductUpdateInput": {
        "type": "object",
        "description": "Corpo da atualização de produto. Diferente da criação, o `sku` não é aceito (é ignorado se enviado) e apenas `name` e `dimensions` são obrigatórios.",
        "required": [
          "name",
          "dimensions"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "base_unit": {
            "type": "string",
            "description": "Opcional. Mantém o valor atual quando omitido",
            "enum": [
              "un",
              "kg",
              "pc",
              "cx",
              "pct",
              "lt",
              "mt",
              "m2",
              "m3"
            ]
          },
          "price_type": {
            "type": "string",
            "description": "Opcional. Veja as regras de troca na descrição do endpoint",
            "enum": [
              "default",
              "wholesale"
            ]
          },
          "is_available_for_sale": {
            "type": "boolean",
            "description": "Opcional"
          },
          "is_industrializable": {
            "type": "boolean",
            "description": "Opcional"
          },
          "allow_sale_without_stock": {
            "type": "boolean",
            "description": "Opcional. Permite venda sem estoque disponível (pedido sob encomenda)"
          },
          "auto_wholesale_pricing": {
            "type": "boolean",
            "description": "Opcional. Deriva automaticamente os preços das faixas de atacado a partir do percentual de desconto"
          },
          "dimensions": {
            "type": "object",
            "required": [
              "width",
              "height",
              "length",
              "weight"
            ],
            "properties": {
              "width": {
                "type": "number",
                "minimum": 0.001,
                "description": "Largura em cm"
              },
              "height": {
                "type": "number",
                "minimum": 0.001,
                "description": "Altura em cm"
              },
              "length": {
                "type": "number",
                "minimum": 0.001,
                "description": "Comprimento em cm"
              },
              "weight": {
                "type": "number",
                "minimum": 0.001,
                "description": "Peso em kg"
              }
            }
          }
        }
      },
      "Price": {
        "type": "object",
        "properties": {
          "value": {
            "type": "number",
            "description": "Valor unitário da faixa"
          },
          "min_quantity": {
            "type": "integer",
            "description": "Quantidade mínima para a faixa valer"
          },
          "discount_percent": {
            "type": "number",
            "nullable": true,
            "description": "Percentual de desconto da faixa em relação ao preço-base (usado no atacado automático)"
          },
          "package_weight": {
            "type": "number",
            "nullable": true,
            "description": "Peso da embalagem da faixa em kg"
          },
          "package_height": {
            "type": "number",
            "nullable": true,
            "description": "Altura da embalagem da faixa em cm"
          },
          "package_width": {
            "type": "number",
            "nullable": true,
            "description": "Largura da embalagem da faixa em cm"
          },
          "package_length": {
            "type": "number",
            "nullable": true,
            "description": "Comprimento da embalagem da faixa em cm"
          }
        }
      },
      "Stock": {
        "type": "object",
        "properties": {
          "location_stock": {
            "type": "object",
            "properties": {
              "location_id": {
                "type": "string",
                "description": "ID do local de estoque"
              },
              "store_id": {
                "type": "string",
                "description": "ID da loja"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "available",
                  "unavailable"
                ]
              },
              "location_type": {
                "type": "string",
                "enum": [
                  "seller_location",
                  "fulfillment"
                ]
              },
              "allows_pickup": {
                "type": "boolean",
                "description": "Local permite retirada"
              },
              "allows_production": {
                "type": "boolean",
                "description": "Local permite produção sob demanda"
              }
            }
          },
          "quantity": {
            "type": "number"
          },
          "reserved_quantity": {
            "type": "number"
          },
          "available_quantity": {
            "type": "number"
          }
        }
      },
      "PaginationMeta": {
        "type": "object",
        "properties": {
          "search_query": {
            "type": "string"
          },
          "filters": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "pagination": {
            "type": "object",
            "properties": {
              "page": {
                "type": "integer"
              },
              "per_page": {
                "type": "integer"
              },
              "last_page": {
                "type": "integer"
              },
              "has_prev_page": {
                "type": "boolean"
              },
              "has_next_page": {
                "type": "boolean"
              },
              "records": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "integer"
                  },
                  "to": {
                    "type": "integer"
                  },
                  "records": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        }
      },
      "PriceInput": {
        "type": "object",
        "properties": {
          "price": {
            "type": "number",
            "nullable": true,
            "description": "Valor monetário da faixa. Obrigatório na precificação manual (se omitido vira 0). Em produtos `wholesale` com `auto_wholesale_pricing` ligado é ignorado nas faixas `min_quantity >= 2` — o preço é calculado a partir do preço base e do `discount_percent`."
          },
          "min_quantity": {
            "type": "integer",
            "default": 1,
            "description": "Quantidade mínima para ativar este preço (Padrão: 1). Produtos `default` só aceitam `min_quantity = 1`."
          },
          "discount_percent": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "description": "Percentual de desconto sobre o preço base unitário (0 a menos de 100). Usado nas faixas de atacado automáticas; os descontos precisam ser progressivos (faixa de quantidade maior exige desconto maior).",
            "exclusiveMaximum": 100
          },
          "package_weight": {
            "type": "number",
            "nullable": true,
            "minimum": 0.001,
            "description": "Peso da embalagem fechada, em kg. Faz parte das medidas obrigatórias das faixas de atacado (`min_quantity >= 2`)."
          },
          "package_height": {
            "type": "number",
            "nullable": true,
            "minimum": 0.01,
            "description": "Altura da embalagem fechada, em cm. Faz parte das medidas obrigatórias das faixas de atacado."
          },
          "package_width": {
            "type": "number",
            "nullable": true,
            "minimum": 0.01,
            "description": "Largura da embalagem fechada, em cm. Faz parte das medidas obrigatórias das faixas de atacado."
          },
          "package_length": {
            "type": "number",
            "nullable": true,
            "minimum": 0.01,
            "description": "Comprimento da embalagem fechada, em cm. Faz parte das medidas obrigatórias das faixas de atacado."
          }
        }
      },
      "ProductStockOverview": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "description": "Quantidade total de estoque somando todas as localizações.",
            "example": 150
          },
          "stocks": {
            "type": "array",
            "description": "Lista detalhada de estoque do produto em cada localização.",
            "items": {
              "$ref": "#/components/schemas/ProductStockDetail"
            }
          },
          "locations": {
            "type": "array",
            "description": "Lista de todas as localizações disponíveis para a loja.",
            "items": {
              "$ref": "#/components/schemas/LocationStock"
            }
          }
        }
      },
      "ProductStock": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Identificador interno do registro de estoque.",
            "example": 321
          },
          "product_id": {
            "type": "string",
            "description": "ID do produto.",
            "example": "01H81AV32307PVBSV4RXF15EK9"
          },
          "location_id": {
            "type": "string",
            "description": "ID da localização de estoque.",
            "example": "01H81AV32307PVBSV4RXF15LOC"
          },
          "quantity": {
            "type": "integer",
            "description": "Quantidade atual em estoque.",
            "example": 50
          },
          "reserved_quantity": {
            "type": "integer",
            "description": "Quantidade reservada (não disponível para venda imediata).",
            "example": 0
          },
          "available_quantity": {
            "type": "integer",
            "description": "Quantidade disponível para venda (quantity - reserved_quantity).",
            "example": 50
          }
        }
      },
      "ProductStockDetail": {
        "type": "object",
        "description": "Registro de estoque do produto em uma localização, com o produto e o local aninhados.",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Identificador interno do registro de estoque.",
            "example": 321
          },
          "product_sku": {
            "type": "object",
            "description": "Dados do produto (id, name, sku, base_unit, dimensions, flags de venda, prices, totais de estoque, thumbnail e images)."
          },
          "location_stock": {
            "$ref": "#/components/schemas/LocationStock"
          },
          "quantity": {
            "type": "integer",
            "description": "Quantidade física nesta localização.",
            "example": 100
          },
          "reserved_quantity": {
            "type": "integer",
            "description": "Quantidade reservada em carrinhos/pedidos abertos.",
            "example": 5
          },
          "available_quantity": {
            "type": "integer",
            "description": "Quantidade disponível para venda (quantity - reserved_quantity).",
            "example": 95
          }
        }
      },
      "LocationStock": {
        "type": "object",
        "properties": {
          "location_id": {
            "type": "string",
            "description": "ID da localização.",
            "example": "01H81AV32307PVBSV4RXF15LOC"
          },
          "store_id": {
            "type": "integer",
            "description": "Identificador interno da loja dona do local.",
            "example": 42
          },
          "name": {
            "type": "string",
            "description": "Nome da localização.",
            "example": "Matriz - São Paulo"
          },
          "status": {
            "type": "string",
            "enum": [
              "available",
              "unavailable"
            ],
            "description": "Status da localização.",
            "example": "available"
          },
          "location_type": {
            "type": "string",
            "enum": [
              "seller_location",
              "fulfillment"
            ],
            "description": "Tipo da localização.",
            "example": "seller_location"
          },
          "allows_pickup": {
            "type": "boolean",
            "description": "Indica se o local permite retirada em mãos.",
            "example": false
          },
          "allows_production": {
            "type": "boolean",
            "description": "Indica se o local permite produção sob demanda.",
            "example": false
          }
        }
      },
      "StockUpdateInput": {
        "type": "object",
        "required": [
          "location_id",
          "quantity"
        ],
        "properties": {
          "location_id": {
            "type": "string",
            "description": "ID da localização onde o estoque será alterado.",
            "example": "01H81AV32307PVBSV4RXF15LOC"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "description": "Quantidade a ser definida, incrementada ou decrementada.",
            "example": 10
          },
          "increment": {
            "type": "boolean",
            "description": "Se verdadeiro, soma a quantidade ao estoque atual.",
            "default": false,
            "example": false
          },
          "decrement": {
            "type": "boolean",
            "description": "Se verdadeiro, subtrai a quantidade do estoque atual.",
            "default": false,
            "example": false
          }
        }
      },
      "SuccessResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "message_code": {
            "type": "string",
            "example": "SUCCESS"
          },
          "data": {
            "type": "object"
          },
          "meta": {
            "type": "object",
            "description": "Presente apenas quando há metadados a retornar."
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "code": {
            "type": "integer",
            "example": 400
          },
          "message_code": {
            "type": "string",
            "example": "BAD_REQUEST"
          },
          "description": {
            "type": "string",
            "example": "Erro na requisição."
          },
          "data": {
            "type": "array",
            "items": {},
            "example": []
          },
          "errors": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "meta": {
            "type": "array",
            "items": {},
            "example": []
          }
        }
      },
      "LocationStockInput": {
        "type": "object",
        "required": [
          "name",
          "status",
          "location_type"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "available",
              "unavailable"
            ],
            "default": "available"
          },
          "location_type": {
            "type": "string",
            "enum": [
              "seller_location"
            ],
            "default": "seller_location"
          },
          "allows_pickup": {
            "type": "boolean",
            "default": false,
            "description": "Permite retirada no local"
          },
          "allows_production": {
            "type": "boolean",
            "default": false,
            "description": "Permite producao sob demanda"
          },
          "company_branch_uid": {
            "type": "string",
            "nullable": true,
            "description": "ID da filial a vincular ao local. Precisa ser uma filial ativa da empresa; omita para deixar o local respondendo pela matriz."
          }
        }
      },
      "Address": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "ID do endereco"
          },
          "uid": {
            "type": "string",
            "description": "Mesmo valor de id (mantido por compatibilidade)"
          },
          "street": {
            "type": "string"
          },
          "number": {
            "type": "string"
          },
          "complement": {
            "type": "string",
            "nullable": true
          },
          "reference": {
            "type": "string",
            "nullable": true,
            "description": "Ponto de referencia"
          },
          "can_deliver_to_neighbor": {
            "type": "boolean",
            "description": "Se o entregador pode deixar com um vizinho"
          },
          "delivery_instructions": {
            "type": "string",
            "nullable": true,
            "description": "Instrucoes de entrega"
          },
          "district": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "zip_code": {
            "type": "string",
            "description": "CEP formatado (00000-000)"
          },
          "latitude": {
            "type": "number"
          },
          "longitude": {
            "type": "number"
          },
          "place_id": {
            "type": "string",
            "nullable": true,
            "description": "Identificador do lugar no provedor de geocodificacao"
          },
          "address_components": {
            "nullable": true,
            "description": "Componentes estruturados do endereco retornados pelo provedor de geocodificacao"
          },
          "full_address": {
            "type": "string",
            "description": "Endereco completo em uma unica linha"
          },
          "is_complete": {
            "type": "boolean",
            "description": "Indica se o endereco ja possui coordenadas resolvidas"
          },
          "type": {
            "type": "string",
            "enum": [
              "logistics",
              "local_real",
              "local_devolucao"
            ],
            "description": "O tipo do endereco. Pelo menos um endereco do tipo 'logistics' e obrigatorio para o local de estoque operar."
          },
          "type_label": {
            "type": "string",
            "nullable": true,
            "description": "Rotulo legivel do tipo"
          }
        }
      },
      "AddressInput": {
        "type": "object",
        "required": [
          "zip_code",
          "street",
          "number",
          "district",
          "city",
          "state",
          "type"
        ],
        "properties": {
          "zip_code": {
            "type": "string",
            "description": "CEP (apenas numeros ou com traco, formato 00000-000 ou 00000000)"
          },
          "street": {
            "type": "string",
            "minLength": 3
          },
          "number": {
            "type": "string",
            "maxLength": 20
          },
          "complement": {
            "type": "string",
            "nullable": true,
            "maxLength": 255
          },
          "reference": {
            "type": "string",
            "nullable": true,
            "maxLength": 60,
            "description": "Ponto de referencia"
          },
          "can_deliver_to_neighbor": {
            "type": "boolean",
            "nullable": true,
            "description": "Se o entregador pode deixar com um vizinho"
          },
          "delivery_instructions": {
            "type": "string",
            "nullable": true,
            "maxLength": 150,
            "description": "Instrucoes de entrega"
          },
          "district": {
            "type": "string",
            "minLength": 2
          },
          "city": {
            "type": "string",
            "minLength": 2
          },
          "state": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2
          },
          "country": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2,
            "default": "BR"
          },
          "latitude": {
            "type": "number",
            "nullable": true,
            "description": "Se omitido, a plataforma tenta resolver as coordenadas pelo CEP ou por geocodificacao"
          },
          "longitude": {
            "type": "number",
            "nullable": true
          },
          "place_id": {
            "type": "string",
            "nullable": true
          },
          "address_components": {
            "type": "array",
            "nullable": true,
            "items": {}
          },
          "type": {
            "type": "string",
            "enum": [
              "logistics",
              "local_real",
              "local_devolucao"
            ],
            "description": "Tipo de endereco para este local. Valores validos: logistics, local_real, local_devolucao"
          }
        }
      },
      "AddressUpdateInput": {
        "type": "object",
        "description": "Mesmos campos do cadastro, porem todos opcionais — envie apenas o que quer alterar.",
        "properties": {
          "zip_code": {
            "type": "string",
            "description": "CEP (apenas numeros ou com traco, formato 00000-000 ou 00000000)"
          },
          "street": {
            "type": "string",
            "minLength": 3
          },
          "number": {
            "type": "string",
            "maxLength": 20
          },
          "complement": {
            "type": "string",
            "nullable": true,
            "maxLength": 255
          },
          "reference": {
            "type": "string",
            "nullable": true,
            "maxLength": 60
          },
          "can_deliver_to_neighbor": {
            "type": "boolean",
            "nullable": true
          },
          "delivery_instructions": {
            "type": "string",
            "nullable": true,
            "maxLength": 150
          },
          "district": {
            "type": "string",
            "minLength": 2
          },
          "city": {
            "type": "string",
            "minLength": 2
          },
          "state": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2
          },
          "country": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2
          },
          "latitude": {
            "type": "number",
            "nullable": true
          },
          "longitude": {
            "type": "number",
            "nullable": true
          },
          "place_id": {
            "type": "string",
            "nullable": true
          },
          "address_components": {
            "type": "array",
            "nullable": true,
            "items": {}
          },
          "type": {
            "type": "string",
            "nullable": true,
            "enum": [
              "logistics",
              "local_real",
              "local_devolucao"
            ],
            "description": "Novo tipo do vinculo do endereco com o local"
          }
        }
      },
      "CategoriesResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message_code": {
            "type": "string"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Category"
            }
          }
        },
        "required": [
          "success",
          "message_code",
          "data"
        ]
      },
      "Category": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID da categoria"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "departament": {
            "$ref": "#/components/schemas/Department"
          },
          "parent": {
            "$ref": "#/components/schemas/ParentCategory"
          },
          "is_visible": {
            "type": "boolean"
          },
          "priority": {
            "type": "integer"
          },
          "domain": {
            "type": "string"
          },
          "level": {
            "type": "integer"
          },
          "hierarchy": {
            "type": "array",
            "description": "Breadcrumb completo da categoria (cada nível com id e nome)",
            "items": {
              "$ref": "#/components/schemas/HierarchyLevel"
            }
          },
          "settings": {
            "type": "array",
            "items": {}
          },
          "catalog_overrides": {
            "type": [
              "object",
              "null"
            ]
          },
          "total_children": {
            "type": "integer"
          },
          "children": {
            "type": "array",
            "description": "Subcategorias (recursivo). Na busca, só voltam folhas — portanto vazio.",
            "items": {
              "$ref": "#/components/schemas/Category"
            }
          }
        },
        "required": [
          "id",
          "name",
          "departament",
          "parent"
        ]
      },
      "HierarchyLevel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ]
      },
      "Department": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID do departamento"
          },
          "name": {
            "type": "string"
          },
          "icon_svg": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name"
        ]
      },
      "ParentCategory": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "parent_id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "hierarchy": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HierarchyLevel"
            }
          }
        },
        "required": [
          "id",
          "parent_id",
          "name"
        ]
      },
      "CategoryAttributesResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message_code": {
            "type": "string"
          },
          "data": {
            "type": "array",
            "description": "Com `matrix=true`, lista de grupos (`AttributeGroup`). Sem `matrix`, lista plana de atributos (`AttributeItem`).",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/AttributeGroup"
                },
                {
                  "$ref": "#/components/schemas/AttributeItem"
                }
              ]
            }
          }
        },
        "required": [
          "success",
          "message_code",
          "data"
        ]
      },
      "AttributeGroup": {
        "type": "object",
        "properties": {
          "key": {
            "type": [
              "string",
              "null"
            ],
            "description": "Chave da matriz (ex: identification, appearance, technical). `null` para atributos sem matriz."
          },
          "label": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AttributeItem"
            }
          }
        },
        "required": [
          "key",
          "label",
          "items"
        ]
      },
      "AttributeItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID do vínculo categoria-atributo"
          },
          "attribute_id": {
            "type": "integer",
            "description": "ID do atributo"
          },
          "category_id": {
            "type": "integer",
            "description": "ID da categoria"
          },
          "is_required": {
            "type": "boolean",
            "description": "Indica se o atributo e obrigatorio para a categoria"
          },
          "is_feature": {
            "type": "boolean",
            "description": "Indica se e uma caracteristica do produto"
          },
          "is_variant": {
            "type": "boolean",
            "description": "Indica se e um atributo de variacao"
          },
          "is_combinable": {
            "type": "boolean",
            "description": "Indica se pode ser usado em combinacoes para variacoes"
          },
          "is_filter": {
            "type": "boolean",
            "description": "Indica se o atributo aparece como filtro na vitrine"
          },
          "attribute_data": {
            "$ref": "#/components/schemas/AttributeData"
          }
        },
        "required": [
          "id",
          "attribute_id",
          "category_id",
          "is_required",
          "is_feature",
          "is_variant",
          "is_combinable",
          "is_filter"
        ]
      },
      "AttributeData": {
        "type": "object",
        "description": "Definição do atributo. O bloco `value_definition` é autodescritivo: traz os campos esperados (`fields`), as opções pré-cadastradas (`options`, quando houver) e as unidades disponíveis.",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID do atributo"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "default",
              "default_unit",
              "default_list",
              "dimension_3d",
              "dimension_2d",
              "color",
              "image",
              "brand",
              "packaging"
            ],
            "description": "Tipo estrutural do atributo. `default_unit` exige `unit`; `dimension_2d/3d` exigem width/height(/depth)+unit; `color` aceita opção pré-cadastrada ou cor customizada (value + hex)."
          },
          "value_type": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "text",
              "float",
              "number",
              "date",
              "boolean",
              "select",
              "radio",
              "checkbox",
              null
            ],
            "description": "Tipo do valor para atributos default. Tipos especializados (color, image, brand, packaging) ignoram este campo."
          },
          "is_feature": {
            "type": "boolean"
          },
          "is_variant": {
            "type": "boolean"
          },
          "is_calculable": {
            "type": "boolean",
            "description": "Atributo usado em cálculos (ex: Quantidade, que precisa casar com a unidade base do SKU)"
          },
          "domain": {
            "type": [
              "string",
              "null"
            ]
          },
          "ui": {
            "type": "object",
            "properties": {
              "public_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "matrix": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Matriz de organização (identification, appearance, technical, dimensions, ...)"
              },
              "select_type": {
                "type": "string",
                "enum": [
                  "select",
                  "radio",
                  "checkbox",
                  "text"
                ],
                "description": "Como o valor é escolhido. `text` = digitação livre; os demais exigem opção pré-cadastrada (exceto atributos de cor, que aceitam cor customizada)."
              }
            }
          },
          "value_definition": {
            "type": "object",
            "properties": {
              "fields": {
                "type": "object",
                "description": "Schema dos campos esperados no valor (montagem dinâmica de formulário)"
              },
              "options": {
                "type": "array",
                "description": "Opções pré-cadastradas (presente apenas quando o atributo tem opções)",
                "items": {
                  "$ref": "#/components/schemas/AttributeOption"
                }
              },
              "default_unit": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "available_units": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "AttributeOption": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID da opção (use em `value_id` ao criar o anúncio)"
          },
          "attribute_id": {
            "type": "integer"
          },
          "value": {
            "type": "string"
          },
          "component": {
            "type": "object",
            "description": "Payload visual da opção, varia por tipo de atributo. Para cor: `{ value, main_color, hex, brightness }`.",
            "additionalProperties": true
          },
          "position": {
            "type": "integer"
          },
          "is_default": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "attribute_id",
          "value",
          "component",
          "position",
          "is_default"
        ]
      },
      "AttributeCombinationsResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message_code": {
            "type": "string"
          },
          "data": {
            "type": "object",
            "properties": {
              "combinations": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AttributeCombination"
                }
              },
              "primary_attribute": {
                "$ref": "#/components/schemas/PrimaryAttributeInfo"
              }
            },
            "required": [
              "combinations",
              "primary_attribute"
            ]
          }
        },
        "required": [
          "success",
          "message_code",
          "data"
        ]
      },
      "AttributeCombination": {
        "type": "object",
        "properties": {
          "attributes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CombinationAttribute"
            }
          },
          "attributes_details": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "description": {
            "type": "string"
          }
        },
        "required": [
          "attributes",
          "attributes_details",
          "description"
        ]
      },
      "CombinationAttribute": {
        "type": "object",
        "properties": {
          "attribute_id": {
            "type": "integer",
            "description": "ID do atributo"
          },
          "attribute_name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "unit": {
            "type": "string",
            "description": "Unidade de medida (presente apenas quando aplicável)"
          },
          "hex": {
            "type": "string",
            "description": "Cor em hexadecimal (presente apenas para atributos de cor)"
          },
          "main_color": {
            "type": "string",
            "description": "Cor principal (presente apenas para atributos de cor)"
          },
          "brightness": {
            "type": "string",
            "enum": [
              "light",
              "dark"
            ],
            "description": "Luminosidade calculada da cor (presente apenas para atributos de cor)"
          },
          "width": {
            "type": [
              "string",
              "number"
            ],
            "description": "Largura (presente apenas para atributos de dimensão)"
          },
          "height": {
            "type": [
              "string",
              "number"
            ],
            "description": "Altura (presente apenas para atributos de dimensão)"
          }
        },
        "required": [
          "attribute_id",
          "attribute_name",
          "value"
        ]
      },
      "PrimaryAttributeInfo": {
        "type": "object",
        "description": "Atributo principal das combinações — facilita organizar fotos por variação no front.",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID do atributo principal"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "has_options": {
            "type": "boolean"
          },
          "default_unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "values": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "hex": {
                  "type": "string"
                },
                "main_color": {
                  "type": "string"
                },
                "brightness": {
                  "type": "string"
                }
              },
              "required": [
                "value",
                "label"
              ]
            }
          }
        },
        "required": [
          "id",
          "name",
          "has_options",
          "default_unit",
          "values"
        ]
      },
      "CreateAdvertisementRequest": {
        "type": "object",
        "description": "É obrigatório informar `seller_sku` (anúncio sem variações) ou `variations` — um dos dois precisa estar presente. Os SKUs devem existir previamente na loja.",
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 100,
            "description": "Titulo do anuncio"
          },
          "category_id": {
            "type": "integer",
            "description": "ID da categoria selecionada (precisa ser categoria folha existente)"
          },
          "gtin": {
            "$ref": "#/components/schemas/GTIN"
          },
          "seller_sku": {
            "type": [
              "string",
              "null"
            ],
            "description": "SKU do produto para anúncio sem variações. Obrigatório quando `variations` não for enviado. O SKU precisa existir na loja."
          },
          "attributes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AdvertisementAttribute"
            },
            "description": "Atributos de caracteristicas do produto. Obrigatório quando a categoria possui atributos com `is_required=true`."
          },
          "variations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AdvertisementVariation"
            },
            "description": "Variacoes do produto. Obrigatório quando `seller_sku` não for enviado."
          },
          "images": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImageReference"
            },
            "description": "Imagens do anuncio principal. Opcional na criação, mas o checklist exige pelo menos uma imagem para publicar."
          },
          "description": {
            "$ref": "#/components/schemas/PublicationDescription",
            "description": "Descrição longa do anúncio. Opcional. Pode ser informada na criação ou depois via PUT /api/items/{id}/description."
          },
          "technical_sheets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TechnicalSheetInput"
            },
            "description": "Fichas técnicas do anúncio. Opcionais. Também podem ser criadas ou editadas depois via /api/items/{id}/technical-sheets."
          }
        },
        "required": [
          "title",
          "category_id"
        ]
      },
      "PublicationDescription": {
        "type": "object",
        "description": "Aceita um objeto `{ layout, raw_content }` ou uma string simples (legado, equivale a `layout=markdown`).",
        "properties": {
          "layout": {
            "type": "string",
            "enum": [
              "text",
              "html",
              "markdown"
            ],
            "description": "Formato do `raw_content`. Default: `markdown`."
          },
          "raw_content": {
            "type": "string",
            "description": "Conteúdo bruto da descrição no formato indicado por `layout`."
          }
        }
      },
      "TechnicalSheetInput": {
        "type": "object",
        "required": [
          "type",
          "title"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "technical_specification",
              "characteristics",
              "materials",
              "installation",
              "maintenance",
              "safety",
              "environmental",
              "custom"
            ],
            "description": "Tipo da ficha técnica."
          },
          "title": {
            "type": "string",
            "maxLength": 255,
            "description": "Título exibido para a seção da ficha."
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "item_key",
                "item_value"
              ],
              "properties": {
                "item_key": {
                  "type": "string",
                  "maxLength": 255
                },
                "item_value": {
                  "type": "string",
                  "maxLength": 1000
                },
                "display_order": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          }
        }
      },
      "GTIN": {
        "type": "object",
        "properties": {
          "type": {
            "type": [
              "integer",
              "string"
            ],
            "enum": [
              8,
              12,
              13,
              14,
              "8",
              "12",
              "13",
              "14"
            ],
            "description": "Tipo de GTIN: 8, 12, 13 ou 14 dígitos (13 para EAN-13). Nas respostas, vem como string."
          },
          "value": {
            "type": "string",
            "description": "Numero do codigo de barras"
          }
        }
      },
      "AdvertisementAttribute": {
        "type": "object",
        "description": "Valor de um atributo do anúncio. Campos extras dependem do tipo do atributo: cor customizada usa `hex`/`main_color`/`brightness`; dimensões usam `width`/`height`/`depth` + `unit`; listas usam `items`.",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID do atributo"
          },
          "value_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "ID da opção selecionada (para atributos com opcoes pré-cadastradas)"
          },
          "option_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Alias aceito para `value_id`"
          },
          "value": {
            "type": [
              "string",
              "integer",
              "null"
            ],
            "description": "Valor do atributo"
          },
          "unit": {
            "type": [
              "string",
              "null"
            ],
            "description": "Unidade de medida (obrigatória em atributos do tipo default_unit; precisa estar em available_units)"
          },
          "hex": {
            "type": [
              "string",
              "null"
            ],
            "description": "Cor customizada em hexadecimal (#RGB ou #RRGGBB). Para atributos de cor, `value` (nome da cor) + `hex` válido dispensam opção pré-cadastrada."
          },
          "main_color": {
            "type": [
              "string",
              "null"
            ],
            "description": "Cor principal da cor customizada (ex: Vermelho)"
          },
          "brightness": {
            "type": [
              "string",
              "null"
            ],
            "description": "Luminosidade da cor (light/dark). Se omitido, é calculada a partir do hex."
          },
          "width": {
            "type": [
              "string",
              "number",
              "null"
            ],
            "description": "Largura (atributos dimension_2d/dimension_3d)"
          },
          "height": {
            "type": [
              "string",
              "number",
              "null"
            ],
            "description": "Altura (atributos dimension_2d/dimension_3d)"
          },
          "depth": {
            "type": [
              "string",
              "number",
              "null"
            ],
            "description": "Profundidade (atributos dimension_3d)"
          },
          "fields": {
            "type": [
              "object",
              "null"
            ],
            "description": "Forma alternativa de enviar dimensões: `{ width, height, depth, unit }`",
            "properties": {
              "width": {},
              "height": {},
              "depth": {},
              "unit": {
                "type": "string"
              }
            }
          },
          "items": {
            "type": [
              "array",
              "null"
            ],
            "description": "Itens do atributo (obrigatório em atributos do tipo default_list)"
          }
        }
      },
      "AdvertisementVariation": {
        "type": "object",
        "properties": {
          "seller_sku": {
            "type": "string",
            "description": "SKU do produto para esta variacao (precisa existir na loja)"
          },
          "attributes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VariationAttribute"
            },
            "description": "Atributos que definem esta variacao"
          },
          "images": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImageReference"
            },
            "description": "Imagens especificas desta variacao"
          }
        },
        "required": [
          "seller_sku"
        ]
      },
      "VariationAttribute": {
        "type": "object",
        "description": "Informe `attribute_id` e `value` (ou `value_id` para opção pré-cadastrada). Atributos de cor aceitam cor customizada com `value` + `hex` (+ `main_color`/`brightness` opcionais), sem opção pré-cadastrada.",
        "properties": {
          "attribute_id": {
            "type": "integer",
            "description": "ID do atributo"
          },
          "attribute_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "value": {
            "type": [
              "string",
              "integer",
              "null"
            ]
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "value_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "ID da opção pré-cadastrada"
          },
          "option_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Alias aceito para `value_id`"
          },
          "hex": {
            "type": [
              "string",
              "null"
            ],
            "description": "Cor customizada em hexadecimal (#RGB ou #RRGGBB)"
          },
          "main_color": {
            "type": [
              "string",
              "null"
            ]
          },
          "brightness": {
            "type": [
              "string",
              "null"
            ]
          },
          "width": {
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "height": {
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "depth": {
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "fields": {
            "type": [
              "object",
              "null"
            ],
            "description": "Forma alternativa de enviar dimensões: `{ width, height, depth, unit }`"
          }
        }
      },
      "ImageReference": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "ID da imagem (UUID retornado por POST /api/media/upload)"
          }
        },
        "required": [
          "id"
        ]
      },
      "SimulatedAdvertisementResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message_code": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/CreatedAdvertisementData"
          }
        },
        "required": [
          "success",
          "message_code",
          "data"
        ]
      },
      "CreatedAdvertisementResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message_code": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/CreatedAdvertisementData"
          }
        },
        "required": [
          "success",
          "message_code",
          "data"
        ]
      },
      "CreatedAdvertisementData": {
        "type": "object",
        "description": "Objeto do anúncio, retornado por create, publish e simulate.",
        "properties": {
          "item_id": {
            "type": "string",
            "description": "ID do anúncio: prefixo da plataforma + 13 dígitos (ex: SAM-0000000000007)"
          },
          "title": {
            "type": "string"
          },
          "short_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "slug": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TypeValue"
              }
            ],
            "description": "Tipo do anúncio: `default` (Padrão) ou `catalog` (Catálogo)"
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/StatusValue"
              }
            ],
            "description": "Status do anúncio: `draft`, `pending_review`, `active`, `paused` ou `inactive`"
          },
          "seller_sku": {
            "type": [
              "string",
              "null"
            ],
            "description": "SKU vinculado diretamente ao anúncio (quando não há variações)"
          },
          "price_range": {
            "type": [
              "array",
              "null"
            ],
            "description": "Faixa de preço calculada a partir das ofertas (pode ser null em rascunhos)"
          },
          "score": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Score de qualidade do anúncio"
          },
          "campaigns": {
            "type": "array"
          },
          "pricing_context": {
            "type": "array",
            "description": "Contexto de precificação por faixa de quantidade (descontos, campanhas)"
          },
          "frontend_sync_status": {
            "type": "string",
            "description": "Status de sincronização com a vitrine (ex: pending)"
          },
          "last_frontend_sync_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Formato Y-m-d H:i:s"
          },
          "submitted_for_review_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Quando o anúncio foi enviado para revisão. Formato Y-m-d H:i:s"
          },
          "reviewed_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Quando a plataforma revisou o anúncio. Formato Y-m-d H:i:s"
          },
          "rejection_reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Motivo da rejeição quando o anúncio volta para rascunho"
          },
          "gtin": {
            "allOf": [
              {
                "$ref": "#/components/schemas/GTIN"
              }
            ],
            "description": "Presente apenas quando informado"
          },
          "store": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Store"
              }
            ],
            "description": "Loja dona do anúncio (presente quando carregada)"
          },
          "department": {
            "$ref": "#/components/schemas/Department"
          },
          "category": {
            "$ref": "#/components/schemas/CategoryRef"
          },
          "thumbnail": {
            "type": [
              "object",
              "null"
            ],
            "description": "Miniatura no tamanho `sm`: `{ id, resource }`"
          },
          "images": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Image"
            }
          },
          "attributes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicationAttributeOut"
            }
          },
          "variations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicationVariationOut"
            }
          }
        },
        "required": [
          "item_id",
          "title",
          "type",
          "status",
          "department",
          "category",
          "images",
          "attributes",
          "variations"
        ]
      },
      "Image": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "ID da imagem (UUID)"
          },
          "resources": {
            "type": "array",
            "description": "Variações de tamanho da imagem (`{ name, url, ... }`)",
            "items": {
              "type": "object"
            }
          }
        },
        "required": [
          "id",
          "resources"
        ]
      },
      "PublicationAttributeOut": {
        "type": "object",
        "properties": {
          "attribute_id": {
            "type": "integer",
            "description": "ID do atributo"
          },
          "attribute_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "attribute_value": {
            "type": [
              "string",
              "integer",
              "null"
            ]
          },
          "value_unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "value_id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "component": {
            "type": [
              "object",
              "null"
            ],
            "description": "Payload visual do valor. Para cor: `{ value, main_color, hex, brightness }`."
          }
        },
        "required": [
          "attribute_id",
          "attribute_name",
          "attribute_value",
          "value_unit",
          "value_id",
          "component"
        ]
      },
      "PublicationVariationOut": {
        "type": "object",
        "description": "Variação do anúncio. Em anúncios padrão o identificador vem como `offer_id`; em anúncios de catálogo, como `option_id`.",
        "properties": {
          "offer_id": {
            "type": "string",
            "description": "ID da variação (26 caracteres). Presente em anúncios padrão."
          },
          "option_id": {
            "type": "string",
            "description": "ID da opção de catálogo (26 caracteres). Presente em anúncios de catálogo."
          },
          "description": {
            "type": "string",
            "description": "Descrição legível da combinação (ex: Voltagem: 110 V, Cor: Azul)"
          },
          "attributes": {
            "type": "array",
            "description": "Atributos da variação (`{ attribute_id, attribute_name, value, unit?, value_id?, hex?, main_color?, brightness? }`)",
            "items": {
              "type": "object"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "pending",
              "hidden"
            ],
            "description": "Status da variação"
          },
          "type": {
            "type": "string",
            "enum": [
              "offer",
              "option"
            ]
          },
          "images": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Image"
            }
          },
          "seller_sku": {
            "type": [
              "string",
              "null"
            ],
            "description": "Presente quando `type=offer`"
          },
          "offer": {
            "$ref": "#/components/schemas/OfferData"
          }
        },
        "required": [
          "description",
          "attributes",
          "status",
          "type",
          "images",
          "offer"
        ]
      },
      "OfferData": {
        "type": "object",
        "properties": {
          "price_type": {
            "type": "string",
            "description": "Tipo de precificação (ex: default, wholesale)"
          },
          "price_from": {
            "type": "number",
            "description": "Preço \"De\" quando há desconto"
          },
          "prices": {
            "type": "array",
            "description": "Faixas de preço (atacado)",
            "items": {
              "type": "object"
            }
          },
          "quantity": {
            "type": "integer"
          },
          "price": {
            "type": "number",
            "description": "Preço \"Por\""
          },
          "original_price": {
            "type": [
              "number",
              "null"
            ]
          },
          "has_discount": {
            "type": "boolean"
          },
          "discount_percent": {
            "type": "integer"
          },
          "wholesale_tiers": {
            "type": "array",
            "description": "Presente apenas quando há faixas de atacado",
            "items": {
              "type": "object"
            }
          },
          "buybox": {
            "type": "object",
            "description": "Dados da buybox (presente apenas em anúncios de catálogo)"
          }
        },
        "required": [
          "price_type",
          "price_from",
          "prices",
          "quantity",
          "price",
          "original_price",
          "has_discount",
          "discount_percent"
        ]
      },
      "TypeValue": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "enum": [
              "default",
              "catalog"
            ]
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "value",
          "label"
        ]
      },
      "StatusValue": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "enum": [
              "draft",
              "pending_review",
              "active",
              "paused",
              "inactive"
            ]
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "value",
          "label"
        ]
      },
      "Store": {
        "type": "object",
        "properties": {
          "store_id": {
            "type": "string",
            "description": "ID da loja (26 caracteres)"
          },
          "store_name": {
            "type": "string"
          },
          "store_code": {
            "type": "string"
          },
          "store_status": {
            "type": "string"
          },
          "store_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "store_type": {
            "type": "string"
          },
          "commission_table_id": {
            "type": [
              "integer",
              "string",
              "null"
            ],
            "description": "ID da tabela de comissão"
          },
          "max_locations": {
            "type": [
              "integer",
              "null"
            ]
          },
          "features": {
            "type": "array"
          },
          "company": {
            "type": "object",
            "description": "Dados cadastrais da empresa"
          },
          "shares_products": {
            "type": "boolean"
          },
          "shares_stock_locations": {
            "type": "boolean"
          },
          "shares_logistics": {
            "type": "boolean"
          },
          "is_primary": {
            "type": "boolean"
          },
          "primary_store": {
            "type": [
              "object",
              "null"
            ]
          }
        },
        "required": [
          "store_id",
          "store_name",
          "store_code"
        ]
      },
      "CategoryRef": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID da categoria"
          },
          "parent_id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "hierarchy": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HierarchyLevel"
            }
          }
        },
        "required": [
          "id",
          "parent_id",
          "name"
        ]
      },
      "AttachSKURequest": {
        "type": "object",
        "properties": {
          "seller_sku": {
            "type": "string",
            "maxLength": 64,
            "description": "SKU do produto a vincular. Precisa pertencer (ou estar associado) à loja autenticada."
          },
          "status": {
            "type": "string",
            "description": "Status inicial da oferta. Default: `active`.",
            "enum": [
              "active",
              "paused",
              "inactive"
            ]
          }
        },
        "required": [
          "seller_sku"
        ]
      },
      "AttachedSKUResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message_code": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/AttachedSKUData"
          }
        },
        "required": [
          "success",
          "message_code",
          "data"
        ]
      },
      "AttachedSKUData": {
        "type": "object",
        "properties": {
          "offer_id": {
            "type": "string",
            "description": "ID da oferta criada (26 caracteres). Use em PUT/DELETE /api/items/catalog/offers/{offerId}."
          },
          "seller_sku": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused",
              "inactive",
              "pending"
            ]
          },
          "is_buybox_winner": {
            "type": "boolean",
            "description": "Recalculado em background após o vínculo — costuma vir `false` na resposta imediata"
          },
          "last_buybox_calculation": {
            "type": [
              "string",
              "null"
            ]
          },
          "price_data": {
            "$ref": "#/components/schemas/PriceData"
          },
          "stock_data": {
            "$ref": "#/components/schemas/StockData"
          },
          "publication": {
            "type": [
              "object",
              "null"
            ],
            "description": "Resumo do anúncio de catálogo",
            "properties": {
              "item_id": {
                "type": "string",
                "description": "ID do anúncio"
              },
              "title": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "thumbnail_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "ID da imagem de capa (UUID)"
              }
            }
          },
          "option": {
            "$ref": "#/components/schemas/OptionData"
          }
        },
        "required": [
          "offer_id",
          "seller_sku",
          "status",
          "is_buybox_winner",
          "last_buybox_calculation",
          "price_data",
          "stock_data",
          "publication",
          "option"
        ]
      },
      "PriceData": {
        "type": "object",
        "description": "Snapshot de preço da oferta. Preço único: `{ price }`. Atacado: `{ type: \"wholesale\", tiers: [...] }`.",
        "properties": {
          "price": {
            "type": "number",
            "description": "Preço único (presente quando não há faixas de atacado)"
          },
          "type": {
            "type": "string",
            "enum": [
              "wholesale"
            ],
            "description": "Presente apenas quando há faixas de atacado"
          },
          "tiers": {
            "type": "array",
            "description": "Faixas de preço por quantidade (presente apenas no atacado)",
            "items": {
              "$ref": "#/components/schemas/PriceTier"
            }
          }
        }
      },
      "PriceTier": {
        "type": "object",
        "properties": {
          "min_quantity": {
            "type": "integer"
          },
          "price": {
            "type": "number"
          }
        },
        "required": [
          "min_quantity",
          "price"
        ]
      },
      "StockData": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID interno do registro de estoque"
          },
          "product_id": {
            "type": "string",
            "description": "ID do SKU do produto (26 caracteres)"
          },
          "location_id": {
            "type": "string",
            "description": "ID do local de estoque (26 caracteres)"
          },
          "quantity": {
            "type": "integer"
          },
          "reserved_quantity": {
            "type": "integer"
          },
          "available_quantity": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "product_id",
          "location_id",
          "quantity",
          "reserved_quantity",
          "available_quantity"
        ]
      },
      "OptionData": {
        "type": "object",
        "properties": {
          "uid": {
            "type": "string",
            "description": "ID da opção de catálogo (26 caracteres)"
          },
          "description": {
            "type": "string"
          },
          "attributes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OptionAttribute"
            }
          },
          "type": {
            "type": "string",
            "enum": [
              "option",
              "offer"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "pending",
              "hidden"
            ]
          },
          "images": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        },
        "required": [
          "uid",
          "description",
          "attributes",
          "type",
          "status",
          "images"
        ]
      },
      "OptionAttribute": {
        "type": "object",
        "properties": {
          "attribute_id": {
            "type": "integer",
            "description": "ID do atributo"
          },
          "attribute_name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "value_id": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "attribute_id",
          "attribute_name",
          "value"
        ]
      },
      "TechnicalSheet": {
        "type": "object",
        "description": "Ficha técnica de um anúncio: lista ordenada de pares chave/valor agrupada por tipo (especificações, materiais, segurança etc.).",
        "properties": {
          "sheet_id": {
            "type": "string",
            "description": "ID da ficha técnica (26 caracteres)"
          },
          "publication_id": {
            "type": "string",
            "description": "`item_id` do anúncio dono da ficha"
          },
          "type": {
            "type": "object",
            "description": "Tipo da ficha técnica",
            "properties": {
              "value": {
                "type": "string",
                "enum": [
                  "technical_specification",
                  "characteristics",
                  "materials",
                  "installation",
                  "maintenance",
                  "safety",
                  "environmental",
                  "custom"
                ]
              },
              "label": {
                "type": "string",
                "description": "Rótulo amigável do tipo (ex.: Ficha Técnica, Materiais)"
              },
              "description": {
                "type": "string"
              }
            },
            "required": [
              "value",
              "label",
              "description"
            ]
          },
          "title": {
            "type": "string",
            "maxLength": 255
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TechnicalSheetItem"
            }
          }
        },
        "required": [
          "sheet_id",
          "publication_id",
          "type",
          "title",
          "items"
        ]
      },
      "TechnicalSheetItem": {
        "type": "object",
        "description": "Linha da ficha técnica (par chave/valor).",
        "properties": {
          "item_id": {
            "type": "string",
            "description": "ID do item da ficha (26 caracteres)"
          },
          "item_key": {
            "type": "string",
            "maxLength": 255,
            "description": "Nome da característica (ex.: Potência)"
          },
          "item_value": {
            "type": "string",
            "maxLength": 1000,
            "description": "Valor da característica (ex.: 650 W)"
          },
          "display_order": {
            "type": "integer",
            "minimum": 0,
            "description": "Posição de exibição (0 = primeiro)"
          }
        },
        "required": [
          "item_id",
          "item_key",
          "item_value",
          "display_order"
        ]
      },
      "MediaCreatedResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "message_code": {
            "type": "string",
            "example": "RESOURCE_CREATED"
          },
          "data": {
            "$ref": "#/components/schemas/MediaItem"
          }
        },
        "required": [
          "success",
          "message_code",
          "data"
        ]
      },
      "MediaItemResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "message_code": {
            "type": "string",
            "example": "SUCCESS"
          },
          "data": {
            "$ref": "#/components/schemas/MediaItem"
          }
        },
        "required": [
          "success",
          "message_code",
          "data"
        ]
      },
      "MediaCollectionResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "message_code": {
            "type": "string",
            "example": "SUCCESS"
          },
          "data": {
            "type": "object",
            "properties": {
              "meta": {
                "$ref": "#/components/schemas/PaginationMeta"
              },
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MediaItem"
                }
              }
            }
          }
        },
        "required": [
          "success",
          "message_code",
          "data"
        ]
      },
      "MediaItem": {
        "type": "object",
        "description": "Objeto que representa uma imagem/mídia na API de seller. Campos internos de propriedade (`owner_id`, `owner_model`) ficam de fora do payload de propósito — você não precisa deles para integrar, então não vai encontrá-los aqui.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Identificador único da imagem (26 caracteres). É o valor usado como `{file_hash}` nas rotas de detalhe e exclusão.",
            "example": "01JMZXZ72881MD2P37N2K97YJJ"
          },
          "original_source": {
            "type": "string",
            "format": "uri",
            "description": "URL da imagem original, já convertida para WebP em alta qualidade.",
            "example": "https://cdn.example.com/products/2026/05/28/original_01JMZXZ72881MD2P37N2K97YJJ.webp"
          },
          "urls": {
            "type": "array",
            "description": "Variações de tamanho geradas automaticamente (todas em WebP). Uma entrada por variação: `thumbnail` (135x135), `sm` (200x200), `md` (400x400), `lg` (800x800) e `xl` (1600x1600).",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "enum": [
                    "thumbnail",
                    "sm",
                    "md",
                    "lg",
                    "xl"
                  ],
                  "description": "Nome da variação de tamanho.",
                  "example": "thumbnail"
                },
                "size": {
                  "type": "string",
                  "description": "Dimensões máximas da variação, no formato largura x altura.",
                  "example": "135x135"
                },
                "url": {
                  "type": "string",
                  "format": "uri",
                  "description": "URL pública da variação.",
                  "example": "https://cdn.example.com/products/2026/05/28/thumbnail_01JMZXZ72881MD2P37N2K97YJJ.webp"
                }
              },
              "required": [
                "name",
                "size",
                "url"
              ]
            }
          },
          "in_use": {
            "type": "boolean",
            "description": "Indica se a imagem está associada a algum recurso.",
            "example": false
          },
          "reference_id": {
            "type": "string",
            "nullable": true,
            "description": "ID do recurso referenciado (se houver)."
          },
          "reference_model": {
            "type": "string",
            "nullable": true,
            "enum": [
              "product",
              "publication",
              "store"
            ],
            "description": "Tipo do recurso vinculado, em formato curto. Use o mesmo valor no filtro `filter[reference_model]=...`."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Data de criação da imagem.",
            "example": "2026-05-28T10:00:00-03:00"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Data da última atualização da imagem.",
            "example": "2026-05-28T10:00:00-03:00"
          }
        },
        "required": [
          "id",
          "original_source",
          "urls",
          "in_use",
          "reference_id",
          "reference_model",
          "created_at",
          "updated_at"
        ]
      },
      "MediaCloneFromSkusResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "message_code": {
            "type": "string",
            "example": "OK"
          },
          "data": {
            "type": "object",
            "properties": {
              "results": {
                "type": "object",
                "description": "Mapa key → lista de mídias clonadas. As keys são exatamente as enviadas nos targets.",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ClonedMediaItem"
                  }
                }
              },
              "ignored_skus": {
                "type": "array",
                "description": "SKUs que não pertencem (ou não estão associados) à loja autenticada. Não geram erro — as keys correspondentes voltam vazias.",
                "items": {
                  "type": "string"
                },
                "example": [
                  "CAMISETA-VERM-M"
                ]
              }
            },
            "required": [
              "results",
              "ignored_skus"
            ]
          }
        },
        "required": [
          "success",
          "data"
        ]
      },
      "ClonedMediaItem": {
        "type": "object",
        "description": "Mídia recém-clonada a partir de uma foto de produto. Nasce sem vínculo (`in_use=false`) — vincule ao anúncio normalmente via `images[].id`; se não for usada, a limpeza diária remove a cópia após ~72 horas.",
        "properties": {
          "id": {
            "type": "string",
            "description": "ID da nova mídia (26 caracteres). Use este valor nas `images` do anúncio/variação.",
            "example": "01JNB2T4G93QRT5V6W7X8Y9Z0A"
          },
          "source_image_id": {
            "type": "string",
            "description": "ID da imagem de origem (foto da galeria do produto). Útil para rastrear de onde a cópia veio e evitar duplicar sugestões.",
            "example": "01JMZXZ72881MD2P37N2K97YJJ"
          },
          "original_source": {
            "type": "string",
            "format": "uri",
            "description": "URL da cópia em alta qualidade (WebP).",
            "example": "https://cdn.example.com/products/2026/06/11/original_01JNB2T4G93QRT5V6W7X8Y9Z0A.webp"
          },
          "urls": {
            "type": "array",
            "description": "Variações de tamanho copiadas da imagem de origem (mesmos nomes do upload: `thumbnail`, `sm`, `md`, `lg`, `xl`).",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "example": "sm"
                },
                "size": {
                  "type": "string",
                  "nullable": true,
                  "example": "200x200"
                },
                "url": {
                  "type": "string",
                  "format": "uri",
                  "example": "https://cdn.example.com/products/2026/06/11/sm_01JNB2T4G93QRT5V6W7X8Y9Z0A.webp"
                }
              },
              "required": [
                "name",
                "url"
              ]
            }
          }
        },
        "required": [
          "id",
          "source_image_id",
          "original_source",
          "urls"
        ]
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Token não fornecido, inválido ou expirado",
        "content": {
          "application/json": {
            "example": {
              "success": false,
              "code": 401,
              "message_code": "UNAUTHORIZED",
              "description": "A autenticação é necessária e falhou ou não foi fornecida.",
              "data": [],
              "errors": [
                "O access_token da loja é obrigatório no cabeçalho Authorization"
              ],
              "meta": []
            }
          }
        }
      },
      "Forbidden": {
        "description": "Sem permissão para acessar este recurso",
        "content": {
          "application/json": {
            "example": {
              "success": false,
              "code": 403,
              "message_code": "FORBIDDEN",
              "description": "Você não tem permissão para acessar este recurso.",
              "data": [],
              "errors": [
                "Você não tem permissão para acessar este recurso (escopos ausentes: store_products_write)"
              ],
              "meta": []
            }
          }
        }
      },
      "NotFound": {
        "description": "Recurso não encontrado",
        "content": {
          "application/json": {
            "example": {
              "success": false,
              "code": 404,
              "message_code": "NOT_FOUND",
              "description": "O recurso solicitado não foi encontrado.",
              "data": [],
              "errors": [
                "Produto não encontrado."
              ],
              "meta": []
            }
          }
        }
      },
      "Duplicated": {
        "description": "Recurso duplicado (ex: SKU já existe nesta loja)",
        "content": {
          "application/json": {
            "example": {
              "success": false,
              "code": 409,
              "message_code": "DUPLICATED",
              "description": "Este SKU já está cadastrado para esta loja.",
              "data": [],
              "errors": [
                "Este SKU já está cadastrado para esta loja."
              ],
              "meta": []
            }
          }
        }
      },
      "ValidationError": {
        "description": "Erro de validação nos campos enviados",
        "content": {
          "application/json": {
            "example": {
              "success": false,
              "code": 422,
              "message_code": "VALIDATION_ERROR",
              "description": "Foram encontrados erros de validação na requisição.",
              "data": [],
              "errors": {
                "sku": [
                  "O campo SKU é obrigatório."
                ],
                "name": [
                  "O campo Nome é obrigatório."
                ],
                "dimensions.height": [
                  "O campo dimensions.height é obrigatório."
                ]
              },
              "meta": []
            }
          }
        }
      },
      "Conflict": {
        "description": "Endereco identico ja vinculado ao local de estoque",
        "content": {
          "application/json": {
            "example": {
              "success": false,
              "message_code": "CONFLICT",
              "data": {
                "message": "Já existe um endereço idêntico vinculado ao local de estoque."
              }
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "integrationToken": []
    }
  ]
}