{
  "openapi": "3.1.0",
  "info": {
    "title": "TAKE STAKE Acquisition API",
    "version": "1.0.0",
    "description": "Public, read-only JSON API behind the TAKE STAKE acquisition dashboard. All figures are computed from named public data sources (DexScreener, GeckoTerminal, Yahoo Finance, SEC EDGAR, Solana RPC) and carry real fetch timestamps. TAKE STAKE is a parody community/meme project; nothing in this API represents a real acquisition, tender offer, or ownership of Sol Strategies."
  },
  "servers": [{ "url": "https://buysolstrategies.com", "description": "production (canonical host from SITE_URL)" }],
  "paths": {
    "/api/acquisition": {
      "get": {
        "operationId": "getAcquisition",
        "summary": "Live acquisition snapshot: both market caps, progress, state.",
        "responses": {
          "200": {
            "description": "Snapshot",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AcquisitionSnapshot" }
              }
            }
          },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "500": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/api/history": {
      "get": {
        "operationId": "getHistory",
        "summary": "Both market caps over time, merged onto one timeline.",
        "parameters": [
          {
            "name": "range",
            "in": "query",
            "schema": { "type": "string", "enum": ["24h", "7d", "30d", "all"], "default": "7d" }
          }
        ],
        "responses": {
          "200": {
            "description": "Series",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/HistorySeries" } }
            }
          },
          "400": { "$ref": "#/components/responses/Error" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "500": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/api/holders": {
      "get": {
        "operationId": "getHolders",
        "summary": "THE ACQUIRERS — largest on-chain $TAKE holders with honorary deal-team titles.",
        "responses": {
          "200": {
            "description": "Leaderboard (empty with live=false before launch)",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/Leaderboard" } }
            }
          },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "500": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/api/event": {
      "post": {
        "operationId": "recordEvent",
        "summary": "North-star event beacon (used by the site UI; cookieless, no storage — server log lines only).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["event"],
                "properties": {
                  "event": { "type": "string", "enum": ["share_intent", "buy_click", "client_error"] }
                }
              }
            }
          }
        },
        "responses": {
          "204": { "description": "Recorded" },
          "400": { "$ref": "#/components/responses/Error" },
          "413": { "$ref": "#/components/responses/Error" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/api/healthz": {
      "get": {
        "operationId": "getHealth",
        "summary": "Readiness: per-data-source health.",
        "responses": {
          "200": {
            "description": "ok or degraded",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Health" } } }
          },
          "503": {
            "description": "down",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Health" } } }
          }
        }
      }
    },
    "/api/og/snapshot": {
      "get": {
        "operationId": "getSnapshotImage",
        "summary": "SHARE ACQUISITION — the generated 1200×630 snapshot card (PNG).",
        "responses": {
          "200": { "description": "PNG image", "content": { "image/png": {} } },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    }
  },
  "components": {
    "responses": {
      "Error": {
        "description": "Error envelope",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "RateLimited": {
        "description": "Rate limit exceeded",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "object",
            "required": ["message", "type"],
            "properties": {
              "message": { "type": "string" },
              "type": {
                "type": "string",
                "enum": ["bad_request", "not_found", "rate_limited", "upstream_unavailable", "internal"]
              }
            }
          }
        }
      },
      "SideSnapshot": {
        "type": "object",
        "required": ["marketCapUsd", "priceUsd", "updatedAt", "stale", "source"],
        "properties": {
          "marketCapUsd": { "type": "number" },
          "priceUsd": { "type": "number" },
          "updatedAt": { "type": "integer", "description": "epoch ms of the real upstream fetch" },
          "stale": { "type": "boolean" },
          "source": { "type": "string" }
        }
      },
      "AcquisitionSnapshot": {
        "type": "object",
        "required": ["live", "take", "stke", "progressPct", "remainingUsd", "state", "generatedAt", "unavailable"],
        "properties": {
          "live": { "type": "boolean", "description": "false until the $TAKE mint is configured (pre-launch)" },
          "take": {
            "oneOf": [
              { "type": "null" },
              {
                "allOf": [
                  { "$ref": "#/components/schemas/SideSnapshot" },
                  {
                    "type": "object",
                    "properties": {
                      "liquidityUsd": { "type": ["number", "null"] },
                      "change24hPct": { "type": ["number", "null"] },
                      "volume24hUsd": { "type": ["number", "null"] },
                      "dexUrl": { "type": "string" }
                    }
                  }
                ]
              }
            ]
          },
          "stke": {
            "oneOf": [
              { "type": "null" },
              {
                "allOf": [
                  { "$ref": "#/components/schemas/SideSnapshot" },
                  {
                    "type": "object",
                    "properties": {
                      "sharesOutstanding": { "type": "number" },
                      "sharesSource": { "type": "string" },
                      "change24hPct": { "type": ["number", "null"] },
                      "dayHighUsd": { "type": ["number", "null"] },
                      "dayLowUsd": { "type": ["number", "null"] },
                      "volume": { "type": ["number", "null"] }
                    }
                  }
                ]
              }
            ]
          },
          "progressPct": { "type": ["number", "null"], "description": "TAKE mc / STKE mc × 100, uncapped" },
          "remainingUsd": { "type": ["number", "null"] },
          "state": {
            "type": ["string", "null"],
            "enum": ["WATCHLIST", "INITIAL OFFER", "DUE DILIGENCE", "NEGOTIATION", "INCREASED OFFER", "HOSTILE", "CONTROL", "ACQUISITION COMPLETE", null]
          },
          "generatedAt": { "type": "integer" },
          "unavailable": {
            "type": "object",
            "properties": { "take": { "type": "string" }, "stke": { "type": "string" } }
          }
        }
      },
      "HistoryPoint": {
        "type": "object",
        "required": ["t", "takeMc", "stkeMc", "pct"],
        "properties": {
          "t": { "type": "integer" },
          "takeMc": { "type": ["number", "null"] },
          "stkeMc": { "type": ["number", "null"] },
          "pct": { "type": ["number", "null"] }
        }
      },
      "HistorySeries": {
        "type": "object",
        "required": ["range", "points", "sources", "updatedAt"],
        "properties": {
          "range": { "type": "string", "enum": ["24h", "7d", "30d", "all"] },
          "points": { "type": "array", "items": { "$ref": "#/components/schemas/HistoryPoint" } },
          "sources": { "type": "array", "items": { "type": "string" } },
          "updatedAt": { "type": "integer" }
        }
      },
      "LeaderboardEntry": {
        "type": "object",
        "required": ["rank", "address", "amount", "pctOfSupply", "title"],
        "properties": {
          "rank": { "type": "integer" },
          "address": { "type": "string" },
          "amount": { "type": "number" },
          "pctOfSupply": { "type": "number" },
          "title": { "type": "string", "description": "parody deal-team title (CHAIRMAN … INTERN)" }
        }
      },
      "Leaderboard": {
        "type": "object",
        "required": ["entries", "live"],
        "properties": {
          "entries": { "type": "array", "items": { "$ref": "#/components/schemas/LeaderboardEntry" } },
          "live": { "type": "boolean" },
          "updatedAt": { "type": "integer" },
          "stale": { "type": "boolean" },
          "source": { "type": "string" },
          "note": { "type": "string" }
        }
      },
      "Health": {
        "type": "object",
        "required": ["status", "checks", "ts"],
        "properties": {
          "status": { "type": "string", "enum": ["ok", "degraded", "down"] },
          "checks": {
            "type": "object",
            "properties": {
              "take": { "type": "string", "enum": ["ok", "stale", "unavailable", "pre-launch"] },
              "stke": { "type": "string", "enum": ["ok", "stale", "unavailable", "pre-launch"] }
            }
          },
          "ts": { "type": "string", "format": "date-time" }
        }
      }
    }
  }
}
