{
  "openapi": "3.1.0",
  "info": {
    "title": "catelani Atendimento API",
    "version": "1.0.0",
    "description": "Interface pública para uma conversa inicial sobre sites, landing pages e plataformas web. A operação é conversacional, não cria orçamento e não executa mudanças no projeto do solicitante.",
    "contact": {
      "name": "Agendar briefing com a catelani",
      "url": "https://cal.com/catelani/catelani-software"
    }
  },
  "servers": [{
    "url": "https://catelani.dev.br",
    "description": "Site oficial"
  }],
  "externalDocs": {
    "description": "Guia resumido de uso",
      "url": "https://catelani.dev.br/developers/"
  },
  "paths": {
    "/api/chat": {
      "post": {
        "operationId": "sendChatMessage",
        "summary": "Enviar uma pergunta ao atendimento",
        "description": "Envie uma pergunta objetiva sobre um projeto digital. Não inclua segredos, credenciais, documentos pessoais, dados financeiros ou informações sensíveis.",
        "tags": ["Chat"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ChatRequest" },
              "example": {
                "message": "Quero criar uma landing page para uma nova oferta.",
                "sessionId": "2f1c2d86-8f6d-4d71-9f0d-9cc59e2185e8"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Resposta conversacional do atendimento.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatResponse" } } }
          },
          "400": { "$ref": "#/components/responses/GenericError" },
          "403": { "$ref": "#/components/responses/GenericError" },
          "405": { "$ref": "#/components/responses/GenericError" },
          "502": { "$ref": "#/components/responses/GenericError" },
          "503": { "$ref": "#/components/responses/GenericError" },
          "504": { "$ref": "#/components/responses/GenericError" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ChatRequest": {
        "type": "object",
        "required": ["message", "sessionId"],
        "properties": {
          "message": { "type": "string", "description": "Pergunta objetiva sobre um site, landing page ou plataforma." },
          "sessionId": { "type": "string", "format": "uuid", "description": "Identificador da conversa, reutilizado enquanto ela continuar." },
          "source": { "$ref": "#/components/schemas/ChatSource" }
        },
        "additionalProperties": false
      },
      "ChatSource": {
        "type": "object",
        "properties": {
          "pathname": { "type": "string", "description": "Contexto opcional da página em que a conversa foi iniciada." }
        },
        "additionalProperties": false
      },
      "ChatResponse": {
        "type": "object",
        "required": ["reply", "links"],
        "properties": {
          "reply": { "type": "string", "description": "Resposta principal do atendimento." },
          "links": { "type": "array", "items": { "$ref": "#/components/schemas/ChatLink" } }
        }
      },
      "ChatLink": {
        "type": "object",
        "required": ["label", "url"],
        "properties": {
          "label": { "type": "string" },
          "url": { "type": "string", "format": "uri", "pattern": "^https:" }
        }
      },
      "GenericError": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": { "type": "string", "example": "Não foi possível concluir a solicitação." }
        }
      }
    },
    "responses": {
      "GenericError": {
        "description": "Não foi possível concluir a solicitação.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GenericError" } } }
      }
    }
  }
}
