{
    "openapi": "3.1.0",
    "info": {
        "title": "API pública do Sostenere",
        "version": "1.0.0",
        "summary": "Dados oficiais do Sostenere em JSON, somente leitura.",
        "description": "Dados oficiais do Sostenere, app gratuito de cuidado para pessoas idosas e suas famílias. Pública, somente leitura, sem chave, sem cadastro e sem plano pago. Não expõe contas, medicamentos nem localização. Escopo único: site:read, concedido a qualquer cliente.",
        "contact": {
            "name": "Suporte Sostenere",
            "email": "suporte@sostenere.com.br",
            "url": "https://sostenere.com.br/contato"
        }
    },
    "servers": [
        {
            "url": "https://sostenere.com.br/api/v1",
            "description": "Produção (única; não há sandbox porque nada é alterado)"
        }
    ],
    "tags": [
        {
            "name": "Sostenere",
            "description": "Informações públicas do produto."
        }
    ],
    "security": [],
    "paths": {
        "/": {
            "get": {
                "operationId": "getApiIndex",
                "summary": "Índice da API",
                "description": "Lista os endpoints disponíveis e os links de documentação.",
                "tags": [
                    "Sostenere"
                ],
                "responses": {
                    "200": {
                        "description": "Índice da API",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiIndex"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Método não permitido: só GET, HEAD e OPTIONS.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/site": {
            "get": {
                "operationId": "getSiteInfo",
                "summary": "Resumo do produto",
                "description": "Nome, descrição, preço, disponibilidade e avisos do Sostenere.",
                "tags": [
                    "Sostenere"
                ],
                "responses": {
                    "200": {
                        "description": "Resumo do produto",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Site"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Método não permitido: só GET, HEAD e OPTIONS.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/features": {
            "get": {
                "operationId": "listFeatures",
                "summary": "Recursos do app",
                "description": "Os cinco recursos do app e os três passos para começar.",
                "tags": [
                    "Sostenere"
                ],
                "responses": {
                    "200": {
                        "description": "Recursos do app",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Features"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Método não permitido: só GET, HEAD e OPTIONS.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/faq": {
            "get": {
                "operationId": "listFaq",
                "summary": "Perguntas frequentes",
                "description": "Perguntas frequentes com as respostas oficiais.",
                "tags": [
                    "Sostenere"
                ],
                "responses": {
                    "200": {
                        "description": "Perguntas frequentes",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Faq"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Método não permitido: só GET, HEAD e OPTIONS.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/pages": {
            "get": {
                "operationId": "listPages",
                "summary": "Páginas públicas",
                "description": "Páginas públicas do site, com título, descrição e URL.",
                "tags": [
                    "Sostenere"
                ],
                "responses": {
                    "200": {
                        "description": "Páginas públicas",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Pages"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Método não permitido: só GET, HEAD e OPTIONS.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/contact": {
            "get": {
                "operationId": "getContact",
                "summary": "Canal de atendimento",
                "description": "E-mail de suporte, idioma e localidade da empresa.",
                "tags": [
                    "Sostenere"
                ],
                "responses": {
                    "200": {
                        "description": "Canal de atendimento",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Contact"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Método não permitido: só GET, HEAD e OPTIONS.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/search": {
            "get": {
                "operationId": "searchContent",
                "summary": "Buscar no conteúdo do Sostenere",
                "description": "Procura por palavras-chave nos recursos, nas perguntas frequentes e nas páginas públicas e devolve os resultados em ordem de relevância.",
                "tags": [
                    "Sostenere"
                ],
                "responses": {
                    "200": {
                        "description": "Buscar no conteúdo do Sostenere",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SearchResults"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Método não permitido: só GET, HEAD e OPTIONS.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Parâmetro ausente ou inválido.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": true,
                        "description": "Palavras-chave (até 200 caracteres).",
                        "schema": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                        },
                        "example": "medicamentos"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Quantidade máxima de resultados.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 20,
                            "default": 5
                        }
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "error": {
                        "type": "object",
                        "properties": {
                            "status": {
                                "type": "integer",
                                "description": "Código HTTP."
                            },
                            "code": {
                                "type": "string",
                                "description": "Código estável: not_found, method_not_allowed, missing_parameter, invalid_parameter."
                            },
                            "message": {
                                "type": "string",
                                "description": "O que aconteceu."
                            },
                            "hint": {
                                "type": "string",
                                "description": "Como corrigir."
                            },
                            "documentation_url": {
                                "type": "string",
                                "format": "uri"
                            }
                        },
                        "required": [
                            "status",
                            "code",
                            "message",
                            "hint",
                            "documentation_url"
                        ]
                    }
                },
                "required": [
                    "error"
                ]
            },
            "ApiIndex": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "version": {
                        "type": "string"
                    },
                    "access": {
                        "type": "string"
                    },
                    "documentation_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "openapi_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "endpoints": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "required": [
                    "name",
                    "version",
                    "access",
                    "documentation_url",
                    "openapi_url",
                    "endpoints"
                ]
            },
            "Site": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "legal_name": {
                        "type": "string"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "language": {
                        "type": "string"
                    },
                    "tagline": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    },
                    "pricing": {
                        "type": "string"
                    },
                    "availability": {
                        "type": "string"
                    },
                    "signup_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "business_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "privacy_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "emergency_notice": {
                        "type": "string"
                    },
                    "instagram": {
                        "type": "string",
                        "format": "uri"
                    }
                },
                "required": [
                    "name",
                    "legal_name",
                    "url",
                    "language",
                    "tagline",
                    "description",
                    "pricing",
                    "availability",
                    "signup_url",
                    "business_url",
                    "privacy_url",
                    "emergency_notice",
                    "instagram"
                ]
            },
            "Feature": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "title": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    }
                },
                "required": [
                    "id",
                    "title",
                    "description"
                ]
            },
            "Step": {
                "type": "object",
                "properties": {
                    "title": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    }
                },
                "required": [
                    "title",
                    "description"
                ]
            },
            "Features": {
                "type": "object",
                "properties": {
                    "features": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Feature"
                        }
                    },
                    "steps": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Step"
                        }
                    }
                },
                "required": [
                    "features",
                    "steps"
                ]
            },
            "Faq": {
                "type": "object",
                "properties": {
                    "faq": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "question": {
                                    "type": "string"
                                },
                                "answer": {
                                    "type": "string"
                                }
                            },
                            "required": [
                                "question",
                                "answer"
                            ]
                        }
                    }
                },
                "required": [
                    "faq"
                ]
            },
            "Pages": {
                "type": "object",
                "properties": {
                    "pages": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "format": "uri"
                                },
                                "title": {
                                    "type": "string"
                                },
                                "description": {
                                    "type": "string"
                                }
                            },
                            "required": [
                                "url",
                                "title",
                                "description"
                            ]
                        }
                    }
                },
                "required": [
                    "pages"
                ]
            },
            "Contact": {
                "type": "object",
                "properties": {
                    "email": {
                        "type": "string",
                        "format": "email"
                    },
                    "contact_type": {
                        "type": "string"
                    },
                    "languages": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "country": {
                        "type": "string"
                    },
                    "locality": {
                        "type": "string"
                    },
                    "page_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "note": {
                        "type": "string"
                    }
                },
                "required": [
                    "email",
                    "contact_type",
                    "languages",
                    "country",
                    "locality",
                    "page_url",
                    "note"
                ]
            },
            "SearchResults": {
                "type": "object",
                "properties": {
                    "query": {
                        "type": "string"
                    },
                    "results": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "score": {
                                    "type": "integer"
                                },
                                "type": {
                                    "type": "string",
                                    "enum": [
                                        "feature",
                                        "faq",
                                        "page"
                                    ]
                                },
                                "title": {
                                    "type": "string"
                                },
                                "text": {
                                    "type": "string"
                                },
                                "url": {
                                    "type": "string",
                                    "format": "uri"
                                }
                            },
                            "required": [
                                "score",
                                "type",
                                "title",
                                "text",
                                "url"
                            ]
                        }
                    }
                },
                "required": [
                    "query",
                    "results"
                ]
            }
        }
    }
}
