{
  "openapi": "3.1.0",
  "info": {
    "title": "Vision Cast Public API",
    "version": "1.0.0",
    "description": "API pública e somente leitura do Vision Cast: catálogo de módulos, tabela de preços e health check. Erros seguem application/problem+json com código, mensagem e dica de resolução.",
    "contact": {
      "name": "Vision Cast",
      "email": "contato@vision-cast.io",
      "url": "https://www.vision-cast.io"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://www.vision-cast.io/termos"
    }
  },
  "servers": [
    {
      "url": "https://www.vision-cast.io",
      "description": "Produção"
    }
  ],
  "paths": {
    "/api/public/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Health check",
        "responses": {
          "200": {
            "description": "Serviço disponível",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/products": {
      "get": {
        "operationId": "listProducts",
        "summary": "Lista os módulos do ecossistema Vision Cast",
        "responses": {
          "200": {
            "description": "Catálogo de módulos",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Product"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/public/pricing": {
      "get": {
        "operationId": "getPricing",
        "summary": "Tabela de preços mensal (BRL)",
        "parameters": [
          {
            "name": "modules",
            "in": "query",
            "required": false,
            "description": "Quantidade de módulos (1 a 7). Retorna também o preço para essa quantidade.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 7
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tabela de preços",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pricing"
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro inválido",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Health": {
        "type": "object",
        "required": [
          "status",
          "service"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok"
            ]
          },
          "service": {
            "type": "string"
          },
          "time": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Product": {
        "type": "object",
        "required": [
          "key",
          "kind",
          "name",
          "description"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "module",
              "hardware"
            ]
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "audience": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        }
      },
      "Pricing": {
        "type": "object",
        "required": [
          "currency",
          "interval",
          "tiers"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "examples": [
              "BRL"
            ]
          },
          "interval": {
            "type": "string",
            "examples": [
              "month"
            ]
          },
          "tiers": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "modules",
                "priceCents"
              ],
              "properties": {
                "modules": {
                  "type": "integer"
                },
                "priceCents": {
                  "type": "integer"
                },
                "price": {
                  "type": "number"
                }
              }
            }
          },
          "selected": {
            "type": "object",
            "properties": {
              "modules": {
                "type": "integer"
              },
              "priceCents": {
                "type": "integer"
              },
              "price": {
                "type": "number"
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "hint",
              "status"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "hint": {
                "type": "string"
              },
              "status": {
                "type": "integer"
              },
              "docs": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}