{
  "openapi": "3.1.0",
  "info": {
    "title": "South Vancouver Soccer Team API",
    "version": "1.0.0",
    "description": "Public discovery contract for the South Vancouver Soccer Team program management service. Private parent, staff, and admin operations require an application session and are intentionally not exposed as public anonymous operations."
  },
  "servers": [{"url": "https://svsoccer.ca"}],
  "tags": [{"name":"Public","description":"Read-only public program information."}],
  "paths": {
    "/api/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Check service health",
        "description": "Returns a small JSON health response without exposing private program data.",
        "tags":["Public"],
        "responses": {"200":{"description":"Service is available.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}},"default":{"$ref":"#/components/responses/JsonError"}}
      }
    },
    "/api/tournaments/current": {
      "get": {
        "operationId": "getCurrentTournament",
        "summary": "Get the current public tournament",
        "description": "Returns the current or next public tournament board. Add optional=1 when no tournament is an expected result.",
        "tags":["Public"],
        "parameters":[{"name":"optional","in":"query","required":false,"description":"Allow an empty tournament result.","schema":{"type":"string","enum":["1"]}}],
        "responses":{"200":{"description":"Current tournament result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TournamentResponse"}}}},"default":{"$ref":"#/components/responses/JsonError"}}
      }
    },
    "/api/tournaments/{tournamentId}": {
      "get": {
        "operationId": "getTournamentBoard",
        "summary": "Read a public tournament board",
        "description": "Returns public tournament metadata, divisions, matches, and standings. Private player and guardian fields are excluded.",
        "tags":["Public"],
        "parameters":[{"name":"tournamentId","in":"path","required":true,"description":"Tournament identifier.","schema":{"type":"string","format":"uuid"}}],
        "responses":{"200":{"description":"Public tournament board.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TournamentResponse"}}}},"404":{"$ref":"#/components/responses/JsonError"},"default":{"$ref":"#/components/responses/JsonError"}}
      }
    }
  },
  "components": {
    "securitySchemes": {
      "parentSession": {"type":"apiKey","in":"cookie","name":"svst_parent_session","description":"Application-issued parent session cookie. This is not an OAuth token and does not grant staff or admin access."},
      "adminSession": {"type":"apiKey","in":"cookie","name":"svst_admin_session","description":"Application-issued admin session cookie, protected by role and organization checks."}
    },
    "schemas": {
      "HealthResponse":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean","const":true}}},
      "TournamentResponse":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean"},"tournament":{"type":["object","null"],"description":"Public tournament board when one is available."}}},
      "JsonError":{"type":"object","required":["ok","error","message"],"properties":{"ok":{"type":"boolean","const":false},"error":{"type":"string","description":"Stable machine-readable error code."},"message":{"type":"string"},"hint":{"type":"string"},"requestId":{"type":"string"}}}
    },
    "responses":{"JsonError":{"description":"Structured JSON error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonError"}}}}}
  }
}
