{
  "openapi": "3.1.0",
  "info": {
    "title": "Huddle Public API",
    "version": "1.0.0",
    "description": "Public, unauthenticated endpoints for discovering Huddle activities and external events. For private endpoints (create activity, profile, chat) use the authenticated Supabase client with OAuth metadata at /.well-known/oauth-protected-resource.",
    "contact": {
      "name": "Huddle",
      "email": "info@huddlemeet.com",
      "url": "https://huddlemeet.com"
    },
    "license": {
      "name": "Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://kszqfeiudteaoudetlrl.supabase.co/functions/v1",
      "description": "Lovable Cloud Edge Functions"
    }
  ],
  "paths": {
    "/get-public-events": {
      "get": {
        "summary": "Search public events and Huddle activities near a location",
        "operationId": "getPublicEvents",
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "schema": { "type": "number", "format": "double" },
            "description": "Latitude in WGS84"
          },
          {
            "name": "lng",
            "in": "query",
            "required": true,
            "schema": { "type": "number", "format": "double" },
            "description": "Longitude in WGS84"
          },
          {
            "name": "radius_km",
            "in": "query",
            "required": false,
            "schema": { "type": "number", "default": 25 },
            "description": "Search radius in kilometers"
          }
        ],
        "responses": {
          "200": {
            "description": "List of activities and external events",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "activities": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Activity" }
                    },
                    "external_events": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/ExternalEvent" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/llms-full-txt": {
      "get": {
        "summary": "Full plaintext corpus for LLM grounding",
        "operationId": "getLlmsFullTxt",
        "responses": {
          "200": {
            "description": "Plaintext content",
            "content": {
              "text/plain": { "schema": { "type": "string" } }
            }
          }
        }
      }
    },
    "/content-negotiate": {
      "get": {
        "summary": "Content negotiation endpoint — returns markdown when Accept: text/markdown is requested",
        "operationId": "contentNegotiate",
        "parameters": [
          {
            "name": "Accept",
            "in": "header",
            "required": false,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "Markdown summary",
            "content": {
              "text/markdown": { "schema": { "type": "string" } }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Activity": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "title": { "type": "string" },
          "description": { "type": "string" },
          "category": { "type": "string" },
          "start_time": { "type": "string", "format": "date-time" },
          "max_participants": { "type": "integer" },
          "location_name": { "type": "string" },
          "location_geojson": { "type": "object" }
        }
      },
      "ExternalEvent": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "title": { "type": "string" },
          "category": { "type": "string" },
          "start_time": { "type": "string", "format": "date-time" },
          "venue_name": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "is_free": { "type": "boolean" },
          "price_min": { "type": "number" },
          "price_max": { "type": "number" },
          "price_currency": { "type": "string" }
        }
      }
    },
    "securitySchemes": {
      "OAuth2": {
        "type": "oauth2",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://kszqfeiudteaoudetlrl.supabase.co/auth/v1/authorize",
            "tokenUrl": "https://kszqfeiudteaoudetlrl.supabase.co/auth/v1/token",
            "scopes": {
              "read:activities": "Read activities",
              "write:activities": "Create or modify own activities",
              "read:profile": "Read own profile"
            }
          }
        }
      }
    }
  }
}
