{
  "openapi": "3.1.0",
  "info": {
    "title": "NutriShow OS Public API",
    "version": "1.0.0",
    "description": "Public, read-only and non-authenticated endpoints that help agents and integrations understand NutriShow OS without exposing private users, leads, payments, clinical data or Supabase tables."
  },
  "servers": [
    {
      "url": "https://app.nutrishow.com.br",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Public",
      "description": "Safe public resources for product discovery."
    }
  ],
  "paths": {
    "/api/public/health": {
      "get": {
        "operationId": "getNutriShowPublicHealth",
        "tags": ["Public"],
        "summary": "Check public API availability",
        "description": "Returns a simple status object for the public NutriShow OS API layer. It does not access private data.",
        "responses": {
          "200": {
            "description": "Public API is available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                },
                "examples": {
                  "ok": {
                    "value": {
                      "ok": true,
                      "service": "nutrishow-public-api",
                      "status": "available",
                      "version": "1.0.0"
                    }
                  }
                }
              }
            }
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          }
        }
      }
    },
    "/api/public/tools": {
      "get": {
        "operationId": "listNutriShowPublicTools",
        "tags": ["Public"],
        "summary": "List public NutriShow tools",
        "description": "Lists public product areas and tools available in NutriShow OS. This endpoint only returns static product metadata.",
        "responses": {
          "200": {
            "description": "A list of public tools and guides.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolsResponse"
                }
              }
            }
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          }
        }
      }
    },
    "/api/public/programs": {
      "get": {
        "operationId": "listNutriShowPublicPrograms",
        "tags": ["Public"],
        "summary": "List public NutriShow programs",
        "description": "Lists guided NutriShow OS programs using static public metadata. It does not reveal user progress or purchase status.",
        "responses": {
          "200": {
            "description": "A list of public guided programs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProgramsResponse"
                }
              }
            }
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HealthResponse": {
        "type": "object",
        "required": ["ok", "service", "status", "version"],
        "properties": {
          "ok": {
            "type": "boolean",
            "description": "Whether the public API is responding."
          },
          "service": {
            "type": "string",
            "description": "Public service identifier."
          },
          "status": {
            "type": "string",
            "description": "Current public API status."
          },
          "version": {
            "type": "string",
            "description": "Public API version."
          }
        }
      },
      "PublicTool": {
        "type": "object",
        "required": ["id", "name", "category", "url", "description"],
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable tool identifier."
          },
          "name": {
            "type": "string",
            "description": "Human-readable tool name."
          },
          "category": {
            "type": "string",
            "enum": ["calculator", "guide"],
            "description": "Public category of the tool."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Canonical app URL for the tool."
          },
          "description": {
            "type": "string",
            "description": "Plain-language description."
          }
        }
      },
      "PublicProgram": {
        "type": "object",
        "required": ["id", "name", "url", "modules", "description"],
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable program identifier."
          },
          "name": {
            "type": "string",
            "description": "Human-readable program name."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Canonical app URL for the program."
          },
          "modules": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of modules represented by the program."
          },
          "description": {
            "type": "string",
            "description": "Plain-language program description."
          }
        }
      },
      "ToolsResponse": {
        "type": "object",
        "required": ["tools"],
        "properties": {
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicTool"
            }
          }
        }
      },
      "ProgramsResponse": {
        "type": "object",
        "required": ["programs"],
        "properties": {
          "programs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicProgram"
            }
          }
        }
      },
      "ErrorObject": {
        "type": "object",
        "required": ["code", "message", "hint"],
        "properties": {
          "code": {
            "type": "string",
            "description": "Stable machine-readable error code."
          },
          "message": {
            "type": "string",
            "description": "Human-readable error message."
          },
          "hint": {
            "type": "string",
            "description": "Suggested correction for the caller."
          },
          "field": {
            "type": "string",
            "description": "Optional field related to the error."
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorObject"
          }
        }
      }
    },
    "responses": {
      "MethodNotAllowed": {
        "description": "HTTP method is not supported.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "methodNotAllowed": {
                "value": {
                  "error": {
                    "code": "METHOD_NOT_ALLOWED",
                    "message": "This public endpoint only supports GET requests.",
                    "hint": "Retry the request using GET."
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
