{
  "openapi": "3.1.0",
  "info": {
    "title": "FestOnDemand Public API",
    "description": "Read-only public API for FestOnDemand, India's crowd-backed event hosting platform. Allows retrieving public events and public user profiles.",
    "version": "1.0.0",
    "contact": {
      "name": "FestOnDemand Support",
      "email": "support@festondemand.com",
      "url": "https://festondemand.com"
    }
  },
  "servers": [
    {
      "url": "https://iyxrwpishtqlobatigsq.supabase.co/rest/v1",
      "description": "Production Supabase REST API"
    }
  ],
  "tags": [
    {
      "name": "Events",
      "description": "Public events available on the platform"
    },
    {
      "name": "Profiles",
      "description": "Public user profiles"
    }
  ],
  "paths": {
    "/public_events": {
      "get": {
        "tags": ["Events"],
        "summary": "List public events",
        "description": "Returns a list of public events that are published, confirmed, or live.",
        "operationId": "listPublicEvents",
        "parameters": [
          {
            "name": "select",
            "in": "query",
            "description": "Fields to select",
            "schema": {
              "type": "string",
              "default": "*"
            }
          },
          {
            "name": "category",
            "in": "query",
            "description": "Filter by event category (e.g., eq.Music)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "city",
            "in": "query",
            "description": "Filter by city (e.g., ilike.*Mumbai*)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "description": "Order results (e.g., created_at.desc)",
            "schema": {
              "type": "string",
              "default": "created_at.desc"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of events",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Event"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response from PostgREST",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostgRESTError"
                }
              }
            }
          }
        }
      }
    },
    "/profiles": {
      "get": {
        "tags": ["Profiles"],
        "summary": "List public profiles",
        "description": "Returns public user profiles.",
        "operationId": "listProfiles",
        "parameters": [
          {
            "name": "select",
            "in": "query",
            "description": "Fields to select",
            "schema": {
              "type": "string",
              "default": "id,username,full_name,bio,avatar_url,profile_type"
            }
          },
          {
            "name": "username",
            "in": "query",
            "description": "Filter by username (e.g., eq.johndoe)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of public profiles",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Profile"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response from PostgREST",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostgRESTError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "apikey",
        "description": "Supabase public anon key"
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Supabase public anon key as bearer token"
      }
    },
    "schemas": {
      "Event": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "title": { "type": "string" },
          "description": { "type": "string" },
          "category": { "type": "string" },
          "city": { "type": "string" },
          "state": { "type": "string" },
          "country": { "type": "string" },
          "venue": { "type": "string" },
          "date": { "type": "string", "format": "date" },
          "time": { "type": "string", "format": "time" },
          "poster_url": { "type": "string", "format": "uri" },
          "status": { "type": "string", "enum": ["published", "validating", "confirmed", "deploying", "live", "completed"] },
          "max_attendees": { "type": "integer" },
          "threshold": { "type": "integer" },
          "created_at": { "type": "string", "format": "date-time" },
          "organizer_id": { "type": "string", "format": "uuid" }
        }
      },
      "Profile": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "username": { "type": "string" },
          "full_name": { "type": "string" },
          "bio": { "type": "string" },
          "avatar_url": { "type": "string", "format": "uri" },
          "profile_type": { "type": "string", "enum": ["attendee", "organizer", "buzzmate"] }
        }
      },
      "PostgRESTError": {
        "type": "object",
        "properties": {
          "code": { "type": "string" },
          "message": { "type": "string" },
          "details": { "type": "string", "nullable": true },
          "hint": { "type": "string", "nullable": true }
        }
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": [],
      "BearerAuth": []
    }
  ]
}
