{
  "openapi": "3.1.0",
  "info": {
    "title": "Wizer Public API",
    "version": "1.2.0",
    "summary": "API pública do CRM Wizer",
    "description": "Especificação baseada na implementação documentada em API_PUBLICA.md. Todas as rotas públicas operam no escopo da organização vinculada ao token."
  },
  "servers": [
    {
      "url": "https://api.wizer.digital",
      "description": "Produção"
    }
  ],
  "tags": [
    {
      "name": "Tokens de integração",
      "description": "Gerenciamento interno de tokens pelo dashboard."
    },
    {
      "name": "Tags",
      "description": "Cadastro e manutenção de tags da organização."
    },
    {
      "name": "Tags de contatos",
      "description": "Associação de tags a contatos."
    },
    {
      "name": "Contatos"
    },
    {
      "name": "Oportunidades"
    },
    {
      "name": "Usuários"
    },
    {
      "name": "Comercial",
      "description": "Catálogo, vendas, operações, pagamentos e comissões."
    }
  ],
  "paths": {
    "/api/v1/integrations/public-api/tokens": {
      "get": {
        "tags": [
          "Tokens de integração"
        ],
        "summary": "Listar tokens",
        "operationId": "listIntegrationTokens",
        "security": [
          {
            "dashboardSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Lista de tokens mascarados.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicApiToken"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Tokens de integração"
        ],
        "summary": "Criar token",
        "operationId": "createIntegrationToken",
        "security": [
          {
            "dashboardSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Token criado. O segredo completo aparece somente nesta resposta.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiTokenCreated"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/integrations/public-api/tokens/{id}": {
      "patch": {
        "tags": [
          "Tokens de integração"
        ],
        "summary": "Renomear token",
        "operationId": "updateIntegrationToken",
        "security": [
          {
            "dashboardSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Token atualizado sem alterar o segredo.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiToken"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID do token.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Tokens de integração"
        ],
        "summary": "Revogar token",
        "operationId": "revokeIntegrationToken",
        "security": [
          {
            "dashboardSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Token revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiToken"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID do token.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/public-api/tags": {
      "get": {
        "tags": [
          "Tags"
        ],
        "summary": "Listar tags",
        "operationId": "listTags",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Tags paginadas.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Tag"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/PaginationMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Busca por nome ou descrição.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Quantidade máxima.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Deslocamento.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ]
      },
      "post": {
        "tags": [
          "Tags"
        ],
        "summary": "Criar tag",
        "operationId": "createTag",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Tag criada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tag"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TagInput"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/tags/{id}": {
      "get": {
        "tags": [
          "Tags"
        ],
        "summary": "Consultar tag por ID",
        "operationId": "getTag",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Tag encontrada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tag"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID da tag.",
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "patch": {
        "tags": [
          "Tags"
        ],
        "summary": "Atualizar tag",
        "operationId": "updateTag",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Tag atualizada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tag"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID da tag.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TagUpdate"
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Tags"
        ],
        "summary": "Excluir tag",
        "operationId": "deleteTag",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Tag excluída.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "removedAssignmentCount"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "removedAssignmentCount": {
                      "type": "integer",
                      "minimum": 0
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID da tag.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "removeFromContacts",
            "in": "query",
            "required": false,
            "description": "Remove explicitamente todas as associações antes de excluir.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ]
      }
    },
    "/api/v1/public-api/contacts/{id}/tags": {
      "get": {
        "tags": [
          "Tags de contatos"
        ],
        "summary": "Listar tags do contato",
        "operationId": "listContactTags",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Tags associadas ao contato.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Tag"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID do contato.",
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "post": {
        "tags": [
          "Tags de contatos"
        ],
        "summary": "Adicionar tag ao contato",
        "operationId": "addContactTag",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Associação criada ou já existente.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "created"
                  ],
                  "properties": {
                    "created": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID do contato.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "tagId"
                ],
                "properties": {
                  "tagId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Tags de contatos"
        ],
        "summary": "Substituir todas as tags do contato",
        "operationId": "replaceContactTags",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Estado final das associações aplicado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID do contato.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "tagIds"
                ],
                "properties": {
                  "tagIds": {
                    "type": "array",
                    "uniqueItems": true,
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/contacts/{id}/tags/{tagId}": {
      "delete": {
        "tags": [
          "Tags de contatos"
        ],
        "summary": "Remover tag do contato",
        "operationId": "removeContactTag",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Associação removida.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "removed"
                  ],
                  "properties": {
                    "removed": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID do contato.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tagId",
            "in": "path",
            "required": true,
            "description": "ID da tag.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/public-api/contacts": {
      "get": {
        "tags": [
          "Contatos"
        ],
        "summary": "Listar contatos",
        "operationId": "listContacts",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Lista de contatos.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Contact"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "A implementação atual retorna somente o campo `data`.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Texto livre.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Quantidade máxima.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Deslocamento.",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "contactType",
            "in": "query",
            "required": false,
            "description": "Tipo de contato.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "PF",
                "PJ"
              ]
            }
          },
          {
            "name": "channelType",
            "in": "query",
            "required": false,
            "description": "Tipo de canal.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "conversationState",
            "in": "query",
            "required": false,
            "description": "Existência de conversas.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "with_conversations",
                "without_conversations"
              ]
            }
          },
          {
            "name": "assigneeId",
            "in": "query",
            "required": false,
            "description": "Responsável pelo contato.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "teamId",
            "in": "query",
            "required": false,
            "description": "Time.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "aiPausedState",
            "in": "query",
            "required": false,
            "description": "Estado de pausa do agente de IA.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "active",
                "paused"
              ]
            }
          },
          {
            "name": "contactTagIds",
            "in": "query",
            "required": false,
            "description": "IDs de tags de contato; aceita array ou string separada por vírgulas.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "inactiveSinceDays",
            "in": "query",
            "required": false,
            "description": "Inatividade mínima em dias.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "opportunityStatus",
            "in": "query",
            "required": false,
            "description": "Status de oportunidades vinculadas.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "open",
                "won",
                "lost"
              ]
            }
          },
          {
            "name": "pipelineId",
            "in": "query",
            "required": false,
            "description": "Pipeline.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "stageId",
            "in": "query",
            "required": false,
            "description": "Etapa.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "minValue",
            "in": "query",
            "required": false,
            "description": "Valor mínimo de oportunidade.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "maxValue",
            "in": "query",
            "required": false,
            "description": "Valor máximo de oportunidade.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "opportunityTemperature",
            "in": "query",
            "required": false,
            "description": "Temperatura da oportunidade.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "cold",
                "warm",
                "hot"
              ]
            }
          },
          {
            "name": "opportunityOwnerId",
            "in": "query",
            "required": false,
            "description": "Dono da oportunidade.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lostReasonId",
            "in": "query",
            "required": false,
            "description": "Motivo de perda.",
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "post": {
        "tags": [
          "Contatos"
        ],
        "summary": "Criar contato",
        "operationId": "createContact",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Contato criado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactCreate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/contacts/{id}": {
      "get": {
        "tags": [
          "Contatos"
        ],
        "summary": "Consultar contato por ID",
        "operationId": "getContact",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Contato encontrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID do contato.",
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "patch": {
        "tags": [
          "Contatos"
        ],
        "summary": "Atualizar contato",
        "operationId": "updateContact",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Contato atualizado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID do contato.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactUpdate"
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Contatos"
        ],
        "summary": "Excluir contato",
        "operationId": "deleteContact",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Contato excluído.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID do contato.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/public-api/opportunities": {
      "get": {
        "tags": [
          "Oportunidades"
        ],
        "summary": "Listar oportunidades",
        "operationId": "listOpportunities",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Oportunidades paginadas.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Opportunity"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/PaginationMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "pipelineId",
            "in": "query",
            "required": false,
            "description": "Pipeline.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ownerUserId",
            "in": "query",
            "required": false,
            "description": "Dono da oportunidade.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "stageId",
            "in": "query",
            "required": false,
            "description": "Etapa.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Busca por título ou empresa.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Status.",
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "won",
                "lost",
                "all"
              ]
            }
          },
          {
            "name": "archived",
            "in": "query",
            "required": false,
            "description": "Filtro de arquivamento.",
            "schema": {
              "type": "string",
              "enum": [
                "exclude",
                "include",
                "only"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Quantidade máxima efetiva.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Deslocamento.",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ]
      },
      "post": {
        "tags": [
          "Oportunidades"
        ],
        "summary": "Criar oportunidade",
        "operationId": "createOpportunity",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Oportunidade criada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Opportunity"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpportunityCreate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/opportunities/{id}": {
      "get": {
        "tags": [
          "Oportunidades"
        ],
        "summary": "Consultar oportunidade por ID",
        "operationId": "getOpportunity",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Oportunidade encontrada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Opportunity"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID da oportunidade.",
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "patch": {
        "tags": [
          "Oportunidades"
        ],
        "summary": "Atualizar oportunidade",
        "operationId": "updateOpportunity",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Oportunidade atualizada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Opportunity"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID da oportunidade.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpportunityUpdate"
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Oportunidades"
        ],
        "summary": "Excluir oportunidade",
        "operationId": "deleteOpportunity",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Oportunidade excluída.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID da oportunidade.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/public-api/users": {
      "get": {
        "tags": [
          "Usuários"
        ],
        "summary": "Listar usuários",
        "operationId": "listUsers",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Usuários paginados.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/User"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/PaginationMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Página desejada.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Itens por página.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Busca por nome ou e-mail.",
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "post": {
        "tags": [
          "Usuários"
        ],
        "summary": "Criar usuário",
        "operationId": "createUser",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Usuário criado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "O usuário é sempre criado na organização do token.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserCreate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/users/{id}": {
      "get": {
        "tags": [
          "Usuários"
        ],
        "summary": "Consultar usuário por ID",
        "operationId": "getUser",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Usuário encontrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID do usuário.",
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "patch": {
        "tags": [
          "Usuários"
        ],
        "summary": "Atualizar usuário",
        "operationId": "updateUser",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Usuário atualizado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "`emailVerified` não é aceito neste endpoint.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID do usuário.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserUpdate"
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Usuários"
        ],
        "summary": "Excluir usuário",
        "operationId": "deleteUser",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Usuário excluído.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "A exclusão é bloqueada quando o usuário é o último administrador ativo da organização.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID do usuário.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/public-api/catalog/items": {
      "get": {
        "tags": [
          "Comercial"
        ],
        "summary": "Listar itens do catalogo",
        "operationId": "listCatalogItems",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Lista paginada de itens.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercialList"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `catalog:read`.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Busca textual.",
            "schema": {
              "type": "string",
              "maxLength": 160
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Tipo do item.",
            "schema": {
              "type": "string",
              "enum": [
                "product",
                "service",
                "plan_subscription",
                "real_estate",
                "vehicle_machine_equipment",
                "education",
                "event_ticket",
                "fee_additional"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Status do item.",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "active",
                "inactive"
              ]
            }
          },
          {
            "name": "templateId",
            "in": "query",
            "required": false,
            "description": "Template do item.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "categoryId",
            "in": "query",
            "required": false,
            "description": "Categoria.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "commercialMode",
            "in": "query",
            "required": false,
            "description": "Modo comercial.",
            "schema": {
              "type": "string",
              "enum": [
                "sale",
                "service",
                "subscription",
                "rental",
                "daily",
                "reservation",
                "enrollment",
                "licensing",
                "additional_charge",
                "quote",
                "consultation",
                "free",
                "internal"
              ]
            }
          },
          {
            "name": "billingMode",
            "in": "query",
            "required": false,
            "description": "Modo de cobranca.",
            "schema": {
              "type": "string",
              "enum": [
                "one_time",
                "installment",
                "recurring"
              ]
            }
          },
          {
            "name": "attributeFilters",
            "in": "query",
            "required": false,
            "description": "Objeto JSON serializado.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "required": false,
            "description": "Tag do catalogo.",
            "schema": {
              "type": "string",
              "maxLength": 160
            }
          },
          {
            "name": "unitId",
            "in": "query",
            "required": false,
            "description": "Unidade cadastrada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "description": "Inclui itens arquivados.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Pagina.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Itens por pagina.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ]
      },
      "post": {
        "tags": [
          "Comercial"
        ],
        "summary": "Criar item do catalogo",
        "operationId": "createCatalogItem",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Item criado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogItem"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `catalog:write`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CatalogItemCreate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/catalog/items/{itemId}": {
      "get": {
        "tags": [
          "Comercial"
        ],
        "summary": "Consultar item do catalogo",
        "operationId": "getCatalogItem",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Item encontrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogItem"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `catalog:read`.",
        "parameters": [
          {
            "name": "itemId",
            "in": "path",
            "required": true,
            "description": "ID do item.",
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "patch": {
        "tags": [
          "Comercial"
        ],
        "summary": "Atualizar item do catalogo",
        "operationId": "updateCatalogItem",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Item atualizado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogItem"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `catalog:write`.",
        "parameters": [
          {
            "name": "itemId",
            "in": "path",
            "required": true,
            "description": "ID do item.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CatalogItemUpdate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/sales": {
      "get": {
        "tags": [
          "Comercial"
        ],
        "summary": "Listar vendas",
        "operationId": "listSales",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Lista paginada de vendas.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercialList"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `sales:read`.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Busca textual.",
            "schema": {
              "type": "string",
              "maxLength": 160
            }
          },
          {
            "name": "commercialStatus",
            "in": "query",
            "required": false,
            "description": "Status comercial.",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "awaiting_confirmation",
                "confirmed",
                "canceled",
                "completed"
              ]
            }
          },
          {
            "name": "financialStatus",
            "in": "query",
            "required": false,
            "description": "Status financeiro.",
            "schema": {
              "type": "string",
              "enum": [
                "not_applicable",
                "not_charged",
                "awaiting_payment",
                "awaiting_settlement",
                "partially_paid",
                "paid",
                "overdue",
                "partially_refunded",
                "refunded",
                "disputed",
                "canceled"
              ]
            }
          },
          {
            "name": "fulfillmentStatus",
            "in": "query",
            "required": false,
            "description": "Status operacional.",
            "schema": {
              "type": "string",
              "enum": [
                "not_applicable",
                "pending",
                "scheduled",
                "preparing",
                "in_progress",
                "partially_completed",
                "completed",
                "suspended",
                "canceled"
              ]
            }
          },
          {
            "name": "ownerUserId",
            "in": "query",
            "required": false,
            "description": "Responsavel.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "teamId",
            "in": "query",
            "required": false,
            "description": "Time.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "opportunityId",
            "in": "query",
            "required": false,
            "description": "Oportunidade.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "contactId",
            "in": "query",
            "required": false,
            "description": "Contato.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "createdFrom",
            "in": "query",
            "required": false,
            "description": "Data inicial.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "createdTo",
            "in": "query",
            "required": false,
            "description": "Data final.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Pagina.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Itens por pagina.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ]
      },
      "post": {
        "tags": [
          "Comercial"
        ],
        "summary": "Criar venda",
        "operationId": "createSale",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Venda criada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sale"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `sales:write`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaleCreate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/sales/{saleId}": {
      "get": {
        "tags": [
          "Comercial"
        ],
        "summary": "Consultar venda",
        "operationId": "getSale",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Venda encontrada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sale"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `sales:read`.",
        "parameters": [
          {
            "name": "saleId",
            "in": "path",
            "required": true,
            "description": "ID da venda.",
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "patch": {
        "tags": [
          "Comercial"
        ],
        "summary": "Atualizar venda",
        "operationId": "updateSale",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Venda atualizada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sale"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `sales:write`.",
        "parameters": [
          {
            "name": "saleId",
            "in": "path",
            "required": true,
            "description": "ID da venda.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaleUpdate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/sales/{saleId}/cancel": {
      "post": {
        "tags": [
          "Comercial"
        ],
        "summary": "Cancelar venda",
        "operationId": "cancelSale",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Venda atualizada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sale"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `sales:write`.",
        "parameters": [
          {
            "name": "saleId",
            "in": "path",
            "required": true,
            "description": "ID da venda.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelSale"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/sales/{saleId}/complete": {
      "post": {
        "tags": [
          "Comercial"
        ],
        "summary": "Concluir venda",
        "operationId": "completeSale",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Venda atualizada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sale"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `sales:write`.",
        "parameters": [
          {
            "name": "saleId",
            "in": "path",
            "required": true,
            "description": "ID da venda.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/public-api/sales/{saleId}/confirm": {
      "post": {
        "tags": [
          "Comercial"
        ],
        "summary": "Confirmar venda",
        "operationId": "confirmSale",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Venda atualizada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sale"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `sales:write`.",
        "parameters": [
          {
            "name": "saleId",
            "in": "path",
            "required": true,
            "description": "ID da venda.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/public-api/sales/{saleId}/operations": {
      "get": {
        "tags": [
          "Comercial"
        ],
        "summary": "Consultar operacoes da venda",
        "operationId": "getSaleOperations",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Operacoes da venda.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercialObject"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `sales:read`.",
        "parameters": [
          {
            "name": "saleId",
            "in": "path",
            "required": true,
            "description": "ID da venda.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/public-api/sales/{saleId}/charge-groups": {
      "post": {
        "tags": [
          "Comercial"
        ],
        "summary": "Criar grupo de cobranca",
        "operationId": "createSaleChargeGroup",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Grupo de cobranca criado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercialObject"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `sales:write`.",
        "parameters": [
          {
            "name": "saleId",
            "in": "path",
            "required": true,
            "description": "ID da venda.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChargeGroupCreate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/sales/{saleId}/fulfillments": {
      "post": {
        "tags": [
          "Comercial"
        ],
        "summary": "Criar fulfillment",
        "operationId": "createSaleFulfillment",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Fulfillment criado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercialObject"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `sales:write`.",
        "parameters": [
          {
            "name": "saleId",
            "in": "path",
            "required": true,
            "description": "ID da venda.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FulfillmentCreate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/sales/{saleId}/checkouts": {
      "get": {
        "tags": [
          "Comercial"
        ],
        "summary": "Listar checkouts da venda",
        "operationId": "listSaleCheckouts",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Checkouts da venda.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CommercialObject"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `sales:read`.",
        "parameters": [
          {
            "name": "saleId",
            "in": "path",
            "required": true,
            "description": "ID da venda.",
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "post": {
        "tags": [
          "Comercial"
        ],
        "summary": "Criar checkout Asaas",
        "operationId": "createSaleCheckout",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Checkout criado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercialObject"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `payments:write`.",
        "parameters": [
          {
            "name": "saleId",
            "in": "path",
            "required": true,
            "description": "ID da venda.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutCreate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/sales/{saleId}/payments": {
      "post": {
        "tags": [
          "Comercial"
        ],
        "summary": "Registrar pagamento",
        "operationId": "createSalePayment",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Pagamento registrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercialObject"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `payments:write`.",
        "parameters": [
          {
            "name": "saleId",
            "in": "path",
            "required": true,
            "description": "ID da venda.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentCreate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/commissions": {
      "get": {
        "tags": [
          "Comercial"
        ],
        "summary": "Listar lancamentos de comissao",
        "operationId": "listCommissionEntries",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Lancamentos de comissao.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercialList"
                }
              }
            }
          },
          "400": {
            "description": "Falha de validação.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Token ou sessão ausente, inválido ou revogado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Operação não permitida para a organização.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Registro não encontrado na organização autenticada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflito de negócio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Escopo necessario: `commissions:read`.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Status do lancamento.",
            "schema": {
              "type": "string",
              "enum": [
                "projected",
                "pending_eligibility",
                "earned",
                "pending_approval",
                "approved",
                "scheduled",
                "paid",
                "suspended",
                "reversed",
                "canceled"
              ]
            }
          },
          {
            "name": "participantUserId",
            "in": "query",
            "required": false,
            "description": "Participante.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "competenceFrom",
            "in": "query",
            "required": false,
            "description": "Inicio da competencia.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "competenceTo",
            "in": "query",
            "required": false,
            "description": "Fim da competencia.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Pagina.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Itens por pagina.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Wizer public API token"
      },
      "dashboardSession": {
        "type": "apiKey",
        "in": "cookie",
        "name": "session",
        "description": "Sessão autenticada do dashboard; exige perfil org-admin ou admin."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "statusCode": {
            "type": "integer"
          },
          "message": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "error": {
            "type": "string"
          }
        }
      },
      "Success": {
        "type": "object",
        "required": [
          "success"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "PaginationMeta": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "page": {
            "type": "integer",
            "minimum": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1
          },
          "offset": {
            "type": "integer",
            "minimum": 0
          },
          "totalPages": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "PublicApiToken": {
        "type": "object",
        "required": [
          "id",
          "name",
          "tokenPrefix",
          "lastFour",
          "maskedToken",
          "status",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "tokenPrefix": {
            "type": "string"
          },
          "lastFour": {
            "type": "string"
          },
          "maskedToken": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "revoked"
            ]
          },
          "createdByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "revokedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lastUsedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PublicApiTokenCreated": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PublicApiToken"
          },
          {
            "type": "object",
            "required": [
              "token"
            ],
            "properties": {
              "token": {
                "type": "string",
                "description": "Segredo exibido apenas na criação."
              }
            }
          }
        ]
      },
      "Tag": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "color",
          "bg",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "maxLength": 20
          },
          "bg": {
            "type": "string",
            "maxLength": 20
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TagInput": {
        "type": "object",
        "required": [
          "name",
          "description",
          "color",
          "bg"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 120
          },
          "description": {
            "type": "string",
            "maxLength": 255
          },
          "color": {
            "type": "string",
            "maxLength": 20
          },
          "bg": {
            "type": "string",
            "maxLength": 20
          }
        }
      },
      "TagUpdate": {
        "type": "object",
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 120
          },
          "description": {
            "type": "string",
            "maxLength": 255
          },
          "color": {
            "type": "string",
            "maxLength": 20
          },
          "bg": {
            "type": "string",
            "maxLength": 20
          }
        }
      },
      "ContactIdentity": {
        "type": "object",
        "required": [
          "id",
          "channelType"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "channelType": {
            "type": "string"
          }
        }
      },
      "ContactIdentityInput": {
        "type": "object",
        "required": [
          "connectionId",
          "channelType",
          "identifier"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "connectionId": {
            "type": "string"
          },
          "channelType": {
            "type": "string"
          },
          "identifier": {
            "type": "string"
          }
        }
      },
      "Contact": {
        "type": "object",
        "required": [
          "id",
          "name",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "phoneNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "contactType": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "PF",
              "PJ",
              null
            ]
          },
          "documentNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "primaryContactName": {
            "type": [
              "string",
              "null"
            ]
          },
          "primaryContactWhatsapp": {
            "type": [
              "string",
              "null"
            ]
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "identities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContactIdentity"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ContactCreate": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phoneNumber": {
            "type": "string"
          },
          "avatarUrl": {
            "type": "string",
            "format": "uri"
          },
          "contactType": {
            "type": "string",
            "enum": [
              "PF",
              "PJ"
            ]
          },
          "documentNumber": {
            "type": "string"
          },
          "primaryContactName": {
            "type": "string"
          },
          "primaryContactWhatsapp": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "identities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContactIdentityInput"
            }
          }
        }
      },
      "ContactUpdate": {
        "type": "object",
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phoneNumber": {
            "type": "string"
          },
          "avatarUrl": {
            "type": "string",
            "format": "uri"
          },
          "contactType": {
            "type": "string",
            "enum": [
              "PF",
              "PJ"
            ]
          },
          "documentNumber": {
            "type": "string"
          },
          "primaryContactName": {
            "type": "string"
          },
          "primaryContactWhatsapp": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "identities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContactIdentityInput"
            }
          }
        },
        "description": "Todos os campos são opcionais no PATCH."
      },
      "EmbeddedContact": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phoneNumber": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "Opportunity": {
        "type": "object",
        "required": [
          "id",
          "contactId",
          "status",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "contactId": {
            "type": "string"
          },
          "pipelineId": {
            "type": [
              "string",
              "null"
            ]
          },
          "stageId": {
            "type": [
              "string",
              "null"
            ]
          },
          "ownerUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "teamId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdSource": {
            "type": "string",
            "enum": [
              "dashboard",
              "chat_manual",
              "ai_agent",
              "flow"
            ]
          },
          "sourceConversationId": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "companyName": {
            "type": [
              "string",
              "null"
            ]
          },
          "contactRole": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "won",
              "lost"
            ]
          },
          "value": {
            "type": [
              "number",
              "null"
            ]
          },
          "currencyCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "probability": {
            "type": [
              "number",
              "null"
            ]
          },
          "probabilityMode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "auto",
              "manual",
              null
            ]
          },
          "score": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 100
          },
          "priority": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "low",
              "medium",
              "high",
              "urgent",
              null
            ]
          },
          "temperature": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "cold",
              "warm",
              "hot",
              null
            ]
          },
          "health": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "healthy",
              "at_risk",
              "stalled",
              null
            ]
          },
          "summary": {
            "type": [
              "string",
              "null"
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "nextActionAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expectedCloseAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "closingNotes": {
            "type": [
              "string",
              "null"
            ]
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "lostReasonId": {
            "type": [
              "string",
              "null"
            ]
          },
          "lostReasonText": {
            "type": [
              "string",
              "null"
            ]
          },
          "archivedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OpportunityCreate": {
        "type": "object",
        "anyOf": [
          {
            "required": [
              "contactId"
            ]
          },
          {
            "required": [
              "contact"
            ]
          }
        ],
        "properties": {
          "contactId": {
            "type": "string"
          },
          "contact": {
            "$ref": "#/components/schemas/EmbeddedContact"
          },
          "pipelineId": {
            "type": "string"
          },
          "stageId": {
            "type": "string"
          },
          "ownerUserId": {
            "type": "string"
          },
          "sourceConversationId": {
            "type": "string"
          },
          "createdSource": {
            "type": "string",
            "enum": [
              "dashboard",
              "chat_manual",
              "ai_agent",
              "flow"
            ]
          },
          "title": {
            "type": "string"
          },
          "companyName": {
            "type": "string"
          },
          "contactRole": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "value": {
            "type": "number"
          },
          "currencyCode": {
            "type": "string"
          },
          "probability": {
            "type": "number"
          },
          "probabilityMode": {
            "type": "string",
            "enum": [
              "auto",
              "manual"
            ]
          },
          "score": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "priority": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high",
              "urgent"
            ]
          },
          "temperature": {
            "type": "string",
            "enum": [
              "cold",
              "warm",
              "hot"
            ]
          },
          "health": {
            "type": "string",
            "enum": [
              "healthy",
              "at_risk",
              "stalled"
            ]
          },
          "summary": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "nextActionAt": {
            "type": "string",
            "format": "date-time"
          },
          "expectedCloseAt": {
            "type": "string",
            "format": "date-time"
          },
          "closingNotes": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "OpportunityUpdate": {
        "type": "object",
        "minProperties": 1,
        "properties": {
          "contactId": {
            "type": "string"
          },
          "contact": {
            "$ref": "#/components/schemas/EmbeddedContact"
          },
          "pipelineId": {
            "type": "string"
          },
          "stageId": {
            "type": "string"
          },
          "ownerUserId": {
            "type": "string"
          },
          "sourceConversationId": {
            "type": "string"
          },
          "createdSource": {
            "type": "string",
            "enum": [
              "dashboard",
              "chat_manual",
              "ai_agent",
              "flow"
            ]
          },
          "title": {
            "type": "string"
          },
          "companyName": {
            "type": "string"
          },
          "contactRole": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "value": {
            "type": "number"
          },
          "currencyCode": {
            "type": "string"
          },
          "probability": {
            "type": "number"
          },
          "probabilityMode": {
            "type": "string",
            "enum": [
              "auto",
              "manual"
            ]
          },
          "score": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "priority": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high",
              "urgent"
            ]
          },
          "temperature": {
            "type": "string",
            "enum": [
              "cold",
              "warm",
              "hot"
            ]
          },
          "health": {
            "type": "string",
            "enum": [
              "healthy",
              "at_risk",
              "stalled"
            ]
          },
          "summary": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "nextActionAt": {
            "type": "string",
            "format": "date-time"
          },
          "expectedCloseAt": {
            "type": "string",
            "format": "date-time"
          },
          "closingNotes": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "won",
              "lost"
            ]
          },
          "lostReasonId": {
            "type": "string"
          },
          "lostReasonText": {
            "type": "string"
          },
          "archived": {
            "type": "boolean"
          }
        },
        "description": "Campos de criação e campos de controle, todos opcionais no PATCH."
      },
      "ProfileLink": {
        "type": "object",
        "required": [
          "label",
          "url"
        ],
        "properties": {
          "label": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "ChatSettings": {
        "type": "object",
        "properties": {
          "chatNotificationsSound": {
            "type": "boolean"
          }
        }
      },
      "User": {
        "type": "object",
        "required": [
          "id",
          "name",
          "email",
          "role",
          "isActive",
          "emailVerified",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "bio": {
            "type": [
              "string",
              "null"
            ]
          },
          "profileLinks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileLink"
            }
          },
          "whatsapp": {
            "type": [
              "string",
              "null"
            ]
          },
          "avatarKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "avatarUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "user",
              "admin",
              "org-admin",
              "org-manager",
              "org-agent"
            ]
          },
          "roleDisplayName": {
            "type": [
              "string",
              "null"
            ]
          },
          "roleMaskId": {
            "type": [
              "string",
              "null"
            ]
          },
          "isActive": {
            "type": "boolean"
          },
          "emailVerified": {
            "type": "boolean"
          },
          "authProvider": {
            "type": "string"
          },
          "teams": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "managedTeams": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "UserCreate": {
        "type": "object",
        "required": [
          "name",
          "email",
          "password"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "password": {
            "type": "string",
            "format": "password"
          },
          "role": {
            "type": "string",
            "enum": [
              "user",
              "admin",
              "org-admin",
              "org-manager",
              "org-agent"
            ]
          },
          "roleMaskId": {
            "type": "string"
          },
          "emailVerified": {
            "type": "boolean"
          },
          "isActive": {
            "type": "boolean"
          },
          "teamIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "managedTeamIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "whatsapp": {
            "type": "string"
          }
        }
      },
      "UserUpdate": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "password": {
            "type": "string",
            "format": "password"
          },
          "role": {
            "type": "string",
            "enum": [
              "user",
              "admin",
              "org-admin",
              "org-manager",
              "org-agent"
            ]
          },
          "roleMaskId": {
            "type": "string"
          },
          "isActive": {
            "type": "boolean"
          },
          "teamIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "managedTeamIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "whatsapp": {
            "type": "string"
          },
          "bio": {
            "type": "string"
          },
          "avatarKey": {
            "type": "string"
          },
          "profileLinks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileLink"
            }
          },
          "chatSettings": {
            "$ref": "#/components/schemas/ChatSettings"
          }
        }
      },
      "CatalogItemCreate": {
        "type": "object",
        "required": [
          "templateId",
          "name"
        ],
        "properties": {
          "templateId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "maxLength": 160
          },
          "code": {
            "type": "string",
            "maxLength": 120,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$"
          },
          "shortDescription": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 500
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 10000
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "active",
              "inactive"
            ]
          },
          "primaryImage": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          },
          "unit": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 40
          },
          "finalCost": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "unitId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "sku": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 120
          },
          "brand": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 160
          },
          "tags": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "type": "string"
            }
          },
          "ownerUserId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "organization",
              "public",
              "restricted"
            ]
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "compositionType": {
            "type": "string",
            "enum": [
              "simple",
              "composite"
            ]
          },
          "categoryIds": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "attributes": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "CatalogItemUpdate": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CatalogItemCreate"
          }
        ],
        "required": []
      },
      "CatalogItem": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "templateId": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "product",
              "service",
              "plan_subscription",
              "real_estate",
              "vehicle_machine_equipment",
              "education",
              "event_ticket",
              "fee_additional"
            ]
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "active",
              "inactive"
            ]
          },
          "offers": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "categoryLinks": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "attributeValues": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "components": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "media": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        }
      },
      "SaleItemInput": {
        "type": "object",
        "required": [
          "catalogItemId",
          "catalogOfferId"
        ],
        "properties": {
          "catalogItemId": {
            "type": "string",
            "format": "uuid"
          },
          "catalogOfferId": {
            "type": "string",
            "format": "uuid"
          },
          "isPrimary": {
            "type": "boolean"
          },
          "position": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "quantity": {
            "type": "number",
            "minimum": 0.0001
          },
          "unitPrice": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "cost": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "setupFee": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "recurringAmount": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "discountType": {
            "type": "string",
            "enum": [
              "none",
              "percentage",
              "fixed"
            ]
          },
          "discountValue": {
            "type": "number",
            "minimum": 0
          },
          "additionalValue": {
            "type": "number",
            "minimum": 0
          },
          "selectedAttributes": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        }
      },
      "SaleCreate": {
        "type": "object",
        "required": [
          "contactId",
          "items"
        ],
        "properties": {
          "contactId": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "ownerUserId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "teamId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "source": {
            "type": "string",
            "enum": [
              "dashboard",
              "opportunity",
              "chat_manual",
              "ai_agent",
              "flow",
              "api",
              "form",
              "import",
              "integration"
            ],
            "default": "api"
          },
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/SaleItemInput"
            }
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "not_applicable",
              "pending",
              "scheduled",
              "preparing",
              "in_progress",
              "partially_completed",
              "completed",
              "suspended",
              "canceled"
            ]
          },
          "confirm": {
            "type": "boolean"
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "notes": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 5000
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        }
      },
      "SaleUpdate": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "contactId": {
            "type": "string",
            "format": "uuid"
          },
          "ownerUserId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "teamId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 5000
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/SaleItemInput"
            }
          }
        }
      },
      "Sale": {
        "type": "object",
        "additionalProperties": true
      },
      "CancelSale": {
        "type": "object",
        "required": [
          "reason"
        ],
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 3,
            "maxLength": 1000
          }
        }
      },
      "ChargeGroupCreate": {
        "type": "object",
        "required": [
          "name",
          "billingMode",
          "amount"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "billingMode": {
            "type": "string",
            "enum": [
              "one_time",
              "installment",
              "recurring"
            ]
          },
          "amount": {
            "type": "number",
            "minimum": 0.0001
          },
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3
          },
          "dueDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "installmentCount": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 2
          },
          "billingInterval": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 24
          },
          "billingIntervalCount": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "recurrenceEndDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "saleItemIds": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "provider": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 40
          },
          "externalReference": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 180
          },
          "notes": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        }
      },
      "FulfillmentCreate": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "saleItemId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "product_delivery",
              "digital_delivery",
              "service",
              "appointment",
              "rental",
              "reservation",
              "event",
              "enrollment",
              "other"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "not_applicable",
              "pending",
              "scheduled",
              "preparing",
              "in_progress",
              "partially_completed",
              "completed",
              "suspended",
              "canceled"
            ]
          },
          "releasePolicy": {
            "type": "string",
            "enum": [
              "manual",
              "on_first_payment",
              "on_full_payment"
            ]
          },
          "responsibleUserId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "scheduledStart": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "scheduledEnd": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "location": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 255
          },
          "quantity": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0.0001
          },
          "notes": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 5000
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        }
      },
      "CheckoutCreate": {
        "type": "object",
        "required": [
          "chargeGroupId",
          "billingTypes"
        ],
        "properties": {
          "chargeGroupId": {
            "type": "string"
          },
          "receivableId": {
            "type": "string",
            "format": "uuid"
          },
          "receivableIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 21,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "billingTypes": {
            "type": "array",
            "minItems": 1,
            "maxItems": 2,
            "items": {
              "type": "string",
              "enum": [
                "PIX",
                "CREDIT_CARD"
              ]
            }
          },
          "minutesToExpire": {
            "type": "integer",
            "minimum": 10,
            "maximum": 1440,
            "default": 120
          },
          "maxInstallmentCount": {
            "type": "integer",
            "minimum": 2,
            "maximum": 21
          },
          "replaceActiveCheckout": {
            "type": "boolean",
            "default": false
          },
          "successUrl": {
            "type": "string",
            "maxLength": 500
          },
          "cancelUrl": {
            "type": "string",
            "maxLength": 500
          },
          "expiredUrl": {
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "PaymentCreate": {
        "type": "object",
        "required": [
          "method",
          "amount"
        ],
        "properties": {
          "chargeGroupId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "method": {
            "type": "string",
            "enum": [
              "pix",
              "bank_transfer",
              "cash",
              "credit_card",
              "debit_card",
              "external_boleto",
              "trade",
              "complimentary",
              "compensation",
              "other"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "confirmed",
              "received",
              "canceled",
              "refunded"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "external",
              "integration"
            ],
            "default": "external"
          },
          "amount": {
            "type": "number",
            "minimum": 0.0001
          },
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3
          },
          "paidAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "dueDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "externalReference": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 180
          },
          "proofUrl": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          },
          "notes": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        }
      },
      "CommercialObject": {
        "type": "object",
        "additionalProperties": true
      },
      "CommercialList": {
        "type": "object",
        "additionalProperties": true
      }
    }
  }
}
