{
 "openapi": "3.1.0",
 "info": {
  "title": "Pocket Lake API",
  "version": "1.0.0",
  "summary": "Today's lake, as JSON, from a public seed rule.",
  "description": "Pocket Lake is a small browser fishing game whose lake changes every UTC day. The same deterministic code runs in the page and on the server: fnv1a('pocket-lake:' + date) seeds mulberry32, which draws the sky, wind, dock, weeds, the 8 to 12 species biting and a size multiplier for each. No authentication. CORS open. Cached 60 seconds. Nothing is collected."
 },
 "servers": [{ "url": "https://pocket-lake.pages.dev" }],
 "paths": {
  "/api/today": {
   "get": {
    "operationId": "getLake",
    "summary": "The lake for today or for a given UTC date",
    "parameters": [
     {
      "name": "date",
      "in": "query",
      "required": false,
      "schema": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
      "description": "A UTC calendar date, YYYY-MM-DD. Defaults to today in UTC."
     }
    ],
    "responses": {
     "200": {
      "description": "The lake",
      "headers": { "Cache-Control": { "schema": { "type": "string" }, "description": "public, max-age=60" } },
      "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Lake" } } }
     },
     "400": { "$ref": "#/components/responses/Error" }
    }
   },
   "head": { "operationId": "headLake", "summary": "The GET status and headers with no body", "responses": { "200": { "description": "Headers only" } } },
   "options": { "operationId": "optionsLake", "summary": "CORS preflight", "responses": { "204": { "description": "Allowed methods GET, HEAD, OPTIONS; any origin" } } }
  },
  "/game.json": {
   "get": {
    "operationId": "getRules",
    "summary": "The rules, the 24 species, the kit and the seed rule (static)",
    "responses": { "200": { "description": "Rules document", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Rules" } } } } }
   }
  }
 },
 "components": {
  "schemas": {
   "Biting": {
    "type": "object",
    "required": ["id", "name", "rarity", "depth", "size_mult"],
    "properties": {
     "id": { "type": "string", "description": "Species id, as in game.json" },
     "name": { "type": "string" },
     "rarity": { "type": "string", "enum": ["common", "uncommon", "rare", "legendary"] },
     "depth": { "type": "string", "enum": ["shallow", "mid", "deep"], "description": "Which cast distance reaches it" },
     "size_mult": { "type": "number", "minimum": 0.8, "maximum": 1.3, "description": "Today's multiplier on the species weight range" }
    }
   },
   "Lake": {
    "type": "object",
    "required": ["date", "seed", "sky", "sky_name", "wind", "dock", "weeds", "casts", "biting"],
    "properties": {
     "date": { "type": "string", "description": "YYYY-MM-DD, UTC" },
     "seed": { "type": "integer", "description": "fnv1a('pocket-lake:' + date), unsigned 32-bit" },
     "sky": { "type": "string", "enum": ["dawn", "clear", "overcast", "dusk", "fog", "storm"] },
     "sky_name": { "type": "string", "description": "The sky in words" },
     "wind": { "type": "number", "minimum": 0, "maximum": 1 },
     "dock": { "type": "string", "enum": ["left", "right"] },
     "weeds": { "type": "array", "items": { "type": "number" }, "minItems": 3, "maxItems": 3, "description": "Weed positions as fractions of the width" },
     "casts": { "type": "integer", "const": 12 },
     "biting": { "type": "array", "items": { "$ref": "#/components/schemas/Biting" }, "minItems": 8, "maxItems": 12, "description": "In species-table order; at least one rare or legendary" },
     "url": { "type": "string", "description": "The game URL" },
     "served_at": { "type": "string", "format": "date-time" }
    }
   },
   "Rules": {
    "type": "object",
    "description": "See /game.json, generated from the same source as the game. Fields: name, url, what, how_to_play, api, rules (casts_per_day, day, seed, score, hard, coins, kit, storage), skies, kit (tracks, costs), species[24] (id, name, rarity, weight_lb, depth, fight)."
   }
  },
  "responses": {
   "Error": {
    "description": "A plain error",
    "content": {
     "application/json": {
      "schema": {
       "type": "object",
       "required": ["error", "message"],
       "properties": { "error": { "type": "string", "enum": ["bad_date"] }, "message": { "type": "string" } }
      }
     }
    }
   }
  }
 }
}
