{
  "openapi": "3.1.0",
  "info": {
    "title": "CardBrawler Web API",
    "version": "1.0.0",
    "description": "Public content, catalog, account, commerce, and online match endpoints for the CardBrawler website. Administrative endpoints are intentionally excluded."
  },
  "servers": [
    {
      "url": "https://whambamstudios.com"
    }
  ],
  "paths": {
    "/api/patches/catalog": {
      "get": {
        "operationId": "getPatchCatalog",
        "summary": "List published patch packages",
        "responses": {
          "200": {
            "description": "Published patch catalog",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/JsonObject" }
              }
            }
          }
        }
      }
    },
    "/api/patches/{packageId}": {
      "get": {
        "operationId": "getPatchPackage",
        "summary": "Get a published patch package",
        "parameters": [
          {
            "name": "packageId",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "responses": {
          "200": { "description": "Patch package metadata" },
          "404": { "description": "Package not found" }
        }
      }
    },
    "/api/card-catalogs": {
      "get": {
        "operationId": "listCardCatalogs",
        "summary": "List public card catalogs",
        "responses": {
          "200": {
            "description": "Available card catalogs",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/JsonObject" }
              }
            }
          }
        }
      }
    },
    "/api/card-catalogs/{catalogId}": {
      "get": {
        "operationId": "getCardCatalog",
        "summary": "Get a public card catalog",
        "parameters": [
          {
            "name": "catalogId",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "responses": {
          "200": { "description": "Card catalog" },
          "404": { "description": "Catalog not found" }
        }
      }
    },
    "/api/compendium": {
      "get": {
        "operationId": "listCompendiumEntries",
        "summary": "List public compendium entries",
        "parameters": [
          { "name": "kind", "in": "query", "schema": { "type": "string" } },
          { "name": "featured", "in": "query", "schema": { "type": "boolean" } }
        ],
        "responses": {
          "200": {
            "description": "Compendium entries",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/JsonObject" }
              }
            }
          }
        }
      }
    },
    "/api/compendium/{slug}": {
      "get": {
        "operationId": "getCompendiumEntry",
        "summary": "Get a public compendium entry",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": { "description": "Compendium entry" },
          "404": { "description": "Entry not found" }
        }
      }
    },
    "/api/news": {
      "get": {
        "operationId": "listNews",
        "summary": "List published news",
        "responses": {
          "200": {
            "description": "Published news items",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/JsonObject" }
              }
            }
          }
        }
      }
    },
    "/api/commerce/catalog": {
      "get": {
        "operationId": "getCommerceCatalog",
        "summary": "Get the public commerce catalog",
        "responses": {
          "200": {
            "description": "Available products",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/JsonObject" }
              }
            }
          }
        }
      }
    },
    "/api/matches": {
      "post": {
        "operationId": "createMatch",
        "summary": "Create an online match",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/JsonObject" }
            }
          }
        },
        "responses": {
          "200": { "description": "Match created" },
          "400": { "description": "Request is invalid" },
          "401": { "description": "Credentials are invalid" },
          "503": { "description": "Match capacity is unavailable" }
        }
      }
    },
    "/api/matches/{matchId}/{operation}": {
      "post": {
        "operationId": "operateOnMatch",
        "summary": "Join, reconnect, submit a command, or synchronize a match",
        "parameters": [
          {
            "name": "matchId",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          },
          {
            "name": "operation",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": ["join", "reconnect", "commands", "sync"]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/JsonObject" }
            }
          }
        },
        "responses": {
          "200": { "description": "Match operation completed" },
          "400": { "description": "Request is invalid" },
          "401": { "description": "Credentials are invalid" },
          "404": { "description": "Match not found" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "JsonObject": {
        "type": "object",
        "additionalProperties": true
      }
    }
  }
}
