{
  "openapi": "3.1.0",
  "info": {
    "title": "Coronet public API",
    "version": "0.1.0",
    "description": "Machine-readable endpoints for Coronet (https://coronet.one). Play happens in the browser SPA. Payment routes are for the first-party Unlock All flow."
  },
  "servers": [{ "url": "https://coronet.one" }],
  "paths": {
    "/api/site": {
      "get": {
        "summary": "Product facts",
        "operationId": "getSiteFacts",
        "responses": {
          "200": {
            "description": "Structured facts about Coronet",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SiteFacts" }
              }
            }
          }
        }
      }
    },
    "/api/mcp": {
      "get": {
        "summary": "MCP server info",
        "operationId": "mcpInfo",
        "responses": {
          "200": { "description": "Transport and tool names" }
        }
      },
      "post": {
        "summary": "MCP JSON-RPC (tools/list, tools/call)",
        "operationId": "mcpRpc",
        "responses": {
          "200": { "description": "JSON-RPC response" }
        }
      }
    },
    "/api/create-checkout": {
      "post": {
        "summary": "Create Stripe Checkout session for Unlock All",
        "operationId": "createCheckout",
        "responses": {
          "200": {
            "description": "Checkout URL",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "url": { "type": "string", "format": "uri" } }
                }
              }
            }
          },
          "503": { "description": "Stripe not configured" }
        }
      }
    },
    "/api/confirm-checkout": {
      "get": {
        "summary": "Confirm a paid Checkout session",
        "operationId": "confirmCheckout",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "Whether the session is paid",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "ok": { "type": "boolean" } }
                }
              }
            }
          }
        }
      }
    },
    "/api/restore-purchase": {
      "post": {
        "summary": "Restore Unlock All from receipt email",
        "operationId": "restorePurchase",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["email", "deviceId"],
                "properties": {
                  "email": { "type": "string", "format": "email" },
                  "deviceId": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Restore result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": { "type": "boolean" },
                    "error": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "SiteFacts": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "description": { "type": "string" },
          "rules": { "type": "array", "items": { "type": "string" } },
          "pricing": { "type": "object" },
          "agent": { "type": "object" }
        }
      }
    }
  }
}
