{
  "openapi": "3.1.0",
  "info": {
    "title": "Wizer Public API",
    "version": "1.6.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": "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",
      "description": "Consulta somente leitura de usuários da organização vinculada ao token."
    },
    {
      "name": "Comercial",
      "description": "Catálogo, vendas, operações, pagamentos e comissões."
    },
    {
      "name": "Financeiro",
      "description": "Categorias, receitas, despesas e baixas financeiras."
    },
    {
      "name": "Tarefas",
      "description": "Consulta e manutencao de tarefas."
    },
    {
      "name": "Conversas",
      "description": "Consulta de conversas e mensagens nao privadas da organizacao vinculada ao token."
    }
  ],
  "paths": {
    "/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"
                }
              }
            }
          }
        },
        "description": "Somente leitura. Retorna apenas usuários da organização vinculada ao token.",
        "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"
            }
          }
        ]
      }
    },
    "/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"
                }
              }
            }
          }
        },
        "description": "Somente leitura. O usuário precisa pertencer à organização vinculada ao token.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID do usuário.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/public-api/tasks/statuses": {
      "get": {
        "tags": [
          "Tarefas"
        ],
        "summary": "Listar status ativos de tarefas",
        "operationId": "listTaskStatuses",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Status ativos da organizacao.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TaskStatus"
                  }
                }
              }
            }
          },
          "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: `tasks:read`."
      }
    },
    "/api/v1/public-api/tasks": {
      "get": {
        "tags": [
          "Tarefas"
        ],
        "summary": "Listar tarefas",
        "operationId": "listTasks",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Tarefas paginadas.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskList"
                }
              }
            }
          },
          "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: `tasks:read`. Tokens tem acesso organizacional a todas as tarefas da organizacao. state aceita open (padrao), completed ou all.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Busca por titulo, descricao ou numero.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "statusId",
            "in": "query",
            "required": false,
            "description": "Status da tarefa.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "participantId",
            "in": "query",
            "required": false,
            "description": "Usuario participante.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "conversationId",
            "in": "query",
            "required": false,
            "description": "Conversa vinculada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "contactId",
            "in": "query",
            "required": false,
            "description": "Contato vinculado.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Estado combinado.",
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "completed",
                "all"
              ],
              "default": "open"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Itens por pagina.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 30
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Deslocamento.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ]
      },
      "post": {
        "tags": [
          "Tarefas"
        ],
        "summary": "Criar tarefa",
        "operationId": "createTask",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Tarefa criada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDetail"
                }
              }
            }
          },
          "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: `tasks:write`. A operacao e registrada com origem public_api; quando o token nao tem usuario associado, o autor permanece nulo. Sem usuario associado, participantIds e obrigatorio.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskCreate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/tasks/{taskId}": {
      "get": {
        "tags": [
          "Tarefas"
        ],
        "summary": "Consultar tarefa",
        "operationId": "getTask",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Recurso encontrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDetail"
                }
              }
            }
          },
          "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: `tasks:read`. O retorno omite eventos internos e arquivos.",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "description": "ID da tarefa.",
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "patch": {
        "tags": [
          "Tarefas"
        ],
        "summary": "Atualizar tarefa",
        "operationId": "updateTask",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Recurso encontrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDetail"
                }
              }
            }
          },
          "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: `tasks:write`. A operacao e registrada com origem public_api; quando o token nao tem usuario associado, o autor permanece nulo.",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "description": "ID da tarefa.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskUpdate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/tasks/{taskId}/comments": {
      "post": {
        "tags": [
          "Tarefas"
        ],
        "summary": "Adicionar comentario",
        "operationId": "addTaskComment",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Comentario criado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskComment"
                }
              }
            }
          },
          "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: `tasks:write`. A operacao e registrada com origem public_api; quando o token nao tem usuario associado, o autor permanece nulo.",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "description": "ID da tarefa.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskCommentCreate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/tasks/{taskId}/participants": {
      "post": {
        "tags": [
          "Tarefas"
        ],
        "summary": "Adicionar participante",
        "operationId": "addTaskParticipant",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Participante adicionado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDetail"
                }
              }
            }
          },
          "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: `tasks:write`. A operacao e registrada com origem public_api; quando o token nao tem usuario associado, o autor permanece nulo.",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "description": "ID da tarefa.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskParticipantCreate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/tasks/{taskId}/participants/{userId}": {
      "delete": {
        "tags": [
          "Tarefas"
        ],
        "summary": "Remover participante",
        "operationId": "removeTaskParticipant",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Participante removido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDetail"
                }
              }
            }
          },
          "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: `tasks:write`. A operacao e registrada com origem public_api; quando o token nao tem usuario associado, o autor permanece nulo.",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "description": "ID da tarefa.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "description": "ID do usuario participante.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/public-api/tasks/{taskId}/conversations": {
      "post": {
        "tags": [
          "Tarefas"
        ],
        "summary": "Vincular conversa",
        "operationId": "attachTaskConversation",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Conversa vinculada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDetail"
                }
              }
            }
          },
          "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: `tasks:write`. A operacao e registrada com origem public_api; quando o token nao tem usuario associado, o autor permanece nulo.",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "description": "ID da tarefa.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskConversationCreate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/conversations": {
      "get": {
        "tags": [
          "Conversas"
        ],
        "summary": "Listar conversas",
        "operationId": "listConversations",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Conversas da organizacao.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversationList"
                }
              }
            }
          },
          "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: `conversations:read`. O acesso fica limitado a organizacao do token.",
        "parameters": [
          {
            "name": "contactId",
            "in": "query",
            "required": false,
            "description": "Filtra conversas pelo contato.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Filtra pelo status da conversa.",
            "schema": {
              "type": "string",
              "enum": [
                "waiting",
                "in_progress",
                "finished",
                "archived"
              ]
            }
          },
          {
            "name": "channel",
            "in": "query",
            "required": false,
            "description": "Filtra pelo canal.",
            "schema": {
              "type": "string",
              "enum": [
                "whatsapp",
                "instagram",
                "messenger",
                "widget",
                "web_widget"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Itens por pagina.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Cursor opaco retornado em meta.nextCursor.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/public-api/conversations/{conversationId}": {
      "get": {
        "tags": [
          "Conversas"
        ],
        "summary": "Consultar conversa",
        "operationId": "getConversation",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Resumo da conversa.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Conversation"
                }
              }
            }
          },
          "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: `conversations:read`. O acesso fica limitado a organizacao do token.",
        "parameters": [
          {
            "name": "conversationId",
            "in": "path",
            "required": true,
            "description": "ID da conversa.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/public-api/conversations/{conversationId}/messages": {
      "get": {
        "tags": [
          "Conversas"
        ],
        "summary": "Listar mensagens da conversa",
        "operationId": "listConversationMessages",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Mensagens publicas da conversa.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversationMessageList"
                }
              }
            }
          },
          "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: `conversations:read`. O acesso fica limitado a organizacao do token. Mensagens privadas e de sistema nao sao retornadas; a consulta nao altera o contador de mensagens nao lidas.",
        "parameters": [
          {
            "name": "conversationId",
            "in": "path",
            "required": true,
            "description": "ID da conversa.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Mensagens por pagina.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 30
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Cursor opaco retornado em meta.nextCursor.",
            "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/commercial/pre-checkout-intents": {
      "post": {
        "tags": [
          "Comercial"
        ],
        "summary": "Iniciar intenção anônima de pré-checkout",
        "operationId": "startPreCheckoutIntent",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Intencao criada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreCheckoutIntentSummary"
                }
              }
            }
          },
          "200": {
            "description": "Requisicao idempotente.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreCheckoutIntentSummary"
                }
              }
            }
          },
          "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: `checkout_intents:write`. O token bruto nunca e persistido.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreCheckoutIntentStart"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/commercial/pre-checkout-intents/complete": {
      "post": {
        "tags": [
          "Comercial"
        ],
        "summary": "Concluir pré-checkout com dados do contato",
        "operationId": "completePreCheckoutIntent",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Intencao concluida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreCheckoutIntentSummary"
                }
              }
            }
          },
          "200": {
            "description": "Requisicao idempotente.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreCheckoutIntentSummary"
                }
              }
            }
          },
          "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: `checkout_intents:write`. Resolve contato por telefone exato e cria ou associa oportunidade sem duplicar origem Asaas.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreCheckoutIntentComplete"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/commercial/pre-checkout-intents/{intentId}": {
      "get": {
        "tags": [
          "Comercial"
        ],
        "summary": "Consultar intenção de pré-checkout",
        "operationId": "getPreCheckoutIntent",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Resumo da intencao.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreCheckoutIntentSummary"
                }
              }
            }
          },
          "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: `checkout_intents:read`. Nao retorna token bruto nem dados pessoais.",
        "parameters": [
          {
            "name": "intentId",
            "in": "path",
            "required": true,
            "description": "ID da intencao.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/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
            }
          }
        ]
      }
    },
    "/api/v1/public-api/financial/categories": {
      "get": {
        "tags": [
          "Financeiro"
        ],
        "summary": "Listar categorias financeiras",
        "operationId": "listFinancialCategories",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Categorias financeiras ativas.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/FinancialCategory"
                  }
                }
              }
            }
          },
          "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: `financial:read`."
      }
    },
    "/api/v1/public-api/financial/entries": {
      "get": {
        "tags": [
          "Financeiro"
        ],
        "summary": "Listar lancamentos financeiros",
        "operationId": "listFinancialEntries",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Lancamentos financeiros.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/FinancialEntry"
                  }
                }
              }
            }
          },
          "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: `financial:read`.",
        "parameters": [
          {
            "name": "direction",
            "in": "query",
            "required": false,
            "description": "Direcao do lancamento.",
            "schema": {
              "type": "string",
              "enum": [
                "income",
                "expense"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Status do lancamento.",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "pending",
                "partially_settled",
                "settled",
                "overdue",
                "canceled"
              ]
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "description": "Vencimento inicial, inclusive.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "description": "Vencimento final, inclusive.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Busca na descricao ou contraparte.",
            "schema": {
              "type": "string",
              "maxLength": 160
            }
          }
        ]
      },
      "post": {
        "tags": [
          "Financeiro"
        ],
        "summary": "Criar lancamento financeiro",
        "operationId": "createFinancialEntry",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Lancamentos criados.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/FinancialEntry"
                  }
                }
              }
            }
          },
          "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: `financial:write`. A resposta e um array porque a requisicao pode gerar parcelas.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FinancialEntryCreate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/financial/entries/{entryId}": {
      "get": {
        "tags": [
          "Financeiro"
        ],
        "summary": "Consultar lancamento financeiro",
        "operationId": "getFinancialEntry",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Lancamento encontrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialEntry"
                }
              }
            }
          },
          "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: `financial:read`.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "description": "ID do lancamento financeiro.",
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "patch": {
        "tags": [
          "Financeiro"
        ],
        "summary": "Atualizar lancamento financeiro manual",
        "operationId": "updateFinancialEntry",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Lancamento atualizado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialEntry"
                }
              }
            }
          },
          "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: `financial:write`. Apenas lancamentos manuais podem ser atualizados.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "description": "ID do lancamento financeiro.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FinancialEntryUpdate"
              }
            }
          }
        }
      }
    },
    "/api/v1/public-api/financial/entries/{entryId}/settle": {
      "post": {
        "tags": [
          "Financeiro"
        ],
        "summary": "Registrar baixa total ou parcial",
        "operationId": "settleFinancialEntry",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Baixa registrada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialEntry"
                }
              }
            }
          },
          "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: `financial:write`. Sem amount, baixa todo o saldo pendente.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "description": "ID do lancamento financeiro.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FinancialEntrySettle"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Wizer public API token"
      }
    },
    "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
          }
        }
      },
      "TaskStatus": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          },
          "isInitial": {
            "type": "boolean"
          },
          "isCompleted": {
            "type": "boolean"
          },
          "isActive": {
            "type": "boolean"
          },
          "isDefault": {
            "type": "boolean"
          }
        }
      },
      "TaskParticipant": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "addedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TaskComment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "content": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "author": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "TaskConversation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "relationType": {
            "type": "string",
            "enum": [
              "source",
              "related"
            ]
          },
          "channel": {
            "type": [
              "string",
              "null"
            ]
          },
          "accountName": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Task": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "number": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "statusId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskStatus"
              },
              {
                "type": "null"
              }
            ]
          },
          "contact": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "phoneNumber": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "participants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskParticipant"
            }
          },
          "conversations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "relationType": {
                  "type": "string"
                }
              }
            }
          },
          "source": {
            "type": "string"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lastActivityAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TaskDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Task"
          },
          {
            "type": "object",
            "properties": {
              "participants": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TaskParticipant"
                }
              },
              "comments": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TaskComment"
                }
              },
              "conversations": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TaskConversation"
                }
              }
            }
          }
        ]
      },
      "TaskList": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Task"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/PaginationMeta"
          }
        }
      },
      "TaskCreate": {
        "type": "object",
        "required": [
          "title"
        ],
        "properties": {
          "title": {
            "type": "string",
            "minLength": 2,
            "maxLength": 180
          },
          "description": {
            "type": "string",
            "maxLength": 10000
          },
          "statusId": {
            "type": "string",
            "format": "uuid"
          },
          "contactId": {
            "type": "string",
            "format": "uuid"
          },
          "conversationId": {
            "type": "string",
            "format": "uuid"
          },
          "participantIds": {
            "type": "array",
            "uniqueItems": true,
            "maxItems": 50,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "TaskUpdate": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 2,
            "maxLength": 180
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "statusId": {
            "type": "string",
            "format": "uuid"
          },
          "contactId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        }
      },
      "TaskCommentCreate": {
        "type": "object",
        "required": [
          "content"
        ],
        "properties": {
          "content": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          }
        }
      },
      "TaskParticipantCreate": {
        "type": "object",
        "required": [
          "userId"
        ],
        "properties": {
          "userId": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "TaskConversationCreate": {
        "type": "object",
        "required": [
          "conversationId"
        ],
        "properties": {
          "conversationId": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "Conversation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "contactId",
          "contactName",
          "channel",
          "status",
          "assigneeId",
          "teamId",
          "lastMessageAt",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "contactId": {
            "type": "string",
            "format": "uuid"
          },
          "contactName": {
            "type": [
              "string",
              "null"
            ]
          },
          "channel": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "waiting",
              "in_progress",
              "finished",
              "archived"
            ]
          },
          "assigneeId": {
            "type": [
              "string",
              "null"
            ]
          },
          "teamId": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastMessageAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ConversationCursorMeta": {
        "type": "object",
        "required": [
          "limit",
          "hasMore",
          "nextCursor"
        ],
        "properties": {
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ConversationList": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Conversation"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/ConversationCursorMeta"
          }
        }
      },
      "ConversationMessage": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "content",
          "direction",
          "senderType",
          "sentAt",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "content": {
            "type": "string"
          },
          "direction": {
            "type": "string",
            "enum": [
              "incoming",
              "outgoing"
            ]
          },
          "senderType": {
            "type": "string",
            "enum": [
              "contact",
              "user",
              "assistant"
            ]
          },
          "sentAt": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "ConversationMessageList": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConversationMessage"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/ConversationCursorMeta"
          }
        }
      },
      "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"
          }
        }
      },
      "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
      },
      "PreCheckoutContact": {
        "type": "object",
        "required": [
          "name",
          "phoneNumber"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "phoneNumber": {
            "type": "string",
            "minLength": 8,
            "maxLength": 32
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "format": "email",
            "maxLength": 254
          },
          "documentNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 32
          }
        }
      },
      "PreCheckoutPurchase": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3
          },
          "expectedTotal": {
            "type": "string",
            "pattern": "^[0-9]+(\\.[0-9]{1,2})?$"
          },
          "productReference": {
            "type": "string",
            "maxLength": 160
          },
          "description": {
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "PreCheckoutIntentStart": {
        "type": "object",
        "required": [
          "token",
          "source"
        ],
        "properties": {
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "token": {
            "type": "string",
            "minLength": 32,
            "maxLength": 128
          },
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          },
          "tracking": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 500
            }
          },
          "urlParameters": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 500
            }
          }
        }
      },
      "PreCheckoutIntentComplete": {
        "type": "object",
        "required": [
          "token",
          "source",
          "contact"
        ],
        "properties": {
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "token": {
            "type": "string",
            "minLength": 32,
            "maxLength": 128
          },
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          },
          "contact": {
            "$ref": "#/components/schemas/PreCheckoutContact"
          },
          "purchase": {
            "$ref": "#/components/schemas/PreCheckoutPurchase"
          },
          "tracking": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 500
            }
          },
          "urlParameters": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 500
            }
          }
        }
      },
      "PreCheckoutIntentSummary": {
        "type": "object",
        "required": [
          "id",
          "state",
          "source",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "started",
              "completed",
              "converted",
              "expired"
            ]
          },
          "source": {
            "type": "string"
          },
          "contactId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "opportunityId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "saleId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "convertedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "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
          }
        }
      },
      "FinancialCategory": {
        "type": "object",
        "required": [
          "id",
          "direction",
          "name",
          "isSystem",
          "isActive",
          "sortOrder",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "direction": {
            "type": "string",
            "enum": [
              "income",
              "expense"
            ]
          },
          "name": {
            "type": "string"
          },
          "parentId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "isSystem": {
            "type": "boolean"
          },
          "isActive": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "integer"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FinancialEntry": {
        "type": "object",
        "required": [
          "id",
          "direction",
          "status",
          "description",
          "competenceDate",
          "dueDate",
          "currency",
          "grossAmount",
          "netAmount",
          "settledAmount",
          "outstandingAmount",
          "sourceModule",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "direction": {
            "type": "string",
            "enum": [
              "income",
              "expense"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "pending",
              "partially_settled",
              "settled",
              "overdue",
              "canceled"
            ]
          },
          "description": {
            "type": "string"
          },
          "categoryId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "contactId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "counterpartyName": {
            "type": [
              "string",
              "null"
            ]
          },
          "competenceDate": {
            "type": "string",
            "format": "date"
          },
          "dueDate": {
            "type": "string",
            "format": "date"
          },
          "settledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3
          },
          "grossAmount": {
            "type": "string"
          },
          "discountAmount": {
            "type": "string"
          },
          "interestAmount": {
            "type": "string"
          },
          "fineAmount": {
            "type": "string"
          },
          "feeAmount": {
            "type": "string"
          },
          "netAmount": {
            "type": "string"
          },
          "settledAmount": {
            "type": "string"
          },
          "outstandingAmount": {
            "type": "string"
          },
          "recurrenceId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "installmentGroupId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "installmentNumber": {
            "type": [
              "integer",
              "null"
            ]
          },
          "installmentCount": {
            "type": [
              "integer",
              "null"
            ]
          },
          "sourceModule": {
            "type": "string"
          },
          "sourceType": {
            "type": [
              "string",
              "null"
            ]
          },
          "sourceId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FinancialEntryCreate": {
        "type": "object",
        "required": [
          "direction",
          "description",
          "competenceDate",
          "dueDate",
          "grossAmount"
        ],
        "properties": {
          "direction": {
            "type": "string",
            "enum": [
              "income",
              "expense"
            ]
          },
          "description": {
            "type": "string"
          },
          "categoryId": {
            "type": "string",
            "format": "uuid"
          },
          "counterpartyName": {
            "type": "string"
          },
          "competenceDate": {
            "type": "string",
            "format": "date"
          },
          "dueDate": {
            "type": "string",
            "format": "date"
          },
          "grossAmount": {
            "type": "number",
            "minimum": 0
          },
          "discountAmount": {
            "type": "number",
            "minimum": 0
          },
          "interestAmount": {
            "type": "number",
            "minimum": 0
          },
          "fineAmount": {
            "type": "number",
            "minimum": 0
          },
          "feeAmount": {
            "type": "number",
            "minimum": 0
          },
          "notes": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "pending",
              "settled"
            ]
          },
          "installmentCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 120
          },
          "recurring": {
            "type": "boolean"
          },
          "frequency": {
            "type": "string",
            "enum": [
              "weekly",
              "monthly",
              "bimonthly",
              "quarterly",
              "semiannual",
              "annual"
            ]
          },
          "recurrenceEndDate": {
            "type": "string",
            "format": "date"
          },
          "attachmentFileIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "extractionId": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "FinancialEntryUpdate": {
        "allOf": [
          {
            "$ref": "#/components/schemas/FinancialEntryCreate"
          }
        ],
        "required": [],
        "description": "Todos os campos sao opcionais no PATCH. Apenas lancamentos manuais podem ser alterados."
      },
      "FinancialEntrySettle": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "number",
            "minimum": 0.01
          }
        }
      },
      "CommercialObject": {
        "type": "object",
        "additionalProperties": true
      },
      "CommercialList": {
        "type": "object",
        "additionalProperties": true
      },
      "AgentV2Summary": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "AgentV2List": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentV2Summary"
            }
          }
        }
      },
      "AgentV2Details": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "status",
          "configurationRevision",
          "editableSections"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "editableSections": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "identity": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "editable": {
                    "type": "boolean"
                  },
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "name",
                        "assistantRole",
                        "companyName"
                      ]
                    }
                  }
                }
              },
              "communication": {
                "type": "boolean"
              },
              "topics": {
                "type": "boolean"
              },
              "handoff": {
                "type": "boolean"
              },
              "knowledge": {
                "type": "boolean"
              },
              "faq": {
                "type": "boolean"
              },
              "dataCollection": {
                "type": "boolean"
              },
              "opportunityOpening": {
                "type": "boolean"
              },
              "commercialClosing": {
                "type": "boolean"
              },
              "advancedStrategy": {
                "type": "boolean"
              },
              "tools": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "reengagement": {
                    "type": "boolean"
                  },
                  "contentDelivery": {
                    "type": "boolean"
                  },
                  "http": {
                    "type": "boolean"
                  },
                  "smartTags": {
                    "type": "boolean"
                  },
                  "followup": {
                    "type": "boolean"
                  },
                  "scheduler": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      },
      "AgentKnowledgeDocument": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "fileType": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "errorMessage": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AgentKnowledgeDocumentsEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentKnowledgeDocument"
            }
          }
        }
      },
      "AgentDocumentCreate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision",
          "organizationFileId"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0
          },
          "organizationFileId": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "AgentDocumentDelete": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AgentDocumentWriteResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings",
          "document"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "document": {
            "$ref": "#/components/schemas/AgentKnowledgeDocument"
          }
        }
      },
      "AgentDocumentDeleteResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AgentIdentityData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "assistantRole": {
            "type": "string",
            "maxLength": 200
          },
          "companyName": {
            "type": "string",
            "maxLength": 200
          },
          "editableFields": {
            "type": "array",
            "readOnly": true,
            "items": {
              "type": "string",
              "enum": [
                "name",
                "assistantRole",
                "companyName"
              ]
            }
          }
        }
      },
      "AgentIdentityPatchData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "assistantRole": {
            "type": "string",
            "maxLength": 200
          },
          "companyName": {
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "AgentIdentityEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "$ref": "#/components/schemas/AgentIdentityData"
          }
        }
      },
      "AgentIdentityWriteEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "$ref": "#/components/schemas/AgentIdentityData"
          }
        }
      },
      "AgentIdentityPatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "data": {
            "$ref": "#/components/schemas/AgentIdentityPatchData",
            "minProperties": 1
          }
        }
      },
      "AgentCommunicationData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "responsePatterns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tones": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "techniques": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AgentCommunicationPatchData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "responsePatterns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tones": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "techniques": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AgentCommunicationEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "$ref": "#/components/schemas/AgentCommunicationData"
          }
        }
      },
      "AgentCommunicationWriteEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "$ref": "#/components/schemas/AgentCommunicationData"
          }
        }
      },
      "AgentCommunicationPatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "data": {
            "$ref": "#/components/schemas/AgentCommunicationPatchData",
            "minProperties": 1
          }
        }
      },
      "AgentTopicsData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "allowedTopics": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "forbiddenTopics": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AgentTopicsPatchData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "allowedTopics": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "forbiddenTopics": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AgentTopicsEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "$ref": "#/components/schemas/AgentTopicsData"
          }
        }
      },
      "AgentTopicsWriteEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "$ref": "#/components/schemas/AgentTopicsData"
          }
        }
      },
      "AgentTopicsPatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "data": {
            "$ref": "#/components/schemas/AgentTopicsPatchData",
            "minProperties": 1
          }
        }
      },
      "AgentFaqData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "question",
                "answer"
              ],
              "properties": {
                "question": {
                  "type": "string"
                },
                "answer": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "AgentFaqPatchData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "question",
                "answer"
              ],
              "properties": {
                "question": {
                  "type": "string"
                },
                "answer": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "AgentFaqEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "$ref": "#/components/schemas/AgentFaqData"
          }
        }
      },
      "AgentFaqWriteEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "$ref": "#/components/schemas/AgentFaqData"
          }
        }
      },
      "AgentFaqPatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "data": {
            "$ref": "#/components/schemas/AgentFaqPatchData",
            "minProperties": 1
          }
        }
      },
      "AgentDataCollectionData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "slug",
                "description",
                "type",
                "required"
              ],
              "properties": {
                "slug": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "phone",
                    "whatsapp_phone",
                    "email",
                    "name",
                    "cpf",
                    "cnpj",
                    "image_collection"
                  ]
                },
                "required": {
                  "type": "boolean"
                },
                "expectedImageCount": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "minimum": 1
                },
                "expectedImageCountMode": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "fixed",
                    "dynamic",
                    null
                  ]
                },
                "expectedImageCountSourceField": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "maxImageCount": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "minimum": 1
                },
                "acceptanceNotes": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "transferAfterCollection": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "enabled",
              "teamId"
            ],
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "teamId": {
                "type": "string"
              }
            }
          }
        }
      },
      "AgentDataCollectionPatchData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "slug",
                "description",
                "type",
                "required"
              ],
              "properties": {
                "slug": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "phone",
                    "whatsapp_phone",
                    "email",
                    "name",
                    "cpf",
                    "cnpj",
                    "image_collection"
                  ]
                },
                "required": {
                  "type": "boolean"
                },
                "expectedImageCount": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "minimum": 1
                },
                "expectedImageCountMode": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "fixed",
                    "dynamic",
                    null
                  ]
                },
                "expectedImageCountSourceField": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "maxImageCount": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "minimum": 1
                },
                "acceptanceNotes": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "transferAfterCollection": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "enabled",
              "teamId"
            ],
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "teamId": {
                "type": "string"
              }
            }
          }
        }
      },
      "AgentDataCollectionEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "$ref": "#/components/schemas/AgentDataCollectionData"
          }
        }
      },
      "AgentDataCollectionWriteEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "$ref": "#/components/schemas/AgentDataCollectionData"
          }
        }
      },
      "AgentDataCollectionPatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "data": {
            "$ref": "#/components/schemas/AgentDataCollectionPatchData",
            "minProperties": 1
          }
        }
      },
      "AgentHandoffData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "fallbackInstructions": {
            "type": "string"
          },
          "routingMode": {
            "type": "string",
            "enum": [
              "legacy",
              "assignment_v2",
              "shadow",
              "deterministic_v2"
            ],
            "description": "legacy pode aparecer em leitura de configuracao ainda nao migrada; PATCH aceita apenas modos V2."
          },
          "clarificationEnabled": {
            "type": "boolean"
          },
          "factSchema": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "key",
                "type",
                "description"
              ],
              "properties": {
                "key": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "boolean",
                    "date",
                    "enum",
                    "string_list"
                  ]
                },
                "description": {
                  "type": "string"
                },
                "enumValues": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "routes": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "teamId",
                "label",
                "routingInstructions",
                "priority",
                "isActive",
                "isDefault"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "teamId": {
                  "type": "string",
                  "format": "uuid"
                },
                "label": {
                  "type": "string"
                },
                "routingInstructions": {
                  "type": "string"
                },
                "priority": {
                  "type": "integer"
                },
                "isActive": {
                  "type": "boolean"
                },
                "successMessage": {
                  "type": "string"
                },
                "isDefault": {
                  "type": "boolean"
                },
                "policyDefinition": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "schemaVersion": {
                      "type": "integer",
                      "const": 1
                    },
                    "requiredFacts": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "when": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "all"
                          ],
                          "properties": {
                            "all": {
                              "type": "array",
                              "items": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "fact",
                                      "operator"
                                    ],
                                    "properties": {
                                      "fact": {
                                        "type": "string"
                                      },
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "eq",
                                          "neq",
                                          "in",
                                          "not_in",
                                          "gt",
                                          "gte",
                                          "lt",
                                          "lte",
                                          "contains",
                                          "starts_with",
                                          "exists",
                                          "not_exists",
                                          "between",
                                          "matches"
                                        ]
                                      },
                                      "value": {}
                                    }
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "not"
                                    ],
                                    "properties": {
                                      "not": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "fact",
                                          "operator"
                                        ],
                                        "properties": {
                                          "fact": {
                                            "type": "string"
                                          },
                                          "operator": {
                                            "type": "string",
                                            "enum": [
                                              "eq",
                                              "neq",
                                              "in",
                                              "not_in",
                                              "gt",
                                              "gte",
                                              "lt",
                                              "lte",
                                              "contains",
                                              "starts_with",
                                              "exists",
                                              "not_exists",
                                              "between",
                                              "matches"
                                            ]
                                          },
                                          "value": {}
                                        }
                                      }
                                    }
                                  }
                                ]
                              }
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "any"
                          ],
                          "properties": {
                            "any": {
                              "type": "array",
                              "items": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "fact",
                                      "operator"
                                    ],
                                    "properties": {
                                      "fact": {
                                        "type": "string"
                                      },
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "eq",
                                          "neq",
                                          "in",
                                          "not_in",
                                          "gt",
                                          "gte",
                                          "lt",
                                          "lte",
                                          "contains",
                                          "starts_with",
                                          "exists",
                                          "not_exists",
                                          "between",
                                          "matches"
                                        ]
                                      },
                                      "value": {}
                                    }
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "not"
                                    ],
                                    "properties": {
                                      "not": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "fact",
                                          "operator"
                                        ],
                                        "properties": {
                                          "fact": {
                                            "type": "string"
                                          },
                                          "operator": {
                                            "type": "string",
                                            "enum": [
                                              "eq",
                                              "neq",
                                              "in",
                                              "not_in",
                                              "gt",
                                              "gte",
                                              "lt",
                                              "lte",
                                              "contains",
                                              "starts_with",
                                              "exists",
                                              "not_exists",
                                              "between",
                                              "matches"
                                            ]
                                          },
                                          "value": {}
                                        }
                                      }
                                    }
                                  }
                                ]
                              }
                            }
                          }
                        }
                      ]
                    }
                  }
                },
                "requiredSkills": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "AgentHandoffPatchData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "fallbackInstructions": {
            "type": "string"
          },
          "routingMode": {
            "type": "string",
            "enum": [
              "assignment_v2",
              "shadow",
              "deterministic_v2"
            ]
          },
          "clarificationEnabled": {
            "type": "boolean"
          },
          "factSchema": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "key",
                "type",
                "description"
              ],
              "properties": {
                "key": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "boolean",
                    "date",
                    "enum",
                    "string_list"
                  ]
                },
                "description": {
                  "type": "string"
                },
                "enumValues": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "routes": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "teamId",
                "label",
                "routingInstructions",
                "priority",
                "isActive",
                "isDefault"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "teamId": {
                  "type": "string",
                  "format": "uuid"
                },
                "label": {
                  "type": "string"
                },
                "routingInstructions": {
                  "type": "string"
                },
                "priority": {
                  "type": "integer"
                },
                "isActive": {
                  "type": "boolean"
                },
                "successMessage": {
                  "type": "string"
                },
                "isDefault": {
                  "type": "boolean"
                },
                "policyDefinition": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "schemaVersion": {
                      "type": "integer",
                      "const": 1
                    },
                    "requiredFacts": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "when": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "all"
                          ],
                          "properties": {
                            "all": {
                              "type": "array",
                              "items": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "fact",
                                      "operator"
                                    ],
                                    "properties": {
                                      "fact": {
                                        "type": "string"
                                      },
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "eq",
                                          "neq",
                                          "in",
                                          "not_in",
                                          "gt",
                                          "gte",
                                          "lt",
                                          "lte",
                                          "contains",
                                          "starts_with",
                                          "exists",
                                          "not_exists",
                                          "between",
                                          "matches"
                                        ]
                                      },
                                      "value": {}
                                    }
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "not"
                                    ],
                                    "properties": {
                                      "not": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "fact",
                                          "operator"
                                        ],
                                        "properties": {
                                          "fact": {
                                            "type": "string"
                                          },
                                          "operator": {
                                            "type": "string",
                                            "enum": [
                                              "eq",
                                              "neq",
                                              "in",
                                              "not_in",
                                              "gt",
                                              "gte",
                                              "lt",
                                              "lte",
                                              "contains",
                                              "starts_with",
                                              "exists",
                                              "not_exists",
                                              "between",
                                              "matches"
                                            ]
                                          },
                                          "value": {}
                                        }
                                      }
                                    }
                                  }
                                ]
                              }
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "any"
                          ],
                          "properties": {
                            "any": {
                              "type": "array",
                              "items": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "fact",
                                      "operator"
                                    ],
                                    "properties": {
                                      "fact": {
                                        "type": "string"
                                      },
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "eq",
                                          "neq",
                                          "in",
                                          "not_in",
                                          "gt",
                                          "gte",
                                          "lt",
                                          "lte",
                                          "contains",
                                          "starts_with",
                                          "exists",
                                          "not_exists",
                                          "between",
                                          "matches"
                                        ]
                                      },
                                      "value": {}
                                    }
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "not"
                                    ],
                                    "properties": {
                                      "not": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "fact",
                                          "operator"
                                        ],
                                        "properties": {
                                          "fact": {
                                            "type": "string"
                                          },
                                          "operator": {
                                            "type": "string",
                                            "enum": [
                                              "eq",
                                              "neq",
                                              "in",
                                              "not_in",
                                              "gt",
                                              "gte",
                                              "lt",
                                              "lte",
                                              "contains",
                                              "starts_with",
                                              "exists",
                                              "not_exists",
                                              "between",
                                              "matches"
                                            ]
                                          },
                                          "value": {}
                                        }
                                      }
                                    }
                                  }
                                ]
                              }
                            }
                          }
                        }
                      ]
                    }
                  }
                },
                "requiredSkills": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "AgentHandoffEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "$ref": "#/components/schemas/AgentHandoffData"
          }
        }
      },
      "AgentHandoffWriteEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "$ref": "#/components/schemas/AgentHandoffData"
          }
        }
      },
      "AgentHandoffPatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "data": {
            "$ref": "#/components/schemas/AgentHandoffPatchData",
            "minProperties": 1
          }
        }
      },
      "AgentOpportunityOpeningData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "triggerMode": {
            "type": "string",
            "enum": [
              "qualified",
              "intent",
              "custom"
            ]
          },
          "triggerRules": {
            "type": "string"
          },
          "pipelineId": {
            "type": "string"
          },
          "stageId": {
            "type": "string"
          },
          "successMessage": {
            "type": "string"
          }
        }
      },
      "AgentOpportunityOpeningPatchData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "triggerMode": {
            "type": "string",
            "enum": [
              "qualified",
              "intent",
              "custom"
            ]
          },
          "triggerRules": {
            "type": "string"
          },
          "pipelineId": {
            "type": "string"
          },
          "stageId": {
            "type": "string"
          },
          "successMessage": {
            "type": "string"
          }
        }
      },
      "AgentOpportunityOpeningEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "$ref": "#/components/schemas/AgentOpportunityOpeningData"
          }
        }
      },
      "AgentOpportunityOpeningWriteEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "$ref": "#/components/schemas/AgentOpportunityOpeningData"
          }
        }
      },
      "AgentOpportunityOpeningPatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "data": {
            "$ref": "#/components/schemas/AgentOpportunityOpeningPatchData",
            "minProperties": 1
          }
        }
      },
      "AgentCommercialClosingData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "name"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "enabled": {
                  "type": "boolean"
                },
                "triggerInstructions": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "contentType": {
                  "type": "string",
                  "enum": [
                    "pix_key",
                    "pix_copy_paste",
                    "payment_link",
                    "boleto_line",
                    "tracking_code",
                    "access_code",
                    "document_link",
                    "scheduling_link",
                    "generic_copyable"
                  ]
                },
                "copyableLabel": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "copyableContent": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "copyableSourceField": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "introMessage": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "afterMessage": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "requireConfirmation": {
                  "type": "boolean"
                }
              }
            }
          }
        }
      },
      "AgentCommercialClosingPatchData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "name"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "enabled": {
                  "type": "boolean"
                },
                "triggerInstructions": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "contentType": {
                  "type": "string",
                  "enum": [
                    "pix_key",
                    "pix_copy_paste",
                    "payment_link",
                    "boleto_line",
                    "tracking_code",
                    "access_code",
                    "document_link",
                    "scheduling_link",
                    "generic_copyable"
                  ]
                },
                "copyableLabel": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "copyableContent": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "copyableSourceField": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "introMessage": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "afterMessage": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "requireConfirmation": {
                  "type": "boolean"
                }
              }
            }
          }
        }
      },
      "AgentCommercialClosingEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "$ref": "#/components/schemas/AgentCommercialClosingData"
          }
        }
      },
      "AgentCommercialClosingWriteEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "$ref": "#/components/schemas/AgentCommercialClosingData"
          }
        }
      },
      "AgentCommercialClosingPatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "data": {
            "$ref": "#/components/schemas/AgentCommercialClosingPatchData",
            "minProperties": 1
          }
        }
      },
      "AgentAdvancedStrategyData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "secondaryObjectives": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "successCriteria": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "conversation": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "opening": {
                "type": "string"
              },
              "closing": {
                "type": "string"
              },
              "guidance": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "objectionHandling": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "channels": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "defaultRules": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "overrides": {
                "type": "object",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "advancedInstructions": {
            "type": "string"
          }
        }
      },
      "AgentAdvancedStrategyPatchData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "secondaryObjectives": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "successCriteria": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "conversation": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "opening": {
                "type": "string"
              },
              "closing": {
                "type": "string"
              },
              "guidance": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "objectionHandling": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "channels": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "defaultRules": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "overrides": {
                "type": "object",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "advancedInstructions": {
            "type": "string"
          }
        }
      },
      "AgentAdvancedStrategyEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "$ref": "#/components/schemas/AgentAdvancedStrategyData"
          }
        }
      },
      "AgentAdvancedStrategyWriteEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "$ref": "#/components/schemas/AgentAdvancedStrategyData"
          }
        }
      },
      "AgentAdvancedStrategyPatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "data": {
            "$ref": "#/components/schemas/AgentAdvancedStrategyPatchData",
            "minProperties": 1
          }
        }
      },
      "AgentReengagementData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "contactPausedContacts": {
            "type": "boolean"
          },
          "inactivityHours": {
            "type": "integer",
            "minimum": 1
          },
          "maxAttempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2
          },
          "maxConversationAgeDays": {
            "type": "integer",
            "minimum": 1
          },
          "attemptInstructions": {
            "type": "array",
            "maxItems": 2,
            "items": {
              "type": "string"
            }
          },
          "positiveScenarios": {
            "type": "string"
          },
          "negativeScenarios": {
            "type": "string"
          }
        }
      },
      "AgentReengagementPatchData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "contactPausedContacts": {
            "type": "boolean"
          },
          "inactivityHours": {
            "type": "integer",
            "minimum": 1
          },
          "maxAttempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2
          },
          "maxConversationAgeDays": {
            "type": "integer",
            "minimum": 1
          },
          "attemptInstructions": {
            "type": "array",
            "maxItems": 2,
            "items": {
              "type": "string"
            }
          },
          "positiveScenarios": {
            "type": "string"
          },
          "negativeScenarios": {
            "type": "string"
          }
        }
      },
      "AgentReengagementEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "$ref": "#/components/schemas/AgentReengagementData"
          }
        }
      },
      "AgentReengagementWriteEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "$ref": "#/components/schemas/AgentReengagementData"
          }
        }
      },
      "AgentReengagementPatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "data": {
            "$ref": "#/components/schemas/AgentReengagementPatchData",
            "minProperties": 1
          }
        }
      },
      "AgentContentDeliveryData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "rules": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "mediaType"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "trigger": {
                  "type": "string"
                },
                "mediaType": {
                  "type": "string",
                  "enum": [
                    "image",
                    "pdf",
                    "video",
                    "audio",
                    "link"
                  ]
                },
                "mediaName": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "fileId": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                }
              }
            }
          }
        }
      },
      "AgentContentDeliveryPatchData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "rules": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "mediaType"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "trigger": {
                  "type": "string"
                },
                "mediaType": {
                  "type": "string",
                  "enum": [
                    "image",
                    "pdf",
                    "video",
                    "audio",
                    "link"
                  ]
                },
                "mediaName": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "fileId": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                }
              }
            }
          }
        }
      },
      "AgentContentDeliveryEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "$ref": "#/components/schemas/AgentContentDeliveryData"
          }
        }
      },
      "AgentContentDeliveryWriteEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "$ref": "#/components/schemas/AgentContentDeliveryData"
          }
        }
      },
      "AgentContentDeliveryPatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "data": {
            "$ref": "#/components/schemas/AgentContentDeliveryPatchData",
            "minProperties": 1
          }
        }
      },
      "AgentHttpToolsData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id",
                "enabled",
                "name",
                "method",
                "url",
                "headers",
                "params",
                "bodyType",
                "body",
                "timeout",
                "risk",
                "allowedHosts"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "enabled": {
                  "type": "boolean"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "method": {
                  "type": "string",
                  "enum": [
                    "GET",
                    "POST",
                    "PUT",
                    "PATCH",
                    "DELETE"
                  ]
                },
                "url": {
                  "type": "string"
                },
                "headers": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "id",
                      "key",
                      "value"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "key": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string",
                        "description": "Secrets configurados sao mascarados em leitura."
                      }
                    }
                  }
                },
                "params": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "id",
                      "key",
                      "value"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "key": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string",
                        "description": "Secrets configurados sao mascarados em leitura."
                      }
                    }
                  }
                },
                "bodyType": {
                  "type": "string",
                  "enum": [
                    "json",
                    "none"
                  ]
                },
                "body": {
                  "type": "string"
                },
                "timeout": {
                  "type": "integer",
                  "minimum": 1000,
                  "maximum": 30000
                },
                "risk": {
                  "type": "string",
                  "enum": [
                    "read",
                    "write",
                    "destructive"
                  ]
                },
                "allowedHosts": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "secretMutations": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "toolId",
                    "fieldPath",
                    "operation",
                    "value"
                  ],
                  "properties": {
                    "toolId": {
                      "type": "string"
                    },
                    "fieldPath": {
                      "type": "string",
                      "pattern": "^headers\\\\.\\\\d+\\\\.value$"
                    },
                    "operation": {
                      "type": "string",
                      "const": "replace"
                    },
                    "value": {
                      "type": "string"
                    }
                  }
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "toolId",
                    "fieldPath",
                    "operation"
                  ],
                  "properties": {
                    "toolId": {
                      "type": "string"
                    },
                    "fieldPath": {
                      "type": "string",
                      "pattern": "^headers\\\\.\\\\d+\\\\.value$"
                    },
                    "operation": {
                      "type": "string",
                      "const": "remove"
                    }
                  }
                }
              ]
            },
            "writeOnly": true
          }
        }
      },
      "AgentHttpToolsPatchData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id",
                "enabled",
                "name",
                "method",
                "url",
                "headers",
                "params",
                "bodyType",
                "body",
                "timeout",
                "risk",
                "allowedHosts"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "enabled": {
                  "type": "boolean"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "method": {
                  "type": "string",
                  "enum": [
                    "GET",
                    "POST",
                    "PUT",
                    "PATCH",
                    "DELETE"
                  ]
                },
                "url": {
                  "type": "string"
                },
                "headers": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "id",
                      "key",
                      "value"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "key": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string",
                        "description": "Secrets configurados sao mascarados em leitura."
                      }
                    }
                  }
                },
                "params": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "id",
                      "key",
                      "value"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "key": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string",
                        "description": "Secrets configurados sao mascarados em leitura."
                      }
                    }
                  }
                },
                "bodyType": {
                  "type": "string",
                  "enum": [
                    "json",
                    "none"
                  ]
                },
                "body": {
                  "type": "string"
                },
                "timeout": {
                  "type": "integer",
                  "minimum": 1000,
                  "maximum": 30000
                },
                "risk": {
                  "type": "string",
                  "enum": [
                    "read",
                    "write",
                    "destructive"
                  ]
                },
                "allowedHosts": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "secretMutations": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "toolId",
                    "fieldPath",
                    "operation",
                    "value"
                  ],
                  "properties": {
                    "toolId": {
                      "type": "string"
                    },
                    "fieldPath": {
                      "type": "string",
                      "pattern": "^headers\\\\.\\\\d+\\\\.value$"
                    },
                    "operation": {
                      "type": "string",
                      "const": "replace"
                    },
                    "value": {
                      "type": "string"
                    }
                  }
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "toolId",
                    "fieldPath",
                    "operation"
                  ],
                  "properties": {
                    "toolId": {
                      "type": "string"
                    },
                    "fieldPath": {
                      "type": "string",
                      "pattern": "^headers\\\\.\\\\d+\\\\.value$"
                    },
                    "operation": {
                      "type": "string",
                      "const": "remove"
                    }
                  }
                }
              ]
            },
            "writeOnly": true
          }
        }
      },
      "AgentHttpToolsEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "$ref": "#/components/schemas/AgentHttpToolsData"
          }
        }
      },
      "AgentHttpToolsWriteEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "$ref": "#/components/schemas/AgentHttpToolsData"
          }
        }
      },
      "AgentHttpToolsPatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "data": {
            "$ref": "#/components/schemas/AgentHttpToolsPatchData",
            "minProperties": 1
          }
        }
      },
      "AgentSmartTagsData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "tagAccessMode": {
            "type": "string",
            "enum": [
              "all",
              "selected"
            ]
          },
          "allowedTagIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AgentSmartTagsPatchData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "tagAccessMode": {
            "type": "string",
            "enum": [
              "all",
              "selected"
            ]
          },
          "allowedTagIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AgentSmartTagsEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "$ref": "#/components/schemas/AgentSmartTagsData"
          }
        }
      },
      "AgentSmartTagsWriteEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "$ref": "#/components/schemas/AgentSmartTagsData"
          }
        }
      },
      "AgentSmartTagsPatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "data": {
            "$ref": "#/components/schemas/AgentSmartTagsPatchData",
            "minProperties": 1
          }
        }
      },
      "AgentFollowupData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "alertThreshold": {
            "type": "string",
            "enum": [
              "high",
              "medium",
              "low"
            ]
          },
          "createTask": {
            "type": "boolean"
          }
        }
      },
      "AgentFollowupPatchData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "alertThreshold": {
            "type": "string",
            "enum": [
              "high",
              "medium",
              "low"
            ]
          },
          "createTask": {
            "type": "boolean"
          }
        }
      },
      "AgentFollowupEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "$ref": "#/components/schemas/AgentFollowupData"
          }
        }
      },
      "AgentFollowupWriteEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "$ref": "#/components/schemas/AgentFollowupData"
          }
        }
      },
      "AgentFollowupPatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "data": {
            "$ref": "#/components/schemas/AgentFollowupPatchData",
            "minProperties": 1
          }
        }
      },
      "AgentSchedulerData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "allowedUserIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "canRead": {
            "type": "boolean"
          },
          "canWrite": {
            "type": "boolean"
          },
          "canDelete": {
            "type": "boolean"
          }
        }
      },
      "AgentSchedulerPatchData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "allowedUserIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "canRead": {
            "type": "boolean"
          },
          "canWrite": {
            "type": "boolean"
          },
          "canDelete": {
            "type": "boolean"
          }
        }
      },
      "AgentSchedulerEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "$ref": "#/components/schemas/AgentSchedulerData"
          }
        }
      },
      "AgentSchedulerWriteEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configurationRevision",
          "changed",
          "warnings",
          "data"
        ],
        "properties": {
          "configurationRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "$ref": "#/components/schemas/AgentSchedulerData"
          }
        }
      },
      "AgentSchedulerPatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "expectedRevision",
          "data"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "data": {
            "$ref": "#/components/schemas/AgentSchedulerPatchData",
            "minProperties": 1
          }
        }
      }
    }
  }
}
