{
  "openapi": "3.1.0",
  "info": {
    "title": "Praia Films AI Gateway",
    "version": "1.0.0",
    "summary": "Informações públicas e verificadas da Praia Films para pessoas e agentes de IA.",
    "description": "API somente leitura com o conteúdo institucional público da Praia Films: organização, frentes de atuação, serviços, público-alvo, processo, perguntas frequentes e limites. Nenhum endpoint exige autenticação e nenhum deles permite escrita. A fonte única de dados é o painel administrativo do site. Escopo, prazos e investimento são definidos em proposta.",
    "contact": {
      "name": "Praia Films",
      "url": "https://praiafilms.com.br",
      "email": "contato@dudugoncalves.com.br"
    },
    "license": {
      "name": "Uso com atribuição da fonte",
      "url": "https://praiafilms.com.br/ai"
    }
  },
  "servers": [
    { "url": "https://praiafilms.com.br", "description": "Domínio público do site" },
    { "url": "https://praia-studio-flow.base44.app", "description": "Endereço publicado da aplicação" }
  ],
  "tags": [
    { "name": "AI Gateway", "description": "Conteúdo público somente leitura" }
  ],
  "paths": {
    "/api/public/ai-info": {
      "get": {
        "tags": ["AI Gateway"],
        "operationId": "getAiInfo",
        "summary": "Conteúdo público em JSON",
        "description": "Entrega o conteúdo institucional público completo. Rota estável do site; entrega o mesmo JSON do endpoint canônico /functions/aiGatewayPublic.",
        "responses": {
          "200": {
            "description": "Conteúdo público disponível",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AiInfo" }
              }
            }
          },
          "404": {
            "description": "Conteúdo desativado no painel administrativo",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "500": {
            "description": "Conteúdo inválido ou falha interna",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/functions/aiGatewayPublic": {
      "get": {
        "tags": ["AI Gateway"],
        "operationId": "getAiInfoCanonical",
        "summary": "Endpoint canônico em JSON",
        "description": "Resposta nativa da API, com CORS liberado para leitura. Recomendado para integrações automáticas.",
        "responses": {
          "200": {
            "description": "Conteúdo público disponível",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AiInfo" }
              }
            }
          },
          "404": {
            "description": "Conteúdo desativado",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "500": {
            "description": "Falha ao montar o conteúdo",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "tags": ["AI Gateway"],
        "operationId": "getOpenApi",
        "summary": "Este documento",
        "responses": {
          "200": {
            "description": "Contrato OpenAPI",
            "content": { "application/json": { "schema": { "type": "object" } } }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "tags": ["AI Gateway"],
        "operationId": "getLlmsTxt",
        "summary": "Índice em texto para modelos de linguagem",
        "responses": {
          "200": {
            "description": "Índice markdown",
            "content": { "text/plain": { "schema": { "type": "string" } } }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": { "type": "string", "description": "Código estável do erro" },
          "message": { "type": "string", "description": "Mensagem legível" }
        },
        "required": ["error"]
      },
      "Meta": {
        "type": "object",
        "properties": {
          "schema_version": { "type": "string", "example": "1.0" },
          "content_version": { "type": "string", "example": "1.0" },
          "published": { "type": "boolean" },
          "language": { "type": "string", "example": "pt-BR" },
          "generated_at": { "type": "string", "format": "date-time" },
          "last_reviewed_at": { "type": ["string", "null"], "format": "date-time" },
          "read_only": { "type": "boolean", "const": true },
          "source": { "type": "string" },
          "usage": { "type": "string" },
          "endpoints": {
            "type": "object",
            "properties": {
              "html": { "type": "string" },
              "json": { "type": "string" },
              "json_function": { "type": "string" },
              "openapi": { "type": "string" },
              "llms": { "type": "string" }
            }
          }
        }
      },
      "Organizacao": {
        "type": "object",
        "properties": {
          "nome": { "type": "string" },
          "descricao_curta": { "type": "string" },
          "descricao_longa": { "type": "string" },
          "cnpj": { "type": "string" },
          "endereco": { "type": "string" },
          "cidade": { "type": "string" },
          "estado": { "type": "string" },
          "pais": { "type": "string" },
          "telefone": { "type": "string" },
          "whatsapp": { "type": "string" },
          "email": { "type": "string" },
          "site": { "type": "string" },
          "instagram": { "type": "string" },
          "responsavel": { "type": "string" },
          "responsavel_cargo": { "type": "string" },
          "experiencia": { "type": "string" },
          "area_atendimento": { "type": "string" },
          "idiomas": { "type": "array", "items": { "type": "string" } }
        }
      },
      "Atuacao": {
        "type": "object",
        "properties": {
          "titulo": { "type": "string" },
          "descricao": { "type": "string" },
          "itens": { "type": "array", "items": { "type": "string" } }
        }
      },
      "Servico": {
        "type": "object",
        "properties": {
          "slug": { "type": "string" },
          "nome": { "type": "string" },
          "resumo": { "type": "string" },
          "entregas": { "type": "array", "items": { "type": "string" } },
          "indicado_para": { "type": "array", "items": { "type": "string" } }
        },
        "required": ["slug", "nome", "resumo"]
      },
      "AiInfo": {
        "type": "object",
        "properties": {
          "meta": { "$ref": "#/components/schemas/Meta" },
          "publicado": { "type": "boolean" },
          "versao": { "type": "string" },
          "idioma": { "type": "string" },
          "organizacao": { "$ref": "#/components/schemas/Organizacao" },
          "atuacao": { "type": "array", "items": { "$ref": "#/components/schemas/Atuacao" } },
          "servicos": { "type": "array", "items": { "$ref": "#/components/schemas/Servico" } },
          "publico_alvo": { "type": "array", "items": { "type": "string" } },
          "diferenciais": { "type": "array", "items": { "type": "string" } },
          "processo": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": { "titulo": { "type": "string" }, "descricao": { "type": "string" } }
            }
          },
          "perguntas": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": { "pergunta": { "type": "string" }, "resposta": { "type": "string" } }
            }
          },
          "limites": {
            "type": "object",
            "properties": {
              "nao_oferece": { "type": "array", "items": { "type": "string" } },
              "observacoes": { "type": "array", "items": { "type": "string" } }
            }
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "rotulo": { "type": "string" },
                "url": { "type": "string" },
                "descricao": { "type": "string" }
              }
            }
          },
          "contato_comercial": {
            "type": "object",
            "properties": {
              "whatsapp_url": { "type": "string" },
              "email": { "type": "string" },
              "formulario_url": { "type": "string" },
              "telefone": { "type": "string" }
            }
          },
          "revisado_em": { "type": ["string", "null"], "format": "date-time" }
        },
        "required": ["meta", "organizacao", "servicos"]
      }
    }
  }
}
