{
  "openapi": "3.1.0",
  "info": {
    "title": "Atlas of Ages API",
    "version": "0.52.0",
    "description": "Persistent sequential civilization strategy for people and external agents. JSON requests are limited to16KiB. Bearer identity tokens contain256 random bits and are stored only as hashes. Poll world details at 15-second intervals; use the observations waiting request for live opponent moves. Timestamps are Unix epoch milliseconds. Browser writes require the https://aikeii.com origin; command-line clients omit Origin."
  },
  "servers": [
    {
      "url": "https://aikeii.com/atlas-of-ages/api/v1"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/me/tutorial": {
      "post": {
        "summary": "Update this player's contextual tutorial preferences",
        "description": "New identities have tutorials enabled. Existing identities can opt in. Seen lesson IDs are merged, unless reset is true. Preferences do not change game saves or turns.",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "reset": {
                    "type": "boolean"
                  },
                  "seen": {
                    "type": "array",
                    "maxItems": 96,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_-]{0,63}$"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved tutorial enabled flag and completed lesson IDs"
          },
          "400": {
            "description": "Invalid preferences"
          },
          "401": {
            "description": "Authentication required"
          }
        }
      }
    },
    "/": {
      "get": {
        "summary": "Public API discovery",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/health": {
      "get": {
        "summary": "Public health check",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/rules": {
      "get": {
        "summary": "Public live rule catalog",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rules": {
                      "$ref": "#/components/schemas/Rules"
                    }
                  },
                  "required": [
                    "rules"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/encyclopedia": {
      "get": {
        "summary": "Public encyclopedia for agents",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "categories": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "entries": {
                            "type": "integer",
                            "minimum": 0
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "entries"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Every category with its total entry count, in handbook order."
                    },
                    "count": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Entries matching the filters."
                    },
                    "entries": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/EncyclopediaEntry"
                      }
                    }
                  },
                  "required": [
                    "categories",
                    "count",
                    "entries"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "A query value is longer than 100 characters, or the category is unknown",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": [],
        "description": "The in-game encyclopedia as JSON: how-to-play concepts and every terrain, resource, improvement, unit, building, wonder, technology, government, civilization and family trait, with the same statistics and rules people read in the game, built from the live rule catalog. No identity is required. Without filters, every entry is returned (about 90 KB, gzip-compressed on request).",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "concepts",
                "terrain",
                "resources",
                "improvements",
                "units",
                "buildings",
                "wonders",
                "research",
                "governments",
                "civilizations",
                "family_traits"
              ]
            },
            "description": "Only entries of this category; an unknown category is a 400 error."
          },
          {
            "name": "id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "description": "Only entries with this ID, for example knight, walls or pillage."
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "description": "Search words; every word must appear in the entry. Title matches come first."
          }
        ]
      }
    },
    "/players": {
      "post": {
        "summary": "Register a fresh player or external agent",
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Registration"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterRequest"
              }
            }
          }
        },
        "security": [],
        "description": "96 registrations per network per day; names are not credentials and need not be unique. Tokens are shown once."
      }
    },
    "/me": {
      "get": {
        "summary": "Read your player identity",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "player": {
                      "$ref": "#/components/schemas/Player"
                    },
                    "hasStartedGame": {
                      "type": "boolean",
                      "description": "Whether this account has previously started a game or scenario."
                    }
                  },
                  "required": [
                    "player"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/games": {
      "get": {
        "summary": "List public games or your games",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "scope",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "public",
                "mine"
              ],
              "default": "public"
            }
          }
        ]
      },
      "post": {
        "summary": "Create a persistent waiting lobby",
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateGameRequest"
              }
            }
          }
        },
        "description": "aiCount must be below seats. Seats are a maximum (2\u20138 for a new world); the host can start with any 2 or more joined civilizations. A new world has the standard map and 250 rounds. At most 12 unfinished games per host."
      }
    },
    "/games/join": {
      "post": {
        "summary": "Join using an invitation code",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The lobby is full or already started, or the requested civilization is taken (error.code=civilization_taken). Fetch availableCivilizations or omit civilization for automatic assignment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JoinCodeRequest"
              }
            }
          }
        }
      }
    },
    "/games/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "get": {
        "summary": "Read your fog-redacted game detail, or a forming lobby you were invited to",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, not a member, or a finished game removed three days after it ended",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Members only, except public waiting lobbies, and private waiting lobbies requested with their invitation code, expose roster and settings with state:null. Unknown and unlisted nonmember game IDs both return404.",
        "parameters": [
          {
            "name": "X-Atlas-Invite",
            "in": "header",
            "required": false,
            "description": "Invitation code. Lets a non-member view a waiting private lobby before joining it with POST /games/join.",
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          }
        ]
      }
    },
    "/games/{id}/join": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Join a public waiting lobby",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The lobby is full or already started, or the requested civilization is taken (error.code=civilization_taken). Fetch availableCivilizations or omit civilization for automatic assignment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JoinRequest"
              }
            }
          }
        }
      }
    },
    "/games/{id}/ai": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Host sets the number of built-in AI opponents in a waiting lobby",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AIRequest"
              }
            }
          }
        },
        "description": "aiCount is the desired total, from 0 to seats minus current human or external-agent members. Existing human seats and surviving AI seats are preserved; decreasing the count removes the last AI seats. A change increments revision once; the current count leaves revision unchanged. Stale revisions return 409 revision_conflict, insufficient room returns 409 lobby_full, and started games return 409 not_waiting. This lobby operation has no turn receipt: fetch current detail after an ambiguous response before retrying."
      }
    },
    "/games/{id}/start": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Host starts a waiting game",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevisionRequest"
              }
            }
          }
        }
      }
    },
    "/games/{id}/turn": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Apply an atomic batch and optionally end your turn",
        "description": "At most24 actions/batch and300/turn. Retry the identical body and requestId after a timeout. Successful receipts are scoped to game+actor+requestId and return the exact original projected response. Retention: up to48h,128/game and a128MiB global budget. Conflicting reused IDs return409. Stale revisions never apply twice. Human actions are saved immediately. Subsequent built-in AI turns run in the background; game.aiTurn reports queued, running or failed. Poll GET /games/{id} while waiting (about every 2 seconds). Each completed AI civilization advances the revision. Receipts retain the original acknowledgement, not later AI results; fetch current detail after replaying a receipt. Mutations during AI processing return 409 ai_in_progress; reads and owner deletion remain available. A failed job can be resumed with POST /games/{id}/retry-ai and the current revision. Human deadlines start after AI processing finishes.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TurnRequest"
              }
            }
          }
        }
      }
    },
    "/games/{id}/skip": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Explicitly skip an expired turn",
        "description": "Only members; requires a configured deadline that has passed. Reads and background timers never advance game time.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevisionRequest"
              }
            }
          }
        }
      }
    },
    "/games/{id}/play-on": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Play a finished game on",
        "description": "Reopens a finished world for play (status active again). Only a player whose civilization still stands may ask. The victory moves to state.pastVictories and state.continued is set. From then on only a domination victory ends the game (the last surviving civilization, or the holder of every original capital): culture, the Space Program (no longer offered), the round limit and a scenario's verdict no longer do, and state.maxRounds is reported as the current round plus 100. Once a domination victory is among pastVictories (continued.domination true) nothing ends the game, except the fall of every civilization or of every person playing. Answers 409 not_finished for a world that is not finished.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevisionRequest"
              }
            }
          }
        }
      }
    },
    "/games/{id}/difficulty": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Change a running world's difficulty",
        "description": "Host only (403 host_required). Sets the difficulty of a running world (status active; 409 not_active otherwise, 409 scenario_difficulty in a scenario, 409 ai_in_progress while computer leaders play). Body: revision and difficulty (one of rules.difficulty.levels). The new level's bonuses apply from then on; what the old level already gave (extra starting units, growth, gold) stays. Every player is told in the Chronicle (event kind difficulty_changed). Added 19 November 2026.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "revision",
                  "difficulty"
                ],
                "properties": {
                  "revision": {
                    "type": "integer"
                  },
                  "difficulty": {
                    "type": "string",
                    "enum": [
                      "easy",
                      "normal",
                      "hard",
                      "harder",
                      "hardest"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/games/{id}/turn-mode": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Choose turns in a lobby or switch a running world",
        "description": "Host only (403 host_required). Body: mode (sequential or simultaneous), plus revision in a lobby. Simultaneous turns require at least two distinct living human controllers; the developer account has a solo override (409 simultaneous_humans_required otherwise). Open seats and computer leaders do not count. Lobby changes take effect immediately and are checked again when starting. In an active world the switch is stored as state.pendingTurnMode and takes effect at the next round boundary; requesting the current mode cancels a pending switch. Existing worlds are not automatically converted when their human count drops. Scenarios keep sequential turns. 409 not_active unless waiting or active; 409 scenario_turn_mode in a scenario; 409 ai_in_progress while sequential AI plays; 409 busy during a simultaneous round change.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "sequential",
                      "simultaneous"
                    ]
                  }
                },
                "required": [
                  "mode"
                ]
              }
            }
          }
        }
      }
    },
    "/games/{id}/leave": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Leave a waiting lobby",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevisionRequest"
              }
            }
          }
        },
        "description": "The host must cancel the lobby instead."
      }
    },
    "/games/{id}/cancel": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Host cancels and removes a waiting lobby",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevisionRequest"
              }
            }
          }
        }
      }
    },
    "/games/{id}/delete": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Host deletes a world for every player",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevisionRequest"
              }
            }
          }
        },
        "description": "Host only, in any status. Permanently removes the world, its saves, receipts, replay journal and rewind history for all players. Requires the current revision."
      }
    },
    "/games/{id}/rewind": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Resume a preserved turn (Andrei only)",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RewindRequest"
              }
            }
          }
        },
        "description": "Only the established Andrei account in its hosted games. Loads a recorded position: entry selects a listed position of the world history, pointId a position saved by an older release, or round and playerId a side\u2019s turn start. The position is rebuilt from the stored state changes and checked against its hash; no action replay or archived engine is used. Positions that were never recorded return 404. Only control changes; no player id is renamed. Other positions are preserved, the revision advances, and the deadline resets. Future play uses current rules. Idempotent by actor and requestId. A pending or committed civil-war choice blocks live rewind with 409 side_committed. Campaign defeat removes permission to continue; read-only replay remains available."
      },
      "get": {
        "summary": "List preserved turns (Andrei only)",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RewindHistory"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Returns saved-position metadata and available turn-start range/sides only. Snapshot reads require no background preparation; preparing is always false. Historical gaps are not filled during loading. Permissions match POST."
      }
    },
    "/games/{id}/government-forecast": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "get": {
        "summary": "Forecast income under each available government",
        "responses": {
          "200": {
            "description": "Income per turn under the current government and each reform option, once its transition has ended, with today\u2019s ruling family, cities, citizens, army and that government\u2019s default tax.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "revision": {
                      "type": "integer"
                    },
                    "current": {
                      "type": "object",
                      "properties": {
                        "governmentId": {
                          "type": "string"
                        },
                        "gold": {
                          "type": "number"
                        },
                        "science": {
                          "type": "number"
                        },
                        "culture": {
                          "type": "number"
                        },
                        "production": {
                          "type": "number"
                        },
                        "food": {
                          "type": "number"
                        },
                        "privateGold": {
                          "type": "number"
                        },
                        "armyUpkeep": {
                          "type": "number"
                        },
                        "officeStipends": {
                          "type": "number"
                        },
                        "taxRate": {
                          "type": "number"
                        },
                        "riotingCities": {
                          "type": "integer"
                        }
                      }
                    },
                    "options": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "governmentId": {
                            "type": "string"
                          },
                          "gold": {
                            "type": "number"
                          },
                          "science": {
                            "type": "number"
                          },
                          "culture": {
                            "type": "number"
                          },
                          "production": {
                            "type": "number"
                          },
                          "food": {
                            "type": "number"
                          },
                          "privateGold": {
                            "type": "number"
                          },
                          "armyUpkeep": {
                            "type": "number"
                          },
                          "officeStipends": {
                            "type": "number"
                          },
                          "taxRate": {
                            "type": "number"
                          },
                          "riotingCities": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Game was not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The game has not started",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Read-only. Views the requesting member\u2019s side. Ruling-family changes, elections and later growth are not predicted."
      }
    },
    "/games/{id}/history": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "get": {
        "summary": "Read your civilization's recorded history",
        "description": "Recorded actions in order along the current timeline, as your civilization saw them: your own orders in full and, of every other civilization, only the actions and units your civilization observed when they happened. Hidden orders, unseen units and the private journal are never included. An entry that ends a turn carries that turn's actions. Page with after=cursor until done is true.",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "required": false,
            "description": "History entry to continue from (0: the beginning). Use the cursor of the previous page.",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "fromRound",
            "in": "query",
            "required": false,
            "description": "Start at the first entry of this round or later. Not combined with after.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Entries to scan in this page; default 40.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of recorded actions.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "viewerId": {
                      "type": "string"
                    },
                    "after": {
                      "type": "integer"
                    },
                    "cursor": {
                      "type": "integer",
                      "description": "Pass as after to read the next page."
                    },
                    "done": {
                      "type": "boolean"
                    },
                    "head": {
                      "type": "integer"
                    },
                    "entries": {
                      "type": "array",
                      "description": "Only entries with something you were allowed to see.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entry": {
                            "type": "integer"
                          },
                          "round": {
                            "type": "integer"
                          },
                          "turn": {
                            "type": "integer"
                          },
                          "items": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "description": "One observed action: kind, actorId, round, turn, tileId, plus unit, city or combat details as observed."
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not a member of this game, or the position does not exist."
          }
        }
      }
    },
    "/games/{id}/replay": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Replay mode: view and try out a saved turn in memory (Andrei; every member once the game has finished)",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplayRequest"
              }
            }
          }
        },
        "description": "Read-only history and replay sessions for the established Andrei account in its hosted games and every member of a finished game. Open with entry, round and playerId, or live:true. Send session with move back/forward to navigate the same side's turns, or playerId to switch sides. Send session, step and playback:true to advance one recorded history frame, preserving the viewing side. The response includes replay.playback {id,items,end}; items contain owned commands and only witnessed opponent actions. Play watches history and never rewinds the live game. replay.play indicates whether more recorded history is available. Pause is client-side; the Replay toggle returns to the live game. Legacy session, step and actions requests still affect only the in-memory copy. The saved world, history, revision, and receipts remain unchanged. Explicit POST /games/{id}/rewind is separate and requires its existing authorization. Stale steps return 409 replay_conflict; expired sessions return 409 replay_expired. Missing saved turns return 404 replay_end or rewind_not_found."
      },
      "get": {
        "summary": "List preserved turns (Andrei only)",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RewindHistory"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Returns saved-position metadata and available turn-start range/sides only. Snapshot reads require no background preparation; preparing is always false. Historical gaps are not filled during loading. Permissions match POST."
      }
    },
    "/games/{id}/takeover": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Play as another side (Andrei only)",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TakeoverRequest"
              }
            }
          }
        },
        "description": "Only the established Andrei account in its hosted active games. Andrei takes control of any surviving civilization or rebel faction listed in GameDetail.takeoverChoices. No player id changes: the roster records the controlling account (controllerId), GameDetail.you names the side Andrei now plays, the former side is played by the computer, and computer turns run until Andrei moves. The prior position stays in the rewind list. Idempotent by actor and requestId; a new journal checkpoint records the change. A live civil-war commitment or recorded campaign defeat blocks takeover with 409 side_committed."
      }
    },
    "/scenarios": {
      "get": {
        "summary": "List scenarios",
        "description": "Scenarios are saved worlds kept as templates. They never appear among your worlds and are never played directly; each start creates a new world from one. scope=public lists the public scenarios every account can start: each carries a briefing (history, objectives, defeat conditions, difficulty) and ends the game with a victory or defeat when its objective is reached or lost. The default scope, mine, lists your own private templates.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "scenarios": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "round": {
                            "type": "integer"
                          },
                          "mapSize": {
                            "type": "string"
                          },
                          "civilizations": {
                            "type": "integer"
                          },
                          "side": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "description": "The side you start as.",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "civilization": {
                                "type": "string"
                              },
                              "civilizationName": {
                                "type": "string"
                              }
                            }
                          },
                          "createdAt": {
                            "type": "integer"
                          },
                          "briefing": {
                            "type": "object",
                            "description": "Public scenarios only: the scenario's briefing (id, kind suppress|overthrow|endure|siege|waterworks, title, tagline, difficulty, side, history[], objectives[], defeats[], optional lessons[] or guide (version 2, target and approach coordinates, unit IDs for separate turn-based guided popups), startRound, endRound; siege requires starvation followed by taking the target city; waterworks requires four canals, an Aqueduct and growth to seven citizens).",
                            "additionalProperties": true
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "public",
                "mine"
              ],
              "default": "mine"
            },
            "description": "public: scenarios anyone can start. mine: your private templates."
          }
        ]
      }
    },
    "/scenarios/{id}/start": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Start a new world from a scenario",
        "description": "Owner only. Copies the scenario's world, recorded history (replay journal), saved positions and marked turns into a new ordinary world and returns its GameDetail. The scenario itself is unchanged and can be started again; later copies are numbered. Idempotent by requestId: a retry returns the same world.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "requestId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{8,80}$"
                  }
                },
                "required": [
                  "requestId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new world",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "404": {
            "description": "No such scenario of yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "World limit reached, or requestId reused for another request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/scenarios/{id}/delete": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Delete a scenario",
        "description": "Owner only. Removes the template and its history; worlds already started from it remain.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "404": {
            "description": "No such scenario of yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/games/{id}/continue": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Continue from a replayed turn",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContinueRequest"
              }
            }
          }
        },
        "description": "A member who may replay the world continues from the position on screen in their replay session, as the side on screen. The host (the established Andrei account in its hosted game) plays on in this world, recording the left position in its history like a rewind. Anyone else gets a new world of their own: a copy of this world and its recorded history, owned by them, starting from that position as that side, where every other side, including those played by people, is played by the computer. The original world is not changed; the response then includes continuedFrom. Computer turns are played up to the chosen side's turn. A stale session or step returns 409; a finished position cannot continue."
      }
    },
    "/games/{id}/retry-ai": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Retry a paused background AI turn",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevisionRequest"
              }
            }
          }
        },
        "description": "Game members only. Requires the current revision and game.aiTurn.status=failed. Resumes from the last committed position; does not replay previously committed moves. Returns the current game detail. Conflicting or active jobs return 409.",
        "operationId": "retryAI"
      }
    },
    "/games/{id}/observations": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "get": {
        "summary": "Watch visible opponent actions as they happen",
        "description": "Members only. Returns the controlled or observed civilization\u2019s saved actionReplay and provisional live AI observations, filtered by sight at action time. Hidden paths and other viewers\u2019 records are excluded. The live worker feed is transient; state and history commit atomically per civilization. Acknowledge provisional items only when identical observations appear in actionReplay. Read-only; never advances a turn.",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "required": false,
            "description": "The previous opaque cursor. Waits up to 15 seconds for a change.",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Viewer observation feed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "cursor",
                    "revision",
                    "you",
                    "aiTurn",
                    "actionReplay",
                    "live"
                  ],
                  "properties": {
                    "cursor": {
                      "type": "string"
                    },
                    "revision": {
                      "type": "integer"
                    },
                    "you": {
                      "type": "string"
                    },
                    "aiTurn": {
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "actionReplay": {
                      "type": "object"
                    },
                    "live": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "attempt": {
                          "type": "string"
                        },
                        "items": {
                          "type": "array",
                          "maxItems": 1024,
                          "items": {
                            "type": "object"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication required"
          },
          "404": {
            "description": "World not found or not a member"
          }
        }
      }
    },
    "/games/quick-start": {
      "post": {
        "summary": "Quick start a default world with seven computer opponents",
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "civilization",
                  "requestId"
                ],
                "additionalProperties": false,
                "properties": {
                  "civilization": {
                    "type": "string"
                  },
                  "requestId": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 80,
                    "pattern": "^[A-Za-z0-9_-]{8,80}$"
                  }
                }
              }
            }
          }
        },
        "description": "Creates and starts a world atomically, skipping the lobby. Uses Normal difficulty, continents, sequential turns and no deadline. Repeating requestId returns the same result; the first successful start records the existing first-game conversion once."
      }
    },
    "/games/{id}/barbarian-level": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^g_[a-f0-9-]{36}$"
          }
        }
      ],
      "post": {
        "summary": "Change barbarian spawning frequency",
        "description": "Host only, active non-scenario worlds. Body: revision and barbarianLevel (normal or frequent). Existing spawn progress is preserved; the next spawn is never earlier than the next round. Rejects changes while sequential AI turns run. Existing worlds default to normal. No live turn is submitted.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, fields or action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Host or browser origin restriction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found or not a member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision, turn or lobby conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 16 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit or registration quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Server or storage capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "revision",
                  "barbarianLevel"
                ],
                "properties": {
                  "revision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "barbarianLevel": {
                    "type": "string",
                    "enum": [
                      "normal",
                      "frequent"
                    ],
                    "default": "normal",
                    "description": "Barbarian camp spawning: Normal every 15 rounds, Frequent every 10. Initial camps exist when the world starts."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "aa_ prefixed256-bit token returned by POST /players"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "Player": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 48
          }
        },
        "required": [
          "id",
          "name"
        ],
        "additionalProperties": false
      },
      "RosterPlayer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 48
          },
          "civilization": {
            "type": "string"
          },
          "isAI": {
            "type": "boolean"
          },
          "eliminated": {
            "type": "boolean"
          },
          "score": {
            "type": "number"
          },
          "civilizationName": {
            "type": [
              "string",
              "null"
            ],
            "description": "Current display name of the civilization ID (for example Mongolia for dawn)."
          },
          "aiVersion": {
            "type": "string",
            "enum": [
              "r38",
              "r37",
              "r36",
              "r35",
              "r34",
              "r33",
              "r32",
              "r31",
              "r30",
              "r29",
              "r28",
              "r27",
              "r12"
            ],
            "default": "r38",
            "description": "Built-in AI version: R38 for everyone. Other values appear only in worlds where the developer account selected them."
          }
        },
        "required": [
          "id",
          "name",
          "civilization",
          "isAI"
        ],
        "additionalProperties": false
      },
      "RegisterRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 48
          },
          "qt": {
            "type": "string",
            "description": "Optional. The qt tag of the landing-page link the new player first followed (\u2026/landing?qt=x2), saved with the player. 1\u201364 letters, digits, dots, underscores, tildes or hyphens; any other value is ignored, never refused.",
            "maxLength": 64
          },
          "gclid": {
            "type": "string",
            "description": "Optional. The click ID Google added to the landing page's address when the new player followed an advertisement, saved with the player; when the player first starts a game it is offered to Google Ads as a conversion. 8\u2013256 letters, digits, dots, underscores or hyphens; any other value is ignored, never refused.",
            "maxLength": 256
          },
          "gbraid": {
            "type": "string",
            "description": "Optional. What Google sends in place of gclid from some iPhone apps; saved with the player.",
            "maxLength": 256
          },
          "wbraid": {
            "type": "string",
            "description": "Optional. What Google sends in place of gclid from some iPhone browsers; saved with the player.",
            "maxLength": 256
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      },
      "Registration": {
        "type": "object",
        "properties": {
          "player": {
            "$ref": "#/components/schemas/Player"
          },
          "token": {
            "type": "string",
            "pattern": "^aa_[A-Za-z0-9_-]{43}$",
            "description": "Shown once. Store securely; server persists only its SHA-256 hash."
          }
        },
        "required": [
          "player",
          "token"
        ],
        "additionalProperties": false
      },
      "RevisionRequest": {
        "type": "object",
        "properties": {
          "revision": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "revision"
        ],
        "additionalProperties": false
      },
      "AIRequest": {
        "type": "object",
        "properties": {
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "aiCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 11,
            "description": "Desired total built-in AI opponents; cannot exceed seats minus current human or external-agent members."
          },
          "aiVersion": {
            "type": "string",
            "enum": [
              "r38"
            ],
            "default": "r38",
            "description": "Version for newly added AI seats: R38 (choosing another version is reserved for the developer account). Existing seats retain their version; omission uses the world default."
          }
        },
        "required": [
          "revision",
          "aiCount"
        ],
        "additionalProperties": false
      },
      "CreateGameRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 48
          },
          "seats": {
            "type": "integer",
            "minimum": 2,
            "maximum": 8,
            "default": 2
          },
          "aiCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 7,
            "default": 1
          },
          "civilization": {
            "type": "string",
            "description": "A civilization ID from GET /rules, or its display name (case-insensitive). IDs are the civilizations' names in lower case (greece, china, phoenicia, germany, france, rome, mongolia, egypt, \u2026); the older IDs aurora, verdant, mariner, ember, lyric, stone, dawn and river are still accepted. Omit to choose the first unclaimed civilization. Joining with a taken civilization returns 409 civilization_taken, including conflicts with AI seats."
          },
          "mapSize": {
            "type": "string",
            "description": "New worlds use the standard map (52 \u00d7 34 hexes). Large and huge maps are not available for new games; existing games may still report them.",
            "enum": [
              "standard"
            ],
            "default": "standard"
          },
          "mapStyle": {
            "type": "string",
            "description": "Pangaea and Archipelago are not available for new games; existing games may still report them.",
            "enum": [
              "continents"
            ],
            "default": "continents"
          },
          "maxRounds": {
            "type": "integer",
            "description": "A new world's history lasts 250 rounds. 150 and 400 are not available for new games; existing games may still report them.",
            "enum": [
              250
            ],
            "default": 250
          },
          "difficulty": {
            "type": "string",
            "description": "One level for the whole world, chosen at creation; the host may change it in a running world (POST /games/{id}/difficulty). Easy favours civilizations led by people; Hard, Harder and Hardest favour computer-led civilizations; Normal favours nobody. The bonuses of each level are published in rules.difficulty.",
            "enum": [
              "easy",
              "normal",
              "hard",
              "harder",
              "hardest"
            ],
            "default": "normal"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "unlisted"
            ],
            "default": "unlisted"
          },
          "turnMode": {
            "type": "string",
            "enum": [
              "sequential",
              "simultaneous"
            ],
            "default": "sequential",
            "description": "Sequential by default. Only the developer account can create a simultaneous lobby directly. Other hosts first invite a second human, then choose simultaneous turns using POST /games/{id}/turn-mode. Empty seats and AI do not satisfy the two-human requirement."
          },
          "turnHours": {
            "type": "integer",
            "enum": [
              0,
              24,
              72
            ],
            "default": 0
          },
          "aiVersion": {
            "type": "string",
            "enum": [
              "r38"
            ],
            "default": "r38",
            "description": "Built-in AI version. Everyone plays R38; choosing another version is reserved for the developer account."
          },
          "barbarianLevel": {
            "type": "string",
            "enum": [
              "normal",
              "frequent"
            ],
            "default": "normal",
            "description": "Barbarian camp spawning: Normal every 15 rounds, Frequent every 10. Initial camps exist when the world starts."
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "JoinRequest": {
        "type": "object",
        "properties": {
          "civilization": {
            "type": "string",
            "description": "A civilization ID from GET /rules, or its display name (case-insensitive). IDs are the civilizations' names in lower case (greece, china, phoenicia, germany, france, rome, mongolia, egypt, \u2026); the older IDs aurora, verdant, mariner, ember, lyric, stone, dawn and river are still accepted. Omit to choose the first unclaimed civilization. Joining with a taken civilization returns 409 civilization_taken, including conflicts with AI seats."
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "JoinCodeRequest": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "maxLength": 80
          },
          "civilization": {
            "type": "string",
            "description": "A civilization ID from GET /rules, or its display name (case-insensitive). IDs are the civilizations' names in lower case (greece, china, phoenicia, germany, france, rome, mongolia, egypt, \u2026); the older IDs aurora, verdant, mariner, ember, lyric, stone, dawn and river are still accepted. Omit to choose the first unclaimed civilization. Joining with a taken civilization returns 409 civilization_taken, including conflicts with AI seats."
          }
        },
        "required": [
          "code"
        ],
        "additionalProperties": false
      },
      "Action": {
        "oneOf": [
          {
            "type": "object",
            "description": "Upgrade an own unit to the latest researched successor in its selected line (rules.units[].upgradesTo or alsoUpgradesTo). Send the toType in the advertised legal action; it may be omitted for the default line. Requires the unit inside your borders, not aboard a ship, with movement left, and gold for units[].upgrade.goldCost: max(rules.upgrades.minimumGold, ceil(production cost difference \u00d7 rules.upgrades.goldPerProductionDifference)). Health is kept; movement and attacks become 0 until your next turn. The crown may pay for retained troops and free-city militia without taking command. Automatic private upgrades use their own lord or town funds after wages and upkeep.",
            "properties": {
              "type": {
                "const": "upgrade"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "toType": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120,
                "description": "Optional target from this unit\u2019s advertised upgrade actions. Supports the main and alternate upgrade lines; omitting it selects the latest researched successor in the main available line."
              }
            },
            "required": [
              "type",
              "unitId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Permanently remove an own unit. Refused for a ship carrying cargo and for your last settler while you have no city.",
            "properties": {
              "type": {
                "const": "disband"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId"
            ],
            "additionalProperties": false
          },
          {
            "$ref": "#/components/schemas/PurchaseAction"
          },
          {
            "type": "object",
            "description": "Move to an advertised reachable tile using the unit\u2019s movement. Land movement between connected railroad tiles or city centers costs zero, but every step requires positive remaining movement. Entering or leaving the network uses ordinary road or terrain costs. Spending the last movement point ends travel on that hex, including when entering rails; standing orders resume after movement refreshes next turn. Railroads do not restore movement or attacks and do not override borders, blockers, water or impassable terrain. Ships and aircraft retain their normal travel rules.",
            "properties": {
              "type": {
                "const": "move"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "tileId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId",
              "tileId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "attack"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "targetId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId",
              "targetId"
            ],
            "additionalProperties": false,
            "description": "Attack a visible hostile stack. Costs rules.combat.attackMovementCost (1) movement point and the turn's attack; leftover movement can still be used to move (aircraft end their turn). The advertised targetId is the stack\u2019s best defender; it fights unless a Fearful withdrawal replaces it with the next defender. Fearful fighting land/naval defenders have a 20% chance to withdraw directly away from an adjacent non-air attacker if that rear hex is legal; an abandoned tile can be occupied or its city captured. For aircraft (rules.units[].air) this is a strike within the unit\u2019s range: no retaliation, and an enemy fighter within range of the target may intercept first. Aircraft are never targets."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "attack_city"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId",
              "cityId"
            ],
            "additionalProperties": false,
            "description": "Capture a visible city of a civilization you are at war with once no fighting unit stands in it: aircraft, ships in port, settlers, workers and siege engines do not hold a city. Offered only to adjacent land melee units: cities have no defense of their own, so while fighting units hold one, attack them instead. The unit moves in without a battle and ends its turn. A city above population one changes hands, losing one citizen and its stored production (city_captured event). A city at population one is destroyed instead (city_destroyed event with captorId and previous ownerId): its buildings and wonders are lost and land no other city of its previous owner reaches becomes unclaimed. Both outcomes destroy aircraft and ships in port with their cargo; each remaining settler, worker or siege engine inside is captured (rules.capture.chance) or destroyed."
          },
          {
            "type": "object",
            "description": "Catapult, Cannon or Artillery bombard adjacent visible hostile fortifications, reducing walls first then every fortified defender\u2019s entrenchment by the remaining power. Uses rules.units[].bombard (25/50/100 percentage points), one movement point and the turn's attack. Never damages unit HP. When walls and entrenchment are already zero, a shot disables one random intact ordinary building; wonders are excluded. Repairs use produce with projectId repair_BUILDING_ID for ceil(original shield cost/2). Not offered when no defenses or intact buildings remain, to cargo, or out of range.",
            "properties": {
              "type": {
                "const": "bombard"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "tileId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId",
              "tileId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Fly an own aircraft to another of your cities within range \u00d7 rules.air.rebaseRangeMultiplier hexes that holds fewer than rules.air.cityCapacity aircraft. Ends the aircraft\u2019s turn and records a private unit_rebased event.",
            "properties": {
              "type": {
                "const": "rebase"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId",
              "cityId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Fly an own land unit from a city with an Airport to another of your cities with an Airport (rules.airlift). One unit may leave each Airport per turn; the flight ends the unit\u2019s turn and records a private unit_airlifted event.",
            "properties": {
              "type": {
                "const": "airlift"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId",
              "cityId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "found_city"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "join_city"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "cityId": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "unitId",
              "cityId"
            ],
            "additionalProperties": false,
            "description": "Consume an own settler on an owned city center to add one citizen (not available once the city is at its size limit, populationCap), preserving citizenId, familyId, ethnicityId and appearanceSeed. Requires remaining movement and no transportId. cityId must identify that same owned city. Does not spend stored food or count as natural growth."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "fortify"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId"
            ],
            "additionalProperties": false,
            "description": "Begin fortifying (21 November 2026: the order no longer spends movement or raises the hex at once). The unit gets fortifying: true, keeps its movement and leaves the Next unit cycle; any other order this turn, or wake, cancels it without losing the turn. At the start of your next turn it becomes fortified and, for land fighters, its hex gains +25% fortification, then +25% more each turn while a unit stays fortified, up to +25% in the field or +50% in a city. Settlers, Workers, siege engines and ships get this command labelled Sleep and aircraft Stand by: the same order, raising no fortification. Not offered while fortifying; offered to a fortified unit, where it changes nothing. Moving or attacking ends the position."
          },
          {
            "type": "object",
            "description": "Skip turn (labelled so in the reference interface). Bookkeeping for your own interface, saved with the game: the unit sits out your Next unit cycle until your next turn begins. Offered to units with movement left, not fortified or fortifying and without orders. Any other order wakes it; it changes no rules, so the unit still rests.",
            "properties": {
              "type": {
                "const": "sleep"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Available only to a wounded unit with movement left on a tile owned by its civilization, excluding cargo. Fortify (or sleep) and sleep until healed; wake automatically at full health. Like fortify, the order spends no movement and can be changed until the turn ends; its fortification takes hold at the start of your next turn. Unclaimed, enemy and open-border foreign territory do not allow this command because they do not provide rest healing. Acting earlier this turn still prevents that turn\u2019s recovery.",
            "properties": {
              "type": {
                "const": "sleep_until_healed"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Cancels ordinary sleep, sleep until healed, or a fortify order that has not yet taken hold (fortifying). Cancelling healing sleep also releases its fortification. These orders spend no movement, so the unit keeps whatever it had left.",
            "properties": {
              "type": {
                "const": "wake"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Two or more of your own units on tileId (not aboard a ship) form one group, saved with the game; each leaves any group it was in. Groups are bookkeeping for your interface and change no rules. Offered as a template per tile holding two or more of your units (requiresUnitIds).",
            "properties": {
              "type": {
                "const": "group"
              },
              "tileId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "unitIds": {
                "type": "array",
                "minItems": 2,
                "maxItems": 100,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                }
              }
            },
            "required": [
              "type",
              "tileId",
              "unitIds"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Takes a unit out of its group; a group left with one unit dissolves.",
            "properties": {
              "type": {
                "const": "ungroup"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "improve"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "improvement": {
                "enum": [
                  "farm",
                  "mine",
                  "road",
                  "pasture",
                  "plantation",
                  "railroad",
                  "camp",
                  "canal"
                ]
              }
            },
            "required": [
              "type",
              "unitId",
              "improvement"
            ],
            "additionalProperties": false,
            "description": "A Worker builds on owned or unclaimed passable land outside city centers, using all remaining movement. Railroad requires Steam Power and an existing road; it sets tile.railroad while retaining the road, woods and other improvement. Roads and railroads add no yields. Building still requires positive movement, even on railroads. Camp requires Furs and Animal Husbandry and preserves woods. Plantations also improve Dyes and Wine."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "pillage"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "improvement": {
                "enum": [
                  "farm",
                  "mine",
                  "pasture",
                  "plantation",
                  "camp",
                  "canal",
                  "fishing_boats",
                  "road",
                  "railroad"
                ]
              }
            },
            "required": [
              "type",
              "unitId",
              "improvement"
            ],
            "additionalProperties": false,
            "description": "Destroy one improvement on the tile where your military unit stands, on land or water of a civilization you are at war with. Pillaging a railroad removes only the rails and leaves its road; the underlying road is not offered while rails remain. Your treasury gains rules.pillage.gold[improvement]; the unit spends rules.pillage.movementCost movement. Offered per improvement on the tile, with gold on the option; positive movement is required. Civilians, aircraft and units aboard ships cannot pillage, and city tiles cannot be pillaged."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "pillage_own"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "improvement": {
                "enum": [
                  "farm",
                  "mine",
                  "pasture",
                  "plantation",
                  "camp",
                  "canal",
                  "fishing_boats",
                  "road",
                  "railroad"
                ]
              }
            },
            "required": [
              "type",
              "unitId",
              "improvement"
            ],
            "additionalProperties": false,
            "description": "Destroy one improvement on the tile where your military unit stands, inside your own borders. It pays no gold and heals no one; the unit spends rules.pillage.movementCost movement. Pillaging a railroad removes only the rails and leaves its road. Offered per improvement on the tile with ownLand true; the same units as pillage may do it, and city tiles are excluded."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "research"
              },
              "techId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "techId"
            ],
            "additionalProperties": false,
            "description": "It may be changed any number of times during your turn."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "produce"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "projectId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "cityId",
              "projectId"
            ],
            "additionalProperties": false,
            "description": "It may be changed any number of times during your turn. Wonders have an era in rules.wonders and rules.projects. Only wonders of the civilization\u2019s current or immediately previous age can be built, including completion of queued projects. The age follows the latest era among discovered technologies; technology and location requirements still apply. Completed wonders retain their effects."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "city_focus"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "focus": {
                "enum": [
                  "balanced",
                  "food",
                  "production",
                  "gold",
                  "science",
                  "culture",
                  "manual"
                ]
              }
            },
            "required": [
              "type",
              "cityId",
              "focus"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "After rules.mayors.technology (Civil Service): appoint a military or economic mayor (not under Despotism) to choose a city's production, or dismiss it with \"none\". A mayor chooses at once, then at the start of your turns whenever the city has nothing to build, makes Coinage, has just finished a unit, has a blocked project, or stands empty with enemies near. Your own produce choices are finished first. Economic mayors do not choose Worker production; select Workers with produce. A newly appointed mayor keeps a building or wonder under way rather than lose much stored production. Mayors keep to a budget (units only while forecast income after upkeep and loan payments stays non-negative, or the treasury covers 20 turns of the deficit, 10 in war, and Coinage could close it) and explain each choice: a private mayor_choice event with aim and reason, and the city's mayorNote with the budget it saw. A captured city loses its mayor.",
            "properties": {
              "type": {
                "const": "mayor"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "mayor": {
                "enum": [
                  "military",
                  "economic",
                  "none"
                ]
              }
            },
            "required": [
              "type",
              "cityId",
              "mayor"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "declare_war"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "offer_peace"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "accept_peace"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Assign or unassign a citizen on one eligible tile in this owned city. A tile is ineligible unless reachable from the city center within three hex steps, costing one each regardless of terrain, roads or borders. Land targets require land-only paths; water targets leave the center directly into water and stay on water. All living enemy units except cargo block their hex; hostile ships blockade only their own water hex and adjacent water hexes. Land and the city center remain open. Automatically switches its focus to manual. Use advertised legalActions, and unassign before assigning when all citizens are occupied.",
            "properties": {
              "type": {
                "const": "work_tile"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "tileId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "worked": {
                "type": "boolean"
              }
            },
            "required": [
              "type",
              "cityId",
              "tileId",
              "worked"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Add one content citizen to a free slot of an owned city district (worked:true) or remove its most recently added worker (worked:false). Districts: science, commerce, industrial, religious, entertainment. Shares capacity with worked tiles and switches to manual focus. Unassign a tile or district worker first when no citizen is available. The administrative district rejects this command: the Palace governor is automatic; use appoint_governor for Government Quarters. At population 1, an appointed governor may also leave or return to the administrative district; government staffing becomes mandatory automatically at population 2.",
            "properties": {
              "type": {
                "const": "work_district"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "worked": {
                "type": "boolean"
              },
              "districtId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "cityId",
              "districtId",
              "worked"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Standing go-to order: any known destination. Every own unit has a goto option whose action omits tileId (requiresTileId:true); add the destination. The server plans the fewest-turn route over terrain you know, moves now and continues at the start of your later turns until arrival. Orders wake beside enemies.",
            "properties": {
              "type": {
                "const": "goto"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "tileId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId",
              "tileId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Standing exploration order for a military unit or ship: each turn it heads for the nearest unexplored territory or known ruins, until nothing within reach remains.",
            "properties": {
              "type": {
                "const": "explore"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Automate useful improvements while preserving forest and rainforest without a resource at every technology level; woods holding a resource are cleared for its improvement. Roads, railroads and Furs Camps preserve woods. After improvement and city-connection work is finished, build roads on every safe, reachable, buildable owned hex, starting near cities and continuing beyond their workable area. Wheel is required for roads; Steam Power enables subsequent railroad upgrades. Newly available improvements take priority again. Existing automate orders use this safe default. Another order cancels or replaces automation.",
            "properties": {
              "type": {
                "const": "automate"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Standing transport-network order for a Worker after Wheel. First connect owned cities across safe known passable owned or unclaimed land, reusing roads. Then complete a shortest route (fewest hexes) between every city pair, reusing roads among equally short routes. Finally pave every buildable hex inside owned borders, nearest cities first. After Steam Power, apply the connection and shortest-route stages to railroads, building roads first where needed, then upgrade territory. Avoid threats and wait when no safe work remains. Works immediately and at each owning turn; persists as orders:{type:\"automate_roads\",tileId?}. Any direct order or cancel_orders ends automation.",
            "properties": {
              "type": {
                "const": "automate_roads"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Cancel a unit\u2019s go-to, exploration or automation orders.",
            "properties": {
              "type": {
                "const": "cancel_orders"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "offer_open_borders"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "accept_open_borders"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "cancel_open_borders"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "accept_trade"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "demand_tribute"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "accept_demand"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "reject_offers"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Propose an exchange. Each side may carry any number of technologies (giveTechIds/getTechIds), gold and maps. Technologies must be learnable by their receiver; at least one side must be non-empty. Requires Writing and contact. giveMaps:true sells remembered exploration to a leader at peace, and getMaps:true buys that leader's exploration; only tiles unknown to the receiver have value, at one gold per five tiles, rounded down. The recipient answers on its own turn; computer leaders decide by attitude and temperament.",
            "properties": {
              "type": {
                "const": "offer_trade"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "giveTechId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "giveTechIds": {
                "type": "array",
                "maxItems": 40,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "description": "Any number of technologies you give; each must be learnable by the receiver now. giveTechId is a single-technology shorthand and may be combined with it."
              },
              "giveGold": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000
              },
              "getTechId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "getTechIds": {
                "type": "array",
                "maxItems": 40,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "description": "Any number of technologies you ask for; each must be learnable by you now. getTechId is a single-technology shorthand and may be combined with it."
              },
              "getGold": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000
              },
              "giveMaps": {
                "type": "boolean",
                "description": "When true, include your explored map in an offer to a computer player at peace. Copies only seller-remembered tiles and city snapshots unknown to the buyer, never units or live vision. Read canGive.maps for aggregate offer metadata."
              },
              "getMaps": {
                "type": "boolean",
                "description": "When true, ask a computer player at peace for its explored map. Copies only tiles and city snapshots it remembers that you have never explored, never units or live vision. Read canGet.maps for aggregate offer metadata."
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Begin a government reform. Monarchy/Republic require Code of Laws; Democracy/Dictatorship require Renaissance National Sovereignty (650 science, Printing + Civil Service). Every reform, including the first, costs max(40, 20 per owned city) gold. Two income phases retain outgoing rules with production/science reduced by 25%; completion starts a twenty-own-turn cooldown. Republic or Democracy to Monarchy waits for the next scheduled election, whose winner supplies the dynasty. Entering an elected government runs a population election; Dictatorship holds a power struggle using military and recent governor support with a random 0.8\u20131.2 swing. No client-authored family, price or period is accepted.",
            "properties": {
              "type": {
                "const": "reform_government"
              },
              "governmentId": {
                "enum": [
                  "monarchy",
                  "republic",
                  "democracy",
                  "dictatorship"
                ]
              }
            },
            "required": [
              "type",
              "governmentId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Withdraw a pending reform while waiting for election ratification or during its two-income-phase transition, forfeiting the fee. Unavailable after the transition completes or a conflict starts.",
            "properties": {
              "type": {
                "const": "cancel_reform"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Appoint a citizen to Government Quarters. Optional sourceCityId moves that exact citizen from another owned ordinary city, once every 40 own turns per receiving city; the source keeps at least one citizen and serving governors cannot move. Republic and Democracy permit imports only without local voting-eligible residents; all governors must have voting rights (native ethnicity in Republic, native or loyal families in Democracy). Palace appointments remain automatic.",
            "properties": {
              "type": {
                "const": "appoint_governor"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "sourceCityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "citizenId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "cityId",
              "citizenId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Remove an owned noncapital city\u2019s Government Quarters governor and their building job. The citizen remains in the city and past electoral service is retained. This command rejects a Palace target because its ruling-family governor is selected automatically and cannot be dismissed.",
            "properties": {
              "type": {
                "const": "dismiss_governor"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "cityId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "cityId"
            ],
            "properties": {
              "type": {
                "const": "emergency_relief"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "description": "Spend 10 + 5 per resident gold for two content slots over three income phases. Available during riots."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "familyId"
            ],
            "properties": {
              "type": {
                "const": "family_patronage"
              },
              "familyId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "description": "Spend 30 + 5 per resident gold to reduce grievances and secure family support for five national income phases."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "familyId",
              "cityId"
            ],
            "properties": {
              "type": {
                "const": "grant_fief"
              },
              "familyId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "description": "Under Monarchy, grant any non-capital crown city to a non-ruling resident family as a fief. A member moves there if needed. Locked lord mayor; 10% dues (20% with the Charter); private retained troops. Transfers at most one stationed land defender, selected by effective defense and health; all other troops remain crown troops."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "cityId"
            ],
            "properties": {
              "type": {
                "const": "revoke_fief"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "description": "Revoke a fief, subject to council consent. The lord gains grievance and may resist through an internal war for feudal rights."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "cityId"
            ],
            "properties": {
              "type": {
                "const": "repress"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "description": "Dictatorship only: with a fighting land unit in the city, kill one resident drawn from every family to spread fear. Once every 5 own turns per city and ceil(cities / 5) times per own turn."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "enabled"
            ],
            "properties": {
              "type": {
                "const": "war_footing"
              },
              "enabled": {
                "type": "boolean"
              }
            },
            "description": "After rules.mayors.technology, outside Despotism: true lets military mayors raise their army to its target strength regardless of the treasury; false returns them to the budget."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "familyId"
            ],
            "properties": {
              "type": {
                "const": "purge"
              },
              "familyId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "description": "Dictatorship only, once every 10 own turns: every unit of a non-ruling family passes to the ruling family or a family in office, shaken for 5 own turns (75% strength); the family loses its governorships and glory and gains fear and grievance; every other family gains fear. A family whose bloc would be viable resists instead with an immediate coup. legalActions marks that case with resists: true."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "familyId"
            ],
            "properties": {
              "type": {
                "const": "arrest"
              },
              "familyId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "description": "Dictatorship only, during a crisis warning: arrest the bloc's leader, using the turn's repression allowance. One member of the family dies, it gains fear 40 and the other bloc members 10 grievance; the crisis is then recomputed and may collapse."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "const": "concede_power"
              }
            },
            "description": "During the one-turn warning of a conspiracy (self.internalPolitics.crisis.warningActive): hand over power without a war. The bloc's leader becomes the ruling family; if the bloc demands another government the country reforms to it, with an immediate election when it is elected. Unavailable to Ambitious and Power-hungry ruling families, and to Traditionalist ones when the government would change (crisis.handover.reason says why). The old house loses its governorships and court offices, a quarter of the treasury goes to the bloc's houses, only those houses are calmed, and all plot chances rise by 50% for 20 turns."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "familyId"
            ],
            "properties": {
              "type": {
                "const": "buy_off_family"
              },
              "familyId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "description": "During the one-turn warning of a conspiracy: pay a house of the bloc (crisis.buyOffs lists each price) to leave it. Its grievance falls below its limit and it joins no plot for 10 turns; if it led, the bloc picks a new leader or dissolves; the bloc is recomputed and collapses when no longer viable. Ambitious and Power-hungry leaders refuse. All plot chances rise by 25% for 20 turns."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "traditionId"
            ],
            "properties": {
              "type": {
                "const": "adopt_tradition"
              },
              "traditionId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "description": "Choose a national tradition from self.traditionOffer while self.traditionsDue is positive. Milestones: 50, 500, 1000, 2000, 5000 accumulated culture; at most five new adoptions per civilization. Up to eight of the 53 globally unclaimed traditions eligible for your age or earlier are drawn per choice, with deterministic ranking; another civilization may claim an offered tradition first. Each tradition can be claimed only once in the game, even by a civilization that later falls. Adoption rechecks global claims and age. self.era is the latest discovered technology age; every tradition publishes era. self.traditionsEligible counts unclaimed traditions allowed by age. self.traditionsPending includes earned choices waiting for a later age; self.traditionsDue counts choices available now. Existing held traditions remain active regardless of age. self.claimedTraditions lists claimed IDs without revealing unknown owners; self.traditionsAvailable counts unclaimed traditions. When none remain, traditionsDue is zero, traditionOffer is empty and nextTraditionAt is null. Existing saved holdings are retained. rules.traditions.traditions lists names and effects, self.traditions held IDs, and self.nextTraditionAt the next milestone. Computer leaders choose at once. All players expose accumulated culture alongside public score; traditions remain visible only for known civilizations or final records."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "familyId"
            ],
            "properties": {
              "type": {
                "const": "confiscate"
              },
              "familyId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "description": "Dictatorship or Despotism: take 75% of a non-ruling family's wealth into the treasury. Never a family whose loan to the state is outstanding; once per family every 20 own turns and once per country every 5."
          },
          {
            "type": "object",
            "description": "Commit once to a human civil war or coup side after inspecting state.internalChoice. Submit this action alone with endTurn:false. Rebels take the opening turn; losing the chosen side ends this human campaign.",
            "properties": {
              "type": {
                "const": "choose_internal_side"
              },
              "conflictId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "side": {
                "enum": [
                  "government",
                  "opposition"
                ]
              }
            },
            "required": [
              "type",
              "conflictId",
              "side"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "rate"
            ],
            "properties": {
              "type": {
                "const": "set_tax_rate"
              },
              "rate": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100,
                "multipleOf": 5
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "familyId",
              "amount"
            ],
            "properties": {
              "type": {
                "const": "borrow"
              },
              "familyId": {
                "type": "string"
              },
              "amount": {
                "type": "integer",
                "minimum": 1
              }
            },
            "description": "Borrow from a family: Monarchy 15%, Republic 8%, others 10% interest per started ten own turns. Due after twenty turns."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "loanId"
            ],
            "properties": {
              "type": {
                "const": "repay"
              },
              "loanId": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "grant_free_city"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "cityId"
            ],
            "additionalProperties": false,
            "description": "Grant town liberties to a non-capital city with population 6 and a Market. Elected council, +15% gold, town purse and militia."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "revoke_free_city"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "cityId"
            ],
            "additionalProperties": false,
            "description": "Revoke town liberties, seize its purse and anger every resident family; outstanding town loans default."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "call_levy"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false,
            "description": "During a foreign war, call retained vassal troops for ten own turns. Loyalty and council consent apply."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "collect_city_debt"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "cityId"
            ],
            "additionalProperties": false,
            "description": "Demand that a free city repay wages the treasury advanced when its purse fell short; its purse pays what it holds, without grievance."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "collect_family_debt"
              },
              "familyId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "familyId"
            ],
            "additionalProperties": false,
            "description": "Demand that a lord's house repay wages the treasury advanced for its fiefs; its wealth pays what it holds, without grievance."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "refuse_fief_petition"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false,
            "description": "Refuse the house asking for a fief before it organizes: it gains 10 grievance and its bloc's crisis warning starts at once."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "grant_liberties"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false,
            "description": "Grant the Charter of Liberties: council consent, 20% dues, half crown grievances and electoral drift."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "revoke_liberties"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false,
            "description": "Revoke the Charter; aggrieved council families may resist."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "appoint_court"
              },
              "officeId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "familyId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "officeId",
              "familyId"
            ],
            "additionalProperties": false,
            "description": "Appoint a court family, paying a three-gold pension for office status and a national profession effect."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "dismiss_court"
              },
              "officeId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "officeId"
            ],
            "additionalProperties": false,
            "description": "Dismiss an unlocked court holder, costing ten grievance."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "sell_office"
              },
              "officeId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "familyId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "officeId",
              "familyId"
            ],
            "additionalProperties": false,
            "description": "Sell a court office for 200 gold with twenty-turn tenure."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "sell_office"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "familyId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "cityId",
              "familyId"
            ],
            "additionalProperties": false,
            "description": "Sell a governorship for 100 plus 20 gold per resident, with twenty-turn tenure."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "borrow"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "amount": {
                "type": "integer",
                "minimum": 1
              }
            },
            "required": [
              "type",
              "cityId",
              "amount"
            ],
            "additionalProperties": false,
            "description": "Borrow at most half a free city purse (minimum purse 100) at 10% per ten own turns, due after twenty turns."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "grant_project"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "projectId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "cityId",
              "projectId"
            ],
            "additionalProperties": false,
            "description": "Fund a self-governing city\u2019s next project for 25% of production cost in gold. Its leading family must be below its grievance threshold."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "override_city"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "cityId"
            ],
            "additionalProperties": false,
            "description": "Spend five political capital for control until one project completes."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "sponsor_games"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "cityId"
            ],
            "additionalProperties": false,
            "description": "Republic only: spend 20 + five per resident for two content over three future income phases and five governor-family patronage."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "grant_emergency_powers"
              },
              "familyId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "familyId"
            ],
            "additionalProperties": false,
            "description": "Republic at foreign war: spend twenty capital; a native family rules all cities for ten own turns, then may step down or attempt an autocratic coup."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "appoint_proconsul"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "familyId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "cityId",
              "familyId"
            ],
            "additionalProperties": false,
            "description": "Place a resident from the capturing house in a conquered nonvoting city\u2019s Government Quarters. Costs ten capital if self-governing."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "unitId",
              "cityId"
            ],
            "properties": {
              "type": {
                "const": "assign_fief_troop"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "description": "Assign an own crown military unit inside an own fief to its lord. Preserves health and spent actions; the lord commands it and pays upkeep. No civilian, cargo, loaded carrier or already private unit may be assigned."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "unitId",
              "cityId"
            ],
            "properties": {
              "type": {
                "const": "assign_town_militia"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "description": "Assign an own crown military unit inside an own free city to its militia. Preserves health and spent actions; the town commands it and pays upkeep with one unit supported free. No civilian, cargo, loaded carrier or already private unit may be assigned."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "offer_agreement"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "giveGoldPerTurn": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000
              },
              "giveLuxuries": {
                "type": "array",
                "maxItems": 7,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "enum": [
                    "gold",
                    "gems",
                    "silk",
                    "spices",
                    "furs",
                    "dyes",
                    "wine"
                  ]
                }
              },
              "getGoldPerTurn": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000
              },
              "getLuxuries": {
                "type": "array",
                "maxItems": 7,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "enum": [
                    "gold",
                    "gems",
                    "silk",
                    "spices",
                    "furs",
                    "dyes",
                    "wine"
                  ]
                }
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false,
            "description": "Propose ongoing gold per turn and/or improved luxury copies until either party cancels. Requires Writing, contact and peace. Each luxury must have an uncommitted physical source connected by roads, rails or Harbors to at least one receiving city; only those cities receive contentment. First payment on acceptance; later payments at payer income phases. War, default or loss of supply cancels the agreement. Revalidated on acceptance. Pending offers expire at sender next turn. Quote: relations[].agreementQuote or legal option canGive/canGet. Exporting the last copy removes its domestic bonus."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "accept_agreement"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false,
            "description": "Respond to or withdraw the pending agreement with this civilization. Acceptance makes the first payment and commits the named luxury copies."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "reject_agreement"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false,
            "description": "Respond to or withdraw the pending agreement with this civilization. Acceptance makes the first payment and commits the named luxury copies."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "withdraw_agreement"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false,
            "description": "Respond to or withdraw the pending agreement with this civilization. Acceptance makes the first payment and commits the named luxury copies."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "cancel_agreement"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "agreementId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId",
              "agreementId"
            ],
            "additionalProperties": false,
            "description": "Either partner can end this agreement immediately; committed copies become available again."
          },
          {
            "type": "object",
            "description": "Automate (remove forest): opt in to improvements that clear forest/rainforest. Human players can opt in at any technology level; AI workers cannot clear empty woods until Mechanized Agriculture, except single hexes for a city that grows too slowly. Woods holding a resource are cleared in every automation mode. Safe improvements remain available. Orders persist and can switch back to automate.",
            "properties": {
              "type": {
                "const": "automate_clear"
              },
              "unitId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "unitId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Propose sharing commercial city information and permission for food/production trade. Requires Writing, contact and peace; grants no military access.",
            "properties": {
              "type": {
                "const": "offer_trade_access"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Accept an incoming Trade Agreement; both partners can see city commercial figures.",
            "properties": {
              "type": {
                "const": "accept_trade_access"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Decline or withdraw a pending Trade Agreement.",
            "properties": {
              "type": {
                "const": "reject_trade_access"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "End commercial disclosure and every city contract between the partners. Previously paid deliveries remain in their receiving cities.",
            "properties": {
              "type": {
                "const": "cancel_trade_access"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "playerId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Set city export ceilings, protected food surplus, target food surplus/local production, and suggested prices. All fields are required. Existing contract prices are unchanged.",
            "properties": {
              "type": {
                "const": "set_trade_policy"
              },
              "cityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "foodLimit": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "productionLimit": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "foodReserve": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "foodTarget": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "productionTarget": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "foodPrice": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              },
              "productionPrice": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              },
              "protectFood": {
                "type": "boolean"
              }
            },
            "required": [
              "type",
              "cityId",
              "foodLimit",
              "productionLimit",
              "foodReserve",
              "foodTarget",
              "productionTarget",
              "foodPrice",
              "productionPrice",
              "protectFood"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Reserve one staffed Market trader in an own endpoint city. Trade quantity units of local food/production for quantity \u00d7 unitPrice gold per income phase. Domestic routes start immediately; foreign routes await acceptance. A city pair can have only one route/proposal.",
            "properties": {
              "type": {
                "const": "create_city_route"
              },
              "operatorCityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "sellerCityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "buyerCityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "good": {
                "enum": [
                  "food",
                  "production"
                ]
              },
              "quantity": {
                "type": "integer",
                "minimum": 1,
                "maximum": 20
              },
              "unitPrice": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              }
            },
            "required": [
              "type",
              "operatorCityId",
              "sellerCityId",
              "buyerCityId",
              "good",
              "quantity",
              "unitPrice"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Barter route: reserve one staffed Market trader in an own endpoint city. The seller city ships quantity units of good; the buyer city returns returnQuantity units of the other good (food \u2194 production) from its own export availability. No gold moves. Shortages on either side reduce both shipments in whole lots of the agreed ratio. Domestic routes start immediately; foreign routes await acceptance.",
            "properties": {
              "type": {
                "const": "create_city_route"
              },
              "operatorCityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "sellerCityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "buyerCityId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "good": {
                "enum": [
                  "food",
                  "production"
                ]
              },
              "quantity": {
                "type": "integer",
                "minimum": 1,
                "maximum": 20
              },
              "returnQuantity": {
                "type": "integer",
                "minimum": 1,
                "maximum": 20,
                "description": "Units of the other good (production for food, food for production) the buyer city returns each income phase instead of gold."
              }
            },
            "required": [
              "type",
              "operatorCityId",
              "sellerCityId",
              "buyerCityId",
              "good",
              "quantity",
              "returnQuantity"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Accept an incoming city contract or counteroffer, revalidating its supply, trader capacity, route and funds.",
            "properties": {
              "type": {
                "const": "accept_city_route"
              },
              "routeId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "routeId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Replace the quantity/price of an incoming pending gold route. The other participant must accept the new terms.",
            "properties": {
              "type": {
                "const": "counter_city_route"
              },
              "routeId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "quantity": {
                "type": "integer",
                "minimum": 1,
                "maximum": 20
              },
              "unitPrice": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              }
            },
            "required": [
              "type",
              "routeId",
              "quantity",
              "unitPrice"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Counter an incoming pending barter route with new quantities of both goods. The other participant must accept the new terms.",
            "properties": {
              "type": {
                "const": "counter_city_route"
              },
              "routeId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "quantity": {
                "type": "integer",
                "minimum": 1,
                "maximum": 20
              },
              "returnQuantity": {
                "type": "integer",
                "minimum": 1,
                "maximum": 20,
                "description": "Units of the other good (production for food, food for production) the buyer city returns each income phase instead of gold."
              }
            },
            "required": [
              "type",
              "routeId",
              "quantity",
              "returnQuantity"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Cancel, decline or withdraw a city route. Frees its trader; paid deliveries are not reversed.",
            "properties": {
              "type": {
                "const": "cancel_city_route"
              },
              "routeId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "type",
              "routeId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "playerId"
            ],
            "properties": {
              "type": {
                "const": "propose_deal"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "give": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "techIds": {
                    "type": "array",
                    "maxItems": 80,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    }
                  },
                  "gold": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "goldPerTurn": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "luxuries": {
                    "type": "array",
                    "maxItems": 80,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    }
                  },
                  "maps": {
                    "type": "boolean"
                  },
                  "warOn": {
                    "type": "array",
                    "maxItems": 80,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    }
                  },
                  "cities": {
                    "type": "array",
                    "maxItems": 80,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    }
                  },
                  "puppet": {
                    "type": "boolean",
                    "description": "true: you become the other leader's puppet state. Offered in quote.give as an item of kind puppet. A puppet is at war and at peace with whoever its master is, cannot declare war or make peace itself, is seen by its master without fog, and accepts every deal its master proposes. At war the deal must also hold the peace treaty."
                  }
                }
              },
              "get": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "techIds": {
                    "type": "array",
                    "maxItems": 80,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    }
                  },
                  "gold": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "goldPerTurn": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "luxuries": {
                    "type": "array",
                    "maxItems": 80,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    }
                  },
                  "maps": {
                    "type": "boolean"
                  },
                  "warOn": {
                    "type": "array",
                    "maxItems": 80,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    }
                  },
                  "cities": {
                    "type": "array",
                    "maxItems": 80,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    }
                  },
                  "puppet": {
                    "type": "boolean",
                    "description": "true: the other leader becomes your puppet state. Offered in quote.get as an item of kind puppet (with wars, the civilizations you would be at war with at once, and refused when a computer leader will not submit). From then on it accepts every deal you propose."
                  }
                }
              },
              "peace": {
                "type": "boolean"
              },
              "openBorders": {
                "type": "boolean"
              },
              "tradeAgreement": {
                "type": "boolean"
              },
              "message": {
                "type": "string",
                "minLength": 1,
                "maxLength": 280
              }
            },
            "description": "The single trade window. message is an optional note in your own words that a person receives with the proposal (a computer leader answers at once and ignores it); proposals from other leaders carry theirs in offer.message. give is what you offer and get what you ask for: technologies, lump-sum gold, gold per turn, luxuries per turn, maps, and wars declared at once on the listed civilizations (warOn). peace, openBorders and tradeAgreement are treaties binding both sides. The legal action's quote lists every available item with its gold value to the other leader, the attitude percent applied to your side, and refused items. A computer leader accepts at once when the adjusted value of give is at least the value of get, and otherwise the command is rejected with the difference; a person answers on their own turn. At war every deal must include peace. Per-turn terms last at least rules.deals.termRounds rounds. Each side may also list cities (city IDs from the quote's city items) that change hands at once with their land: never a capital, a fief or a free city; a computer leader takes a city at its full worth and gives one up only to end a war it is losing, or at peace with the buyer to pay for a war against another enemy at least as strong (refused otherwise). A city item carries worth: city (for being a city), people, buildings, land, location (port, border, heartland with their percent) and share (the part of the whole the receiver pays); value is the whole times share (rules.deals.city). A war declared under a deal (a warOn term) must last rules.diplomacy.minWarRounds rounds before peace can be made (the peace item carries lockedUntil until then); any other war can end at any time, though a computer leader signs a plain peace in a war's first minWarRounds rounds only when it is clearly losing (rules.diplomacy.aiLosingRatio, or a city it founded lost to this enemy) and otherwise asks a high price. After peace neither side can declare war for rules.diplomacy.minPeaceRounds rounds (the relation's lockedUntil). A hard-pressed computer leader may itself propose gold for a war on its enemy (rules.diplomacy.warHelp); such a proposal arrives as an ordinary offer with a message. A puppet item may be listed with refused when a civil war prevents it."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "playerId"
            ],
            "properties": {
              "type": {
                "const": "accept_deal"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "description": "Accept the deal this civilization proposed: you receive its give side and provide its get side."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "playerId"
            ],
            "properties": {
              "type": {
                "const": "reject_deal"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "description": "Decline the deal this civilization proposed."
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "playerId"
            ],
            "properties": {
              "type": {
                "const": "withdraw_deal"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "description": "Withdraw your own pending deal."
          }
        ],
        "description": "Use actions advertised in your legalActions. Commands are validated against your civilization\u2019s state."
      },
      "PurchaseAction": {
        "type": "object",
        "description": "After Currency, rush only the currently queued unit or building in an owned city. Pay the remaining production times the civilization\u2019s gold-per-production rate, normally four. Gold is charged and stock filled now; normal completion happens at the next own income phase, with no immediate unit or building. Each city can rush once per own turn and cannot switch the paid project until completion. Blocked population/deployment makes the paid project wait; there is no cancellation or refund. Wonders, Coinage and Space Program are excluded. Submit only the advertised action, without price or production metadata.",
        "properties": {
          "type": {
            "const": "purchase"
          },
          "cityId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "projectId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          }
        },
        "required": [
          "type",
          "cityId",
          "projectId"
        ],
        "additionalProperties": false
      },
      "PurchaseOption": {
        "type": "object",
        "description": "Owner-only rush option for the current queued unit/building, or no entry when ineligible. Unqueued projects, wonders, Coinage and Space Program are never offered. Funds, readiness, pending rush, population, deployment and other normal blockers appear in blockedReason. Fully funded or already paid projects can be shown at zero cost and unavailable.",
        "properties": {
          "projectId": {
            "type": "string"
          },
          "goldPerProduction": {
            "type": "number",
            "description": "Effective rate for this project, including civilization, Thrift, Mercenaries (military units only), and eligible project discounts. Arsenals and Horse Breeders do not discount purchases. goldCost is productionRemaining times this rate, rounded up."
          },
          "goldCost": {
            "type": "integer",
            "minimum": 0,
            "description": "Remaining production multiplied by the civilization\u2019s gold-per-production rate, normally four; zero only for an unavailable funded/pending project."
          },
          "available": {
            "type": "boolean"
          },
          "blockedReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "productionRemaining": {
            "type": "integer",
            "minimum": 0,
            "description": "Missing production for the currently queued project. Response metadata, not action input."
          }
        },
        "required": [
          "projectId",
          "goldCost",
          "available",
          "blockedReason",
          "productionRemaining"
        ],
        "additionalProperties": false
      },
      "TurnRequest": {
        "type": "object",
        "description": "revision is required in a sequential world. In a simultaneous world send round instead (revision is then ignored).",
        "properties": {
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "round": {
            "type": "integer",
            "minimum": 1,
            "description": "The round the request was made for. Required in a world of simultaneous turns unless the exact revision is sent."
          },
          "playerId": {
            "type": "string",
            "description": "Optional: your civilization. Refused with 409 seat_changed when it is no longer yours."
          },
          "cancelReady": {
            "type": "boolean",
            "description": "Simultaneous turns: true takes back Ready (actions empty, endTurn false)."
          },
          "requestId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{8,80}$"
          },
          "actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Action"
            },
            "maxItems": 24
          },
          "endTurn": {
            "type": "boolean"
          }
        },
        "required": [
          "requestId",
          "actions",
          "endTurn"
        ],
        "additionalProperties": false
      },
      "GameSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 48
          },
          "status": {
            "enum": [
              "waiting",
              "active",
              "finished"
            ]
          },
          "hostId": {
            "type": "string"
          },
          "you": {
            "type": [
              "string",
              "null"
            ],
            "description": "In your own listings: the player id of the side your account controls. Usually your account id; after a change of side or an imported world, another side's id."
          },
          "players": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RosterPlayer"
            },
            "maxItems": 12
          },
          "seats": {
            "type": "integer",
            "minimum": 2,
            "maximum": 12
          },
          "aiCount": {
            "type": "integer"
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "mapSize": {
            "type": "string",
            "enum": [
              "standard",
              "large",
              "huge"
            ],
            "default": "large"
          },
          "mapStyle": {
            "type": "string",
            "enum": [
              "continents",
              "pangaea",
              "archipelago"
            ],
            "default": "continents"
          },
          "round": {
            "type": "integer"
          },
          "maxRounds": {
            "type": "integer"
          },
          "difficulty": {
            "type": "string",
            "description": "The world's difficulty level; normal for worlds created before difficulty levels existed.",
            "enum": [
              "easy",
              "normal",
              "hard",
              "harder",
              "hardest"
            ]
          },
          "currentPlayerId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Sequential turns: the civilization whose turn it is. Simultaneous turns: in your own game detail, your civilization while you may give orders and null once you are Ready or the round is changing; null in lists."
          },
          "turnMode": {
            "type": "string",
            "enum": [
              "simultaneous"
            ],
            "description": "Present in a world of simultaneous turns; absent in a sequential one."
          },
          "pendingTurnMode": {
            "type": "string",
            "enum": [
              "sequential",
              "simultaneous"
            ],
            "description": "Present while the host's switch waits for the next round boundary."
          },
          "turnHours": {
            "type": "integer",
            "description": "Hours per turn; per round in a world of simultaneous turns."
          },
          "deadline": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix epoch milliseconds; null means no turn deadline."
          },
          "createdAt": {
            "type": "integer",
            "description": "Unix epoch milliseconds."
          },
          "updatedAt": {
            "type": "integer",
            "description": "Unix epoch milliseconds."
          },
          "expiresAt": {
            "type": "integer",
            "description": "Finished games only: Unix epoch milliseconds when the server deletes the game and its receipts, three days after it ended. Afterwards the game is absent from lists and GET /games/{id} returns 404."
          },
          "visibility": {
            "enum": [
              "public",
              "unlisted"
            ]
          },
          "uniqueCivilizations": {
            "type": "boolean",
            "description": "True for newly created lobbies, whose civilization choices must be unique. False for legacy saves; pre-existing duplicates remain assigned and playable. This is server-controlled and cannot be supplied on creation."
          },
          "availableCivilizations": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "uniqueItems": true,
            "description": "Unclaimed civilization IDs in a waiting lobby, excluding human and AI choices. Empty after the game starts. Recheck after a join conflict; this list is not a reservation."
          },
          "aiVersion": {
            "type": "string",
            "enum": [
              "r38",
              "r37",
              "r36",
              "r35",
              "r34",
              "r33",
              "r32",
              "r31",
              "r30",
              "r29",
              "r28",
              "r27",
              "r12"
            ],
            "default": "r38",
            "description": "Built-in AI version: R38 for everyone. Other values appear only in worlds where the developer account selected them."
          },
          "aiTurn": {
            "type": "object",
            "description": "Present while a durable background AI job exists. No hidden AI plans are exposed. In a sequential world nobody can act meanwhile. In a simultaneous world computer leaders think while people play: playerId is the leader being worked on (null between leaders), and roundChange true means the round is changing.",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "queued",
                  "running",
                  "failed"
                ]
              },
              "playerId": {
                "type": "string"
              }
            },
            "required": [
              "status",
              "playerId"
            ]
          },
          "barbarianLevel": {
            "type": "string",
            "enum": [
              "normal",
              "frequent"
            ],
            "default": "normal",
            "description": "Barbarian camp spawning: Normal every 15 rounds, Frequent every 10. Initial camps exist when the world starts."
          },
          "canEnableSimultaneous": {
            "type": "boolean",
            "description": "Whether the viewer may enable simultaneous turns based on the two-human requirement or developer override. Host permission is still required."
          }
        },
        "required": [
          "id",
          "name",
          "status",
          "hostId",
          "players",
          "seats",
          "aiCount",
          "revision",
          "mapSize",
          "mapStyle",
          "round",
          "maxRounds",
          "currentPlayerId",
          "turnHours",
          "deadline",
          "createdAt",
          "updatedAt",
          "visibility"
        ],
        "additionalProperties": false
      },
      "LegalOption": {
        "type": "object",
        "properties": {
          "action": {
            "$ref": "#/components/schemas/Action"
          },
          "expect": {
            "type": "string",
            "description": "Simultaneous turns, on attack, attack_city and bombard options: a token for what the attack would meet now. Add it to the action as expect and the attack is made only if that is unchanged when the order arrives (409 odds_changed otherwise). Optional."
          },
          "label": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "cost": {
            "type": "number"
          },
          "targetTileId": {
            "type": "string"
          },
          "movementCost": {
            "type": "number",
            "minimum": 0,
            "description": "Movement spent by this option; zero for connected railroad travel. Every move requires positive remaining movement, even when its cost is zero."
          },
          "via": {
            "type": "string",
            "description": "Present on move options: the hex the route enters tileId from (the unit's own hex for one step). Follow via through the unit's other move options back to its hex for the whole path the move takes."
          },
          "goldCost": {
            "type": "integer",
            "minimum": 1,
            "description": "Present for category purchase. Price metadata only; submit the nested action without adding this field."
          },
          "requiresTileId": {
            "type": "boolean",
            "description": "Present on goto options: the action is a template; add tileId with any known destination."
          },
          "requiresUnitIds": {
            "type": "boolean",
            "description": "The group template: add unitIds, two or more of your units on targetTileId."
          },
          "stackSize": {
            "type": "integer",
            "minimum": 1,
            "description": "Present on attack options: how many hostile units share the target tile."
          },
          "battle": {
            "type": "object",
            "description": "Present on attack options that lead to a battle (not on air strikes or on the capture of units that cannot fight): the preview a player sees before ordering the attack. The strengths are the ones the battle is fought with.",
            "properties": {
              "melee": {
                "type": "boolean",
                "description": "true: fought blow by blow until one unit falls. false: a single strike without retaliation."
              },
              "attacker": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "hp": {
                    "type": "integer"
                  },
                  "base": {
                    "type": "number",
                    "description": "Base strength."
                  },
                  "total": {
                    "type": "number",
                    "description": "The strength the battle is fought with: base \u00d7 (1 + the sum of bonuses \u00f7 100) \u00d7 every factor."
                  },
                  "bonuses": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string"
                        },
                        "percent": {
                          "type": "number"
                        }
                      }
                    },
                    "description": "Percentages of the base strength; they are added together."
                  },
                  "factors": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string"
                        },
                        "multiplier": {
                          "type": "number"
                        }
                      }
                    },
                    "description": "Conditions that scale the total: shaken troops, an attack from a ship, a rioting city."
                  },
                  "stackSize": {
                    "type": "integer",
                    "description": "Defender only: units on the target hex."
                  }
                }
              },
              "defender": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "hp": {
                    "type": "integer"
                  },
                  "base": {
                    "type": "number",
                    "description": "Base strength."
                  },
                  "total": {
                    "type": "number",
                    "description": "The strength the battle is fought with: base \u00d7 (1 + the sum of bonuses \u00f7 100) \u00d7 every factor."
                  },
                  "bonuses": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string"
                        },
                        "percent": {
                          "type": "number"
                        }
                      }
                    },
                    "description": "Percentages of the base strength; they are added together."
                  },
                  "factors": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string"
                        },
                        "multiplier": {
                          "type": "number"
                        }
                      }
                    },
                    "description": "Conditions that scale the total: shaken troops, an attack from a ship, a rioting city."
                  },
                  "stackSize": {
                    "type": "integer",
                    "description": "Defender only: units on the target hex."
                  }
                }
              },
              "chance": {
                "type": "number",
                "description": "Melee: the attacker\u2019s chance of landing each blow, attack \u00f7 (attack + defense) in whole percent."
              },
              "winChance": {
                "type": "number",
                "description": "Melee: the attacker\u2019s chance of winning the whole battle, computed exactly from the blow rule."
              },
              "expectedDealt": {
                "type": "integer"
              },
              "expectedReceived": {
                "type": "integer"
              },
              "damage": {
                "type": "integer",
                "description": "Single strike: the damage before the battle roll."
              },
              "notes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "atSeaRisk": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Present on move options for galleys to water with no known land beside it: the chance of being lost if the turn ends there."
          },
          "toType": {
            "type": "string",
            "description": "Present on upgrade options: the unit type after upgrading."
          },
          "gold": {
            "type": "integer",
            "minimum": 0,
            "description": "Pillage options: the gold this pillage pays (0 for pillage_own)."
          },
          "defenseless": {
            "type": "boolean",
            "description": "Attack options on units that cannot fight: there is no battle; each unit there is destroyed or captured."
          },
          "clearsForest": {
            "type": "boolean",
            "description": "Improve options on forest or rainforest: building it clears the woods, leaving the land beneath, and gives rules.clearing.production to the city whose borders hold the tile."
          },
          "requiresTerms": {
            "type": "boolean",
            "description": "This offer_trade option is a template; supply offered/requested terms before submitting."
          },
          "canGive": {
            "type": "object",
            "properties": {
              "techs": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "gold": {
                "type": "integer",
                "minimum": 0
              },
              "maps": {
                "$ref": "#/components/schemas/MapOffer"
              }
            },
            "required": [
              "techs",
              "gold"
            ],
            "additionalProperties": false
          },
          "canGet": {
            "type": "object",
            "properties": {
              "techs": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "gold": {
                "type": "integer",
                "minimum": 0
              },
              "maps": {
                "$ref": "#/components/schemas/MapOffer"
              }
            },
            "required": [
              "techs",
              "gold"
            ],
            "additionalProperties": false
          },
          "productionRemaining": {
            "type": "integer",
            "minimum": 0,
            "description": "Purchase option only: missing production for the queued project; metadata only, never action input."
          },
          "agreement": {
            "type": "object",
            "description": "The revalidated incoming pending agreement for accept_agreement; by, give/get, valid and reason. The option also includes canGive/canGet route quotes."
          }
        },
        "required": [
          "action",
          "label",
          "description",
          "category"
        ],
        "additionalProperties": false
      },
      "ProjectedState": {
        "type": [
          "object",
          "null"
        ],
        "description": "Fog-redacted engine view. tiles contains discovered coordinates only, visibility visible or explored; explored snapshots are stale. Own cities/units are complete; enemy and barbarian units appear only while visible. Barbarians are a permanently hostile non-player faction, not a player seat. Opponent economy, seed, hidden caches, global barbarian counts, spawn sites and private events are omitted. RULES and legalActions provide runtime catalogs. Null for a waiting lobby.",
        "properties": {
          "phase": {
            "enum": [
              "active",
              "finished"
            ]
          },
          "you": {
            "type": "string"
          },
          "currentPlayerId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Sequential turns: whose turn it is. Simultaneous turns: you while you may give orders, otherwise null."
          },
          "turnMode": {
            "type": "string",
            "enum": [
              "simultaneous"
            ],
            "description": "Present in a world of simultaneous turns."
          },
          "pendingTurnMode": {
            "type": "string",
            "enum": [
              "sequential",
              "simultaneous"
            ]
          },
          "simultaneous": {
            "type": "object",
            "description": "Simultaneous turns: the round's progress. phase is playing or closing (the last Ready is in and the round is about to change); ready is your own; waiting counts the civilizations not finished; civilizations lists every civilization you have met with status playing, ready or skipped (late: it plays as the round ends, the computer-led side of a civil war begun this round); others counts the rest.",
            "properties": {
              "phase": {
                "type": "string",
                "enum": [
                  "playing",
                  "closing"
                ]
              },
              "ready": {
                "type": "boolean"
              },
              "waiting": {
                "type": "integer"
              },
              "civilizations": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              "others": {
                "type": "object"
              }
            }
          },
          "round": {
            "type": "integer"
          },
          "turn": {
            "type": "integer"
          },
          "maxRounds": {
            "type": "integer",
            "description": "The round limit. A game played on after its end has none: this is then the current round plus 100."
          },
          "difficulty": {
            "type": "string",
            "description": "Present only when the world's difficulty is not normal. The bonuses (rules.difficulty) go to civilizations led by people on easy and to computer-led civilizations on hard, harder and hardest, following whoever leads a civilization at the moment.",
            "enum": [
              "easy",
              "hard",
              "harder",
              "hardest"
            ]
          },
          "continued": {
            "type": "object",
            "description": "Present once a finished game has been played on (POST /games/{id}/play-on): the round and turn it resumed at, and domination, true when a domination victory is among pastVictories and nothing ends the game any more.",
            "properties": {
              "round": {
                "type": "integer"
              },
              "turn": {
                "type": "integer"
              },
              "domination": {
                "type": "boolean"
              }
            }
          },
          "pastVictories": {
            "type": "array",
            "description": "Victories of a game that was played on, oldest first, each as victory was.",
            "items": {
              "type": "object"
            }
          },
          "map": {
            "type": "object",
            "properties": {
              "width": {
                "type": "integer"
              },
              "height": {
                "type": "integer"
              },
              "wrapX": {
                "const": true
              },
              "size": {
                "type": "string",
                "enum": [
                  "standard",
                  "large",
                  "huge"
                ],
                "default": "large"
              },
              "style": {
                "type": "string",
                "enum": [
                  "continents",
                  "pangaea",
                  "archipelago"
                ],
                "default": "continents"
              },
              "polarCaps": {
                "type": "boolean",
                "description": "True for worlds generated with permanent, impassable northern and southern ice caps. Absent in older saved worlds."
              }
            },
            "required": [
              "width",
              "height",
              "wrapX",
              "size",
              "style"
            ],
            "additionalProperties": false
          },
          "tiles": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "q",
                "r",
                "visibility"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "q": {
                  "type": "integer"
                },
                "r": {
                  "type": "integer"
                },
                "visibility": {
                  "enum": [
                    "visible",
                    "explored"
                  ]
                },
                "terrain": {
                  "type": "string",
                  "enum": [
                    "grassland",
                    "plains",
                    "desert",
                    "tundra",
                    "snow",
                    "forest",
                    "rainforest",
                    "hills",
                    "mountain",
                    "coast",
                    "ocean",
                    "lake",
                    "ice"
                  ]
                },
                "iceType": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "land",
                    "sea",
                    null
                  ],
                  "description": "Underlying frozen surface when terrain is ice; all ice is impassable."
                },
                "road": {
                  "type": "boolean",
                  "description": "Road on this known tile; city centers also connect roads. Explored tiles retain the last seen value."
                },
                "railroad": {
                  "type": "boolean",
                  "default": false,
                  "description": "Railroad upgrade over a road. Missing in legacy saves means false. Connected railroad tiles and city centers permit zero-cost land movement while the unit has positive remaining movement. Explored tiles retain the last seen value, never unseen upgrades."
                },
                "fortification": {
                  "type": "object",
                  "description": "Visible tiles only: the entrenchment on this hex. Every unit of ownerId defending here gets +value% defense. Fortified units raise it by up to 25 per owning turn (shared with wall repair), to 25 in the field or 50 in a city; it disappears when the owner's last unit leaves.",
                  "properties": {
                    "ownerId": {
                      "type": "string"
                    },
                    "value": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 50
                    }
                  }
                }
              }
            }
          },
          "players": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string",
                  "description": "Leader name. New worlds name computer leaders after their civilization\u2019s historical leader."
                },
                "civilization": {
                  "type": "string"
                },
                "civilizationName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "isAI": {
                  "type": "boolean"
                },
                "color": {
                  "type": "string"
                },
                "score": {
                  "type": "number"
                },
                "eliminated": {
                  "type": "boolean"
                },
                "met": {
                  "type": "boolean",
                  "description": "Whether your civilization has made contact. Diplomacy options need contact."
                },
                "temperament": {
                  "type": "string",
                  "description": "Computer leaders only: their temperament style from rules.civilizations[].temperament."
                },
                "attitude": {
                  "type": "string",
                  "description": "Met computer leaders only: Worshipful, Enthusiastic, Cordial, Receptive, Uncooperative, Icy or Belligerent."
                },
                "techs": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Only once met and after you know Writing."
                },
                "gold": {
                  "type": "integer",
                  "description": "Only once met and after you know Writing."
                },
                "government": {
                  "enum": [
                    "despotism",
                    "monarchy",
                    "republic",
                    "democracy",
                    "dictatorship"
                  ],
                  "description": "For civilizations you have met: their government, needed to interpret public military and policy effects."
                },
                "rulingFamilyId": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "For civilizations you have met: current ruling family identity. Election ledgers and governor appointments remain private."
                },
                "nationalPolicy": {
                  "type": "object",
                  "description": "For civilizations you have met: current policy strength and ruling-family trait IDs, so combat predictions use the same public bonuses as the server.",
                  "properties": {
                    "strength": {
                      "type": "integer",
                      "enum": [
                        1,
                        2
                      ]
                    },
                    "traits": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                },
                "rulingFamilyName": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "After contact: the current ruling family name, even when no family member is visible. This does not reveal a family census."
                }
              }
            },
            "description": "Civilization players only. Barbarians have no player seat and are absent from this array."
          },
          "units": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ownerId": {
                  "type": "string",
                  "description": "Civilization player ID, or the reserved non-player faction ID barbarians."
                },
                "isBarbarian": {
                  "type": "boolean",
                  "description": "True for a visible barbarian raider; omitted or false for civilization units."
                },
                "upgrade": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "description": "Your own units only: null when no successor is researched, otherwise {toType, goldCost, available, blockedReason}."
                },
                "settlementBlockedReason": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Own Settlers only: why the known site, cargo status or movement prevents founding, or null. Uses only known cities and camps. Cities must be at least four hexes apart and more than two hexes from a barbarian camp."
                },
                "disbandBlockedReason": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Your own units only: why this unit cannot be disbanded, or null."
                },
                "capacity": {
                  "type": "integer",
                  "description": "Carriers only: actual land-unit cargo capacity, including civilization bonuses and Larger Ships. Omitted for units without cargo slots."
                },
                "transportId": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Your own units only: the ship carrying this land unit, or null. Cargo shares the ship's tileId, cannot attack and is never visible to other civilizations."
                },
                "orders": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "description": "Your own units only: null, {type:\"goto\",tileId}, {type:\"explore\"}, or for automated workers {type:\"automate\"}, {type:\"automate_clear\"} or {type:\"automate_roads\"}, with optional tileId while walking to a chosen work site and, for the improvement modes, optional cityId of the city the crew is serving."
                },
                "route": {
                  "type": "object",
                  "description": "Your own units with go-to orders: {path:[tileId\u2026], turns} \u2014 the remaining planned route and how many more of your turns it needs (0 = this turn)."
                },
                "intercepted": {
                  "type": "boolean",
                  "description": "Your own fighters only: true after intercepting a raid, until your next turn."
                },
                "acted": {
                  "type": "boolean",
                  "description": "Your own units only: true once the unit has moved or acted this turn (fortifying does not count), until your next turn. A unit without it heals rules.healing as your turn ends only in your own territory."
                },
                "sleeping": {
                  "type": "boolean",
                  "description": "Your own units only: ordinary sleep lasts until your next turn; with healingSleep, sleep continues until fully healed."
                },
                "fortifying": {
                  "type": "boolean",
                  "description": "A Fortify, Sleep, Stand by or Sleep until healed order given this turn that takes hold at the start of the owner's next turn, when the unit becomes fortified and a land fighter's hex gains its fortification. Any other order, or wake, cancels it. Shown for every unit in sight."
                },
                "groupId": {
                  "type": "string",
                  "description": "Your own units only: the group this unit belongs to; units sharing it were grouped with the group order."
                },
                "familyId": {
                  "type": "string",
                  "description": "Principal recruiting family, preserved through capture and upgrades."
                },
                "ethnicityId": {
                  "type": "string",
                  "description": "Cultural identity; a change of political owner does not change it."
                },
                "appearanceSeed": {
                  "type": "integer",
                  "description": "Persistent public portrait seed.",
                  "minimum": 0,
                  "maximum": 4294967295
                },
                "citizenId": {
                  "type": "string",
                  "description": "Citizen identity retained by a settler when population is transferred."
                },
                "healingSleep": {
                  "type": "boolean",
                  "description": "Your own units only: sleeping and fortified until fully healed. Wakes at the next owning turn once health is full; absent on legacy saves."
                },
                "combatStats": {
                  "type": "object",
                  "description": "Derived combat values for own and visible units, never stored. Defense assumes no attacker-specific terrain cancellation and is zero when the unit cannot defend here. Bonus rows with scope 'terrain defense' add percentage points within one terrain factor, which multiplies other defensive bonuses. Forest/rainforest contributes 20 points, Forest dwellers adds 30, and national forest policy is added separately. Attack excludes conditional city-attack bonuses; cargo cannot fight until unloaded.",
                  "properties": {
                    "base": {
                      "type": "number"
                    },
                    "attack": {
                      "type": "number"
                    },
                    "defense": {
                      "type": "number"
                    },
                    "bombard": {
                      "type": "number"
                    },
                    "airStrength": {
                      "type": "number",
                      "description": "Legacy base air-combat strength, before directional character modifiers."
                    },
                    "bonuses": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "label": {
                            "type": "string"
                          },
                          "percent": {
                            "type": "number"
                          },
                          "scope": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "airAttack": {
                      "type": "number",
                      "description": "Interception attack strength for interceptors, including the Bold attack multiplier; omitted for other units."
                    },
                    "airDefense": {
                      "type": "number",
                      "description": "Aircraft defense against interception, including the Fearful defense multiplier."
                    }
                  }
                }
              }
            },
            "description": "Your own units and currently visible hostile/foreign units. Barbarian warriors have ownerId=\"barbarians\" and isBarbarian=true; their owner need not exist in players. Use advertised attack actions without a war declaration."
          },
          "cities": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "mayor": {
                  "enum": [
                    "military",
                    "economic"
                  ],
                  "description": "Your own cities only: the appointed mayor (see the mayor action); absent when you choose production yourself."
                },
                "focus": {
                  "enum": [
                    "balanced",
                    "food",
                    "production",
                    "gold",
                    "science",
                    "culture",
                    "manual"
                  ]
                },
                "workedTileIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Effective citizen assignments. City center base yields are automatic and use no citizen slot."
                },
                "yields": {
                  "type": "object",
                  "properties": {
                    "food": {
                      "type": "number"
                    },
                    "production": {
                      "type": "number"
                    },
                    "gold": {
                      "type": "number"
                    },
                    "science": {
                      "type": "number"
                    },
                    "culture": {
                      "type": "number"
                    }
                  },
                  "description": "Gross yield; city food consumption is two per population each owning turn."
                },
                "unassignedPopulation": {
                  "type": "integer",
                  "minimum": 0
                },
                "borderGrowth": {
                  "type": "object",
                  "description": "Local border expansion for own or inspectable cities. Costs include civilization and tradition bonuses. Progress is between the previous and next thresholds for the actual retained radius; null at the current maximum. Turns are upcoming owning income phases at current culture output (minimum one), null when stalled or at maximum. Omitted from ordinary foreign snapshots.",
                  "properties": {
                    "previousCulture": {
                      "type": "number"
                    },
                    "nextCulture": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "nextRadius": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "maxRadius": {
                      "type": "integer"
                    },
                    "progress": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "minimum": 0,
                      "maximum": 1
                    },
                    "turnsRemaining": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 1
                    }
                  }
                },
                "productionTurnsRemaining": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "minimum": 1,
                  "description": "Estimated upcoming owning turns at current production, with a minimum of one. Null for no project or blocked production. Not wall-clock time or individual opponents\u2019 turns."
                },
                "productionBlockedReason": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Reason the current project cannot complete now; otherwise null."
                },
                "purchaseOptions": {
                  "type": "array",
                  "description": "Owner-only current-project rush option; empty before Currency or when no queued unit/building qualifies. Omitted from foreign city snapshots.",
                  "items": {
                    "$ref": "#/components/schemas/PurchaseOption"
                  }
                },
                "workableTiles": {
                  "type": "array",
                  "description": "Known tiles within two wrapped hexes, including unavailable tiles with an explanation. available means a legal assign/unassign action can be performed if it is your turn. Manual cities retain choices across turns; automatic focus recalculates them.",
                  "items": {
                    "type": "object",
                    "properties": {
                      "tileId": {
                        "type": "string"
                      },
                      "q": {
                        "type": "integer"
                      },
                      "r": {
                        "type": "integer"
                      },
                      "terrain": {
                        "type": "string"
                      },
                      "worked": {
                        "type": "boolean"
                      },
                      "occupied": {
                        "type": "boolean",
                        "description": "Enemy occupation, naval blockade or lack of a valid three-step path from this city prevents working this tile. Includes inaccessible tiles for compatibility; does not imply a unit stands here."
                      },
                      "inaccessible": {
                        "type": "boolean",
                        "description": "No valid path of at most three hex steps from this city center, excluding direct enemy occupation and direct naval blockade. Land paths stay on land; water paths enter adjacent water directly and stay on water. Does not reveal hidden blockers."
                      },
                      "blockaded": {
                        "type": "boolean",
                        "description": "An enemy naval unit blocks this hex or an adjacent hex. Economic restriction only; does not reveal the ship."
                      },
                      "available": {
                        "type": "boolean"
                      },
                      "reason": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "yields": {
                        "type": "object",
                        "properties": {
                          "food": {
                            "type": "number"
                          },
                          "production": {
                            "type": "number"
                          },
                          "gold": {
                            "type": "number"
                          },
                          "science": {
                            "type": "number"
                          },
                          "culture": {
                            "type": "number"
                          }
                        },
                        "description": "Gross yield; city food consumption is two per population each owning turn."
                      },
                      "citizenId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Citizen assigned to this tile, or null. The city center requires no citizen."
                      }
                    },
                    "required": [
                      "tileId",
                      "worked",
                      "available",
                      "yields",
                      "reason"
                    ]
                  }
                },
                "productionKind": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Kind of project owning the city\u2019s stored production. Capture clears it to null with the queue and stock."
                },
                "centerResource": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Your own cities: the resource under the city center, collected in full."
                },
                "centerYields": {
                  "type": "object",
                  "description": "Your own cities: what the center resource and its improvement bonus add."
                },
                "airlifted": {
                  "type": "boolean",
                  "description": "Your own cities: true once a unit has been airlifted out this turn."
                },
                "walls": {
                  "type": "boolean",
                  "description": "City Walls or Great Wall protection exists; its remaining defensive bonus is fortificationDefense. Fog retains the last observed value."
                },
                "citizens": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Citizen"
                  },
                  "description": "Owned cities only: one entry per population point, including idle and unhappy citizens. Never included in foreign city snapshots."
                },
                "happiness": {
                  "$ref": "#/components/schemas/CityHappiness"
                },
                "workedDistrictIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Owner-only district jobs, one entry per worker in the order added. Each consumes one content citizen, instead of a tile job."
                },
                "citizenAssignments": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CitizenAssignment"
                  },
                  "description": "Owner-only citizen-to-job bindings; each assigned citizen works exactly one tile or district slot."
                },
                "districts": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CityDistrict"
                  },
                  "description": "Owner-only districts with their buildings, slots, workers and per-worker output. Buildings outside districts are passive."
                },
                "isCapital": {
                  "type": "boolean",
                  "description": "Public current-capital marker, retained as last seen on remembered cities. Distinct from capitalFor, the preserved original-capital victory marker."
                },
                "governorCitizenId": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Your own cities only: the resident governor, or null. Palace governors are automatic and must belong to the ruling family; manual appointment, replacement and dismissal are rejected. Completion (including a rushed Palace completed on a later own turn), ruling-family change or capital relocation selects a local resident, otherwise transfers a real citizen from an owned city with more than one resident. A one-person donor instead exchanges its resident with a capital citizen. Existing incorrect or vacant Palaces are repaired on accepted mutations, never by reads or receipt replay. Government Quarters use manual appointments. If no ruling-family civilian exists, the Palace remains temporarily vacant and retries on accepted mutations. An ineligible prior governor is removed; units and dynasties are unchanged."
                },
                "governorActive": {
                  "type": "boolean",
                  "description": "Your own cities only: the governor actually staffs the Palace or Government Quarters. Republic, Democracy and Dictatorship each add one local content slot for any active governor. Before personal traits and city-wide percentages, their office yields in gold/science/production/culture order are 3/3/1/1, 4/4/1/2 and 2/1/4/1 respectively."
                },
                "governorOptions": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GovernorOption"
                  },
                  "description": "Your own cities only: resident appointment choices with availability and blockers. Palace choices are unavailable because its governor is selected automatically from the ruling family. Names and IDs are not exposed through foreign city snapshots."
                },
                "governmentYieldModifiers": {
                  "type": "object",
                  "properties": {
                    "governmentId": {
                      "enum": [
                        "despotism",
                        "monarchy",
                        "republic",
                        "democracy",
                        "dictatorship"
                      ]
                    },
                    "rounding": {
                      "const": "floor_per_city"
                    },
                    "before": {
                      "type": "object",
                      "properties": {
                        "food": {
                          "type": "number"
                        },
                        "production": {
                          "type": "number"
                        },
                        "gold": {
                          "type": "number"
                        },
                        "science": {
                          "type": "number"
                        },
                        "culture": {
                          "type": "number"
                        }
                      }
                    },
                    "after": {
                      "type": "object",
                      "properties": {
                        "food": {
                          "type": "number"
                        },
                        "production": {
                          "type": "number"
                        },
                        "gold": {
                          "type": "number"
                        },
                        "science": {
                          "type": "number"
                        },
                        "culture": {
                          "type": "number"
                        }
                      }
                    },
                    "militaryProductionBonus": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "rulerPenalty": {
                      "type": "object",
                      "description": "Present while a Power-hungry family rules: gold and culture actually removed from this city after government multipliers (already excluded from city yields).",
                      "properties": {
                        "familyId": {
                          "type": "string"
                        },
                        "gold": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "culture": {
                          "type": "integer",
                          "minimum": 0
                        }
                      }
                    }
                  },
                  "description": "Owner-only city output explanation. Before/after are complete output maps; after includes government and transition multipliers. Office job projections precede city-wide percentages. militaryProductionBonus is this income phase\u2019s restricted bonus, available for all unit projects."
                },
                "militaryProduction": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Owner-only portion of current production stock restricted to unit projects. All units, including Scout/Worker/Settler, can use it. Changing to a non-unit project discards this portion with production_lost reason military_bonus; ordinary stock obeys the existing project-kind rule. Missing on legacy saves means zero."
                },
                "rush": {
                  "type": "object",
                  "properties": {
                    "projectId": {
                      "type": "string"
                    },
                    "productionBought": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "goldCost": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "purchasedOwnTurn": {
                      "type": "integer",
                      "minimum": 0
                    }
                  },
                  "description": "Owner-only pending paid production; absent when no rush is pending. Production is filled immediately, while completion waits for a subsequent own income phase. Queue changes and further purchases are locked. A blocked project waits without refund/cancellation; successful completion or capture removes this marker."
                },
                "productionLockedReason": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Owner-only reason a pending paid project cannot be changed; null when unlocked. Foreign snapshots omit this field."
                },
                "projectId": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Own city current production project. Capture clears the queue to null and discards stock/rush; the new owner chooses a project."
                },
                "fortificationDefense": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 100,
                  "description": "Remaining wall defense bonus in percentage points, shown on the city banner. Zero without walls or when fully breached."
                },
                "populationCap": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "Own cities: the largest population this city can grow to. 6, or 12 for a city on a river or beside a lake; 12 with an intact Aqueduct that has a fresh-water hex in reach (freshWaterNearby); null (no upper population limit) with an intact Sewer while the city has water. A cut canal or enemy occupation of the Aqueduct intake or waterway can therefore lower it back to 6. At the limit the food store fills to the growth requirement and waits. A city already above its limit keeps its people, unless its Aqueduct has run dry (waterDeficit); a settler cannot join a city at its limit."
                },
                "waterDeficit": {
                  "type": "integer",
                  "description": "Present on a city above 6 whose Aqueduct has no fresh water left in reach (a cut canal, lost intake land, or enemy occupation of its fixed waterway): yields.food is capped at population \u00d7 2 \u2212 waterDeficit whatever the city grows or imports, so it loses this much stored food every turn and then a citizen a turn, until it has starved down to 6. Absent otherwise; a damaged Aqueduct and one from before the fresh-water rules do not cause it. Also applies when Seafaring Harbor water is cut and no local source or working Aqueduct remains, even without an Aqueduct or after losing/selling the Harbor. Restoring supply ends the deficit immediately."
                },
                "freshWaterLocal": {
                  "type": "boolean",
                  "description": "Own cities: independent natural fresh water at the city center (river or lake shore); excludes imported Harbor water."
                },
                "harborWater": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "description": "Seafaring supply report for own or inspectable cities. Only independent local sources and working Aqueducts supply the network. Listed cities belong to the same owner.",
                  "properties": {
                    "supplied": {
                      "type": "boolean"
                    },
                    "dependent": {
                      "type": "boolean"
                    },
                    "sourceCityIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "connectedCityIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Current domestic Harbor-network connections; preserves actual interruptions in public economic forecasts."
                    },
                    "reason": {
                      "enum": [
                        null,
                        "harbor_unavailable",
                        "no_source",
                        "connection_cut"
                      ]
                    }
                  }
                },
                "freshWater": {
                  "type": "boolean",
                  "description": "Own cities: fresh water is present locally (freshWaterLocal) or supplied by the Seafaring Harbor network (harborWater). The city grows to 12 without an Aqueduct and may build a Sewer."
                },
                "aqueduct": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "description": "Built Aqueduct: fixed route from the nearest supplying fresh-water intake to the city center, with supplied and damaged flags. Enemy occupation of any route hex interrupts supply. Foreign map sightings expose this only when the complete route is visible.",
                  "properties": {
                    "route": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "supplied": {
                      "type": "boolean"
                    },
                    "damaged": {
                      "type": "boolean"
                    }
                  }
                },
                "freshWaterNearby": {
                  "type": "boolean",
                  "description": "Own cities: a fresh-water hex (a river hex, or a non-lake hex beside a lake) lies among the hexes the city can work (within two hexes, inside its owner's borders). Required to build an Aqueduct; without it (and without freshWater) the city stays at 6."
                },
                "growthBlockedBy": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Present only when the city is at its size limit: the building that raises it (aqueduct or sewer), fresh_water when no building can (no fresh-water hex among the city's workable hexes), or null at the final limit."
                },
                "rioting": {
                  "type": "boolean",
                  "description": "Outside Democracy, at least 25% unhappy residents. Gold, science and all production output are zero, including Government Quarters construction. Paid content-producing buildings, including Government Quarters, can finish on the next own turn. Food, culture and content services continue. Riots end below 25%; idle content citizens do not change the threshold. Democracy uses its separate strike rule."
                },
                "riot": {
                  "type": "object",
                  "description": "Unhappy count, population, percentage, threshold (0.25), rule (unhappy_at_least_quarter), consecutive income phases and suppressed city yields."
                },
                "lastRiotRound": {
                  "type": "integer",
                  "description": "Latest round in which this city was observed rioting; unrest affects rebellion support for ten rounds."
                },
                "rebellionContent": {
                  "type": "object",
                  "description": "Four extra content slots while this exact rebellion remains active and owns the city, for at most twenty rebel own turns.",
                  "properties": {
                    "conflictId": {
                      "type": "string"
                    },
                    "ownerId": {
                      "type": "string"
                    },
                    "untilOwnTurn": {
                      "type": "integer"
                    }
                  }
                },
                "reliefTurns": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 3
                },
                "damagedBuildings": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Built ordinary buildings disabled by siege. Missing means none. Owned or inspected cities only; preserved through capture. Repair through produce with projectId repair_BUILDING_ID."
                },
                "intactBuildingCount": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Number of intact ordinary buildings available for siege damage once walls and entrenchment are zero. Visible cities show the current count; fog retains the last observed count."
                },
                "tradeIntel": {
                  "type": "object",
                  "description": "Foreign cities linked to one of your cities by a working city-trade route (active, not blocked, both cities still owned by the route's parties) in either direction. Missing otherwise.",
                  "properties": {
                    "units": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Exact number of the owner's units stationed in the city, excluding cargo."
                    },
                    "strengthEstimate": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Estimated combined defensive strength of those units in this city (walls, terrain, fortification and health included), within strengthMargin of the true value. The error is fixed per observer and city for five of the observer's own turns."
                    },
                    "strengthMargin": {
                      "type": "number",
                      "description": "Maximum relative error of strengthEstimate (0.25)."
                    },
                    "buildings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Building ids in the city."
                    },
                    "wonders": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Wonder ids in the city."
                    }
                  }
                },
                "fortification": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Total fortification shown on the city banner: fortificationDefense (walls) plus the owner's entrenchment on the city hex while it is in sight."
                },
                "familyGold": {
                  "type": "object",
                  "description": "Current job-income forecast for owned or inspected cities. yields.gold remains the treasury share.",
                  "properties": {
                    "taxRate": {
                      "type": "number",
                      "minimum": 0
                    },
                    "jobGoldMultiplier": {
                      "type": "number",
                      "minimum": 0
                    },
                    "calibrationGold": {
                      "type": "number",
                      "minimum": 0
                    },
                    "privateGold": {
                      "type": "number",
                      "minimum": 0
                    },
                    "treasuryGold": {
                      "type": "number",
                      "minimum": 0
                    },
                    "families": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "familyId": {
                            "type": "string"
                          },
                          "work": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "taxesPaid": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "corruption": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "gross": {
                            "type": "number"
                          }
                        }
                      }
                    }
                  }
                },
                "benefactions": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  },
                  "description": "Building ID to contributing family ID."
                },
                "localYields": {
                  "type": "object",
                  "description": "Own/inspected city only: actual output before city trade, including ordinary workplace yields from traders assigned to routes."
                },
                "tradeBalance": {
                  "type": "object",
                  "description": "Own/inspected city only: net food, production and gold transfers and import/export quantities. Gold is an accounting attribution, not newly generated income."
                }
              }
            },
            "description": "Owned cities include economy and management data, including happiness and its detailed breakdown. Foreign cities contain only public visible or remembered snapshots; management properties are owner-only. Unhappy citizens eat but work no tile and contribute no city science."
          },
          "self": {
            "type": "object",
            "description": "Your own player record and derived management details, including civilizationName, techs, gold, research, government, rulingFamilyId, capitalId, governmentDetails and turnEndSeq. Private authoritative election ledgers and random counters are not public APIs.",
            "properties": {
              "government": {
                "enum": [
                  "despotism",
                  "monarchy",
                  "republic",
                  "democracy",
                  "dictatorship"
                ]
              },
              "rulingFamilyId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "capitalId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "governmentDetails": {
                "$ref": "#/components/schemas/GovernmentDetails"
              },
              "successionNotices": {
                "type": "array",
                "description": "Owner-only government_succession event snapshots retained until the owner ends their turn, surviving event-feed rollover. Optional on older saves. Never exposed to opponents.",
                "items": {
                  "$ref": "#/components/schemas/SuccessionResult"
                }
              },
              "familyDevelopment": {
                "type": "object",
                "description": "Owner-only Renaissance development state; starts on first Renaissance technology, or next owning turn for legacy games.",
                "properties": {
                  "startedOwnTurn": {
                    "type": "integer"
                  },
                  "techId": {
                    "type": "string"
                  },
                  "notice": {
                    "type": "object",
                    "description": "Retained family_development_started event with id, seq, turn, round, kind, text and techId."
                  }
                }
              },
              "internalPolitics": {
                "$ref": "#/components/schemas/InternalPolitics"
              },
              "internalNotices": {
                "type": "array",
                "items": {
                  "type": "object"
                },
                "description": "Retained private political warnings, outbreak and settlement announcements until the owner ends their turn."
              },
              "researchBonus": {
                "$ref": "#/components/schemas/ResearchBonus"
              },
              "researchBonuses": {
                "type": "object",
                "description": "Owner-only previews for currently researchable unlearned technologies plus the active target; locked future technologies are omitted.",
                "additionalProperties": {
                  "$ref": "#/components/schemas/ResearchBonus"
                }
              },
              "familyTaxRate": {
                "type": "integer",
                "minimum": 0,
                "description": "Current national percentage on job gold, within the government band; legacy saves use the default."
              },
              "privateGoldPerTurn": {
                "type": "integer",
                "minimum": 0,
                "description": "Private work income forecast across owned cities."
              },
              "officeStipends": {
                "type": "integer",
                "minimum": 0,
                "description": "Scheduled office expense included in goldPerTurn; unfunded stipends are skipped."
              },
              "wealthEconomy": {
                "$ref": "#/components/schemas/FamilyEconomy"
              },
              "electoralDetails": {
                "$ref": "#/components/schemas/ElectoralDetails"
              },
              "luxuryResources": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/LuxuryInventory"
                }
              },
              "luxurySupply": {
                "type": "array",
                "description": "Own-city luxury totals. Each connected physical copy counts once, even when supplying multiple cities. Excludes exported, unimproved and disconnected domestic sources; imports require an active receiving route. Individual city connectivity still applies.",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "domestic",
                    "imported",
                    "available"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "domestic": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "imported": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "available": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Domestic plus imported copies."
                    }
                  }
                }
              },
              "agreementIncome": {
                "type": "integer",
                "minimum": 0,
                "description": "Expected gold receipts per round; actual transfers occur at the payer income phase."
              },
              "agreementExpenses": {
                "type": "integer",
                "minimum": 0,
                "description": "Gold per income phase paid under active agreements; included in net goldPerTurn."
              },
              "luxuryTrade": {
                "type": "object",
                "description": "Safe inputs for public economic forecasts: own exported source IDs and importsByCity resource IDs. blockadedDomesticByCity lists domestic resource IDs currently unavailable to each owned city due to naval blockades. No foreign source or hidden ship coordinates."
              }
            }
          },
          "events": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "turn": {
                  "type": "integer"
                },
                "round": {
                  "type": "integer"
                },
                "text": {
                  "type": "string"
                },
                "tileId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "kind": {
                  "type": "string",
                  "description": "Event type, for example unit_destroyed, unit_captured, unit_withdrew, purchase, combat, city_captured, city_plundered, pillage, forest_cleared, contact, diplomacy, production_lost, wonder_lost, unit_expelled, unit_rebased, unit_airlifted, tech_discovered. Absent on legacy events. family_trait_acquired announces a trait privately to civilizations with current members of the family. settler_joined_city announces joining privately to the city owner. palace_governor_appointed and palace_governor_unavailable are owner-only automatic Palace notices; transfers never become public citizen or donor-city information. war_weariness_changed reports a private change to democratic war weariness."
                },
                "cityId": {
                  "type": "string",
                  "description": "The city of a purchase, city_captured, city_plundered or forest_cleared event."
                },
                "projectId": {
                  "type": "string",
                  "description": "Queued unit/building rushed by a purchase event, or the project in a completion event."
                },
                "goldCost": {
                  "type": "integer",
                  "minimum": 1,
                  "description": "Gold spent in this owner-only purchase event."
                },
                "unitId": {
                  "type": "string",
                  "description": "Destroyed unit ID on unit_destroyed entries; the captured unit on unit_captured; the capturing unit on city_captured; the raider on city_plundered; the pillager on pillage."
                },
                "unitType": {
                  "type": "string"
                },
                "newType": {
                  "type": "string",
                  "description": "unit_captured: the type the unit has now (a captured Settler becomes a Worker)."
                },
                "ownerId": {
                  "type": "string",
                  "description": "The civilization the event concerns: the owner of a destroyed unit, the new owner of a captured city, the city owner for city_plundered, and the owner of the pillaged tile for pillage."
                },
                "fromOwnerId": {
                  "type": "string",
                  "description": "city_captured: the civilization that lost the city; unit_captured: the unit's former owner. ownerId is the new owner."
                },
                "gold": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "city_plundered: gold barbarians took from the owner, rules.barbarians.plunderPerCitizen per citizen as far as the treasury goes. pillage: gold the pillager received."
                },
                "improvement": {
                  "enum": [
                    "farm",
                    "mine",
                    "pasture",
                    "plantation",
                    "camp",
                    "canal",
                    "fishing_boats",
                    "road",
                    "railroad"
                  ],
                  "description": "Improvement built, or pillaged. Pillaging railroad removes only the rails and preserves the road."
                },
                "healed": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "pillage: health the pillager regained through living off the land, up to rules.pillage.heal (25). Pillage is the only recovery allowed in enemy territory."
                },
                "terrain": {
                  "type": "string",
                  "description": "forest_cleared: the woods that were cleared."
                },
                "becomes": {
                  "type": "string",
                  "description": "forest_cleared: the terrain left."
                },
                "production": {
                  "type": "integer",
                  "description": "forest_cleared: production the city gained."
                },
                "seq": {
                  "type": "integer",
                  "description": "Increasing sequence number; compare with state.self.turnEndSeq to find events since your previous turn."
                },
                "combat": {
                  "type": "object",
                  "description": "Unit combat carries attacker, defender, ranged, dealt, received and outcome, with actual hp before/after. Air strikes add air:true; interceptions add intercept:true and siteTileId. Fortification bombardment events have kind:fortifications_bombarded and combat.siege:true; their city or defender animation hp represents defense points, never unit health. Outcomes are fortifications_damaged, fortifications_breached or building_damaged; building damage adds damagedBuildingId to the event. Melee combat adds fortificationWear:{before,after,wallDamage}, reporting 10 percentage points of wall-first defense wear after combat regardless of outcome."
                },
                "reason": {
                  "type": "string",
                  "description": "production_lost: idle, switch or military_bonus (discarded government unit-production bonus on switching to a non-unit project). family_loyalty_changed: birth for a newborn joining a loyal branch, or allegiance for a turn-start transfer."
                },
                "lost": {
                  "type": "integer",
                  "description": "production_lost and wonder_lost: production lost."
                },
                "familyId": {
                  "type": "string",
                  "description": "family_branch_formed: the new family branch. family_loyalty_changed: the citizen's destination family. family_trait_acquired: the earning family. settler_joined_city: the joining citizen family."
                },
                "fromFamilyId": {
                  "type": "string",
                  "description": "family_loyalty_changed: the selected parent family or the existing citizen's previous family."
                },
                "citizenId": {
                  "type": "string",
                  "description": "family_loyalty_changed: the newborn or transferred citizen. Existing citizens retain this ID. settler_joined_city preserves the settler citizen ID."
                },
                "loyalToPlayerId": {
                  "type": "string",
                  "description": "The ruler supported by the political branch. Political family events are private to the current city owner."
                },
                "parentFamilyId": {
                  "type": "string",
                  "description": "family_branch_formed: the immediate parent family."
                },
                "traitId": {
                  "type": "string",
                  "description": "family_trait_acquired: earned rule ID."
                },
                "traitKind": {
                  "enum": [
                    "dwelling",
                    "profession",
                    "character",
                    "feat"
                  ],
                  "description": "family_trait_acquired: the filled family slot."
                },
                "fromCityId": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Automatic Palace appointment only: the owned donor city if a resident transferred, otherwise null. Owner-only."
                },
                "transferred": {
                  "type": "boolean",
                  "description": "Automatic Palace appointment only: true when an existing citizen moved from another owned city; false for local reappointment. Owner-only."
                },
                "retainedCitizenId": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Palace appointment unavailable only: null. An ineligible prior Palace governor is removed; no citizen is fabricated."
                },
                "previousCitizenId": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Palace appointment unavailable only: the ineligible prior governor removed from the office, or null. Owner-only."
                },
                "swapped": {
                  "type": "boolean",
                  "description": "Automatic Palace appointment only: true if a one-person donor exchanged its ruling-family resident with a capital resident, preserving both city populations. Owner-only."
                },
                "swappedCitizenId": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Automatic Palace appointment only: the capital citizen moved to the one-person donor in an exchange, otherwise null. Owner-only."
                },
                "penalty": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 4,
                  "description": "war_weariness_changed only: new democratic content penalty, private to the owning civilization. Only actual penalty changes emit this event."
                },
                "productionBought": {
                  "type": "integer",
                  "minimum": 1,
                  "description": "Purchase event: missing production paid for now, with completion deferred to an own income phase."
                },
                "previousFamilyId": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Owner-only government_election: incumbent family before the saved ballot result."
                },
                "performance": {
                  "$ref": "#/components/schemas/ElectionPerformance"
                },
                "totalVotes": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Owner-only government_election: actual first-round eligible ballots, never the sum of all rounds."
                },
                "candidates": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ElectionCandidate"
                  },
                  "description": "Owner-only government_election: saved first-round candidates, votes and campaign swings. Use rounds for runoff votes; winnerFamilyId identifies the final winner."
                },
                "completion": {
                  "const": "next_own_turn",
                  "description": "Purchase event: payment filled stock, with completion deferred to an own income phase."
                },
                "winnerFamilyId": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Owner-only government_election: final winning family, or null if no voters are eligible."
                },
                "initial": {
                  "type": "boolean",
                  "description": "Owner-only government_election: whether this was an inaugural election."
                },
                "rounds": {
                  "type": "array",
                  "maxItems": 2,
                  "items": {
                    "$ref": "#/components/schemas/ElectionRound"
                  },
                  "description": "Owner-only government_election. Both recorded rounds, or one for an immediate first-round victory. Empty if no voters are eligible. Omitted in older results."
                },
                "runoff": {
                  "type": "boolean",
                  "description": "Owner-only government_election. Whether a second round was held."
                },
                "finalRound": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "enum": [
                    1,
                    2,
                    null
                  ],
                  "description": "Owner-only government_election. Winning round, or null when no voters are eligible."
                },
                "electorate": {
                  "$ref": "#/components/schemas/ElectionElectorate",
                  "description": "Owner-only government_election. Current electorate snapshot saved when the election occurred."
                },
                "status": {
                  "enum": [
                    "elected",
                    "no_eligible_voters"
                  ],
                  "description": "Owner-only government_election. No eligible voters records an empty ballot and leaves the current ruler unchanged; winnerFamilyId is null."
                },
                "familyGold": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "The portion of this loot reward paid into the unit family purse."
                },
                "treasuryGold": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "The portion of this loot reward paid into the state treasury."
                }
              }
            },
            "description": "Authorized events in chronological order (oldest first, at most 100). Compare IDs, not turn numbers, for unread markers: several events may occur in one turn. No hidden enemy history is included."
          },
          "rules": {
            "$ref": "#/components/schemas/Rules"
          },
          "victory": {
            "type": [
              "object",
              "null"
            ]
          },
          "barbarians": {
            "type": "object",
            "description": "Public barbarian faction and frequency settings only. Initial guarded camps are placed at world creation on suitable unexplored land, at least five wrapped hexes from all civilization units and cities. Camps spawn a Warrior every 15 rounds on Normal or 10 on Frequent; some muster three raiders. Raiders gather beside their target city and assault regardless of odds, also fighting defenders blocking the approach. Barbarians opportunistically pillage improvements, then railroads and roads on their occupied non-city hex, including unclaimed land, while movement remains; ordinary pillage movement cost and up to 25 HP healing apply. At the start of each barbarian phase, all barbarians in a surviving village recover 20 HP, capped at full health. Optional field diversions and camp-guard sorties still require above 80% victory odds. Polling never advances them. Camp counts, locations and schedules remain hidden unless observed.",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "id": {
                "const": "barbarians"
              },
              "name": {
                "type": "string"
              },
              "color": {
                "type": "string"
              },
              "level": {
                "type": "string",
                "enum": [
                  "normal",
                  "frequent"
                ],
                "default": "normal",
                "description": "Barbarian camp spawning: Normal every 15 rounds, Frequent every 10. Initial camps exist when the world starts."
              },
              "raidInterval": {
                "type": "integer",
                "enum": [
                  10,
                  15
                ]
              }
            },
            "required": [
              "enabled",
              "id",
              "name",
              "color",
              "level",
              "raidInterval"
            ],
            "additionalProperties": false
          },
          "wonders": {
            "type": "array",
            "description": "World wonders completed anywhere: {id, ownerId, round}; your own entries also carry cityId. Every civilization is told when a wonder is completed.",
            "items": {
              "type": "object"
            }
          },
          "relations": {
            "type": "array",
            "description": "Your own relations in full (status, since, met, openBorders, peaceOfferBy, bordersOfferBy, trade, demand, refusal, lastEnvoy, eligible AI mapOffer and mapPurchase quotes and attitude score); other civilizations\u2019 relations only as {a, b, status, openBorders}. Own relations also include ongoing agreements and a revalidated agreementQuote; foreign observers receive no agreement terms or source coordinates.",
            "items": {
              "type": "object",
              "properties": {
                "a": {
                  "type": "string"
                },
                "b": {
                  "type": "string"
                },
                "status": {
                  "enum": [
                    "peace",
                    "war"
                  ]
                },
                "met": {
                  "type": "boolean"
                },
                "openBorders": {
                  "type": "boolean"
                },
                "mapOffer": {
                  "$ref": "#/components/schemas/MapOffer"
                },
                "mapPurchase": {
                  "$ref": "#/components/schemas/MapOffer"
                },
                "trade": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "by": {
                      "type": "string"
                    },
                    "give": {
                      "$ref": "#/components/schemas/TradeSide"
                    },
                    "get": {
                      "$ref": "#/components/schemas/TradeSide"
                    },
                    "round": {
                      "type": "integer"
                    },
                    "valid": {
                      "type": "boolean"
                    }
                  },
                  "description": "Owner-only pending exchange. Computer leaders respond immediately; human pending exchanges do not contain map sales."
                },
                "agreements": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Agreement"
                  }
                },
                "agreementQuote": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "description": "canGive/canGet: goldPerTurn first-installment limit and route-eligible luxury types. Each luxury reports id, available, copies, exported, connectedCopies and connectedCities; cityIds appear only for your receiving cities, for the actual copy that would be committed. pending has by, give/get terms, round, valid and reason; no sources are exposed."
                },
                "tradeAccess": {
                  "type": "boolean",
                  "description": "Own relation only: active Trade Agreement. Does not grant unit access."
                },
                "tradeAccessOfferBy": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Own relation only: sender of a pending Trade Agreement."
                }
              }
            }
          },
          "families": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Family"
            },
            "description": "Families referenced by owned citizens, owned or currently visible units, and their ancestors. Hidden families and worldwide membership totals are omitted."
          },
          "victoryWarnings": {
            "type": "array",
            "description": "Latest public cultural victory milestone per civilization, retained beyond Chronicle rollover. No exact opponent culture totals. Empty until a regular victory check announces a stage.",
            "items": {
              "type": "object",
              "required": [
                "playerId",
                "type",
                "stage",
                "round"
              ],
              "properties": {
                "playerId": {
                  "type": "string"
                },
                "type": {
                  "const": "culture"
                },
                "stage": {
                  "enum": [
                    "approaching",
                    "imminent"
                  ]
                },
                "round": {
                  "type": "integer"
                }
              },
              "additionalProperties": false
            }
          },
          "internalChoice": {
            "type": [
              "object",
              "null"
            ],
            "description": "Pending binding faction choice with finalized outbreakReport and both camps. Ordinary play and deadlines pause until the affected account chooses.",
            "additionalProperties": true
          },
          "campaignDefeat": {
            "type": [
              "object",
              "null"
            ],
            "description": "The human campaign ended because its committed faction lost. Read access remains, but legalActions is empty and commands are rejected. The surviving reunited civilization is AI-controlled.",
            "additionalProperties": true
          },
          "cityTrade": {
            "$ref": "#/components/schemas/CityTradeOverview"
          }
        }
      },
      "GameDetail": {
        "type": "object",
        "properties": {
          "game": {
            "$ref": "#/components/schemas/GameSummary"
          },
          "state": {
            "$ref": "#/components/schemas/ProjectedState"
          },
          "legalActions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LegalOption"
            }
          },
          "you": {
            "type": "string",
            "description": "The player id of the side your account controls; state.self is this side. Sides keep their player ids for the whole game; a roster entry's controllerId names the controlling account when it differs. After civil-war campaign defeat this names the observed surviving nation, which grants no command authority; inspect state.campaignDefeat."
          },
          "inviteCode": {
            "type": "string",
            "description": "Only included for members."
          },
          "canRewind": {
            "type": "boolean",
            "description": "Present and true only for the established Andrei account in games it hosts. The server verifies the immutable account ID. Absent during a pending or committed civil-war choice and after campaign defeat; replay remains read-only."
          },
          "takeoverChoices": {
            "type": "array",
            "description": "With canRewind in an active game: every other surviving side Andrei may take over.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "civilization": {
                  "type": "string"
                },
                "civilizationName": {
                  "type": "string"
                },
                "internalFactionOf": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name",
                "civilization"
              ]
            }
          },
          "canReplay": {
            "type": "boolean",
            "description": "Present and true when this account may open replay mode: Andrei in his hosted games, everyone else once the game has finished."
          },
          "replay": {
            "type": "object",
            "description": "Present only on replay mode responses.",
            "properties": {
              "session": {
                "type": "string"
              },
              "step": {
                "type": "integer"
              },
              "live": {
                "type": "boolean"
              },
              "entry": {
                "type": "integer"
              },
              "round": {
                "type": "integer"
              },
              "back": {
                "type": "boolean"
              },
              "forward": {
                "type": "boolean"
              },
              "play": {
                "type": "boolean",
                "description": "Whether another recorded history frame is available for read-only playback."
              },
              "firstRound": {
                "type": "integer"
              },
              "lastRound": {
                "type": "integer"
              },
              "playback": {
                "type": "object",
                "description": "Present after advancing recorded playback. Items are ordered, viewer-safe action animations; empty frames may represent turn boundaries.",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "end": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "id",
                  "items",
                  "end"
                ],
                "additionalProperties": false
              },
              "continue": {
                "type": "object",
                "description": "Whether the position on screen can be continued as the side on screen, and whether continuing creates a new world (for anyone but the host).",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "newGame": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "available",
                  "newGame"
                ],
                "additionalProperties": false
              },
              "world": {
                "type": "boolean",
                "description": "Present (true) in the Whole world view."
              }
            }
          },
          "continuedFrom": {
            "type": "object",
            "description": "Present when continuing a replay created a new world.",
            "properties": {
              "gameId": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "round": {
                "type": "integer"
              }
            },
            "required": [
              "gameId",
              "name",
              "round"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "game",
          "state",
          "legalActions",
          "you"
        ],
        "additionalProperties": false
      },
      "GameList": {
        "type": "object",
        "properties": {
          "games": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GameSummary"
            },
            "maxItems": 100
          }
        },
        "required": [
          "games"
        ],
        "additionalProperties": false
      },
      "OK": {
        "type": "object",
        "properties": {
          "ok": {
            "const": true
          }
        },
        "required": [
          "ok"
        ],
        "additionalProperties": false
      },
      "Rules": {
        "type": "object",
        "description": "Public live catalog; authoritative for encyclopedia stats, projects, technologies and game concepts. No hidden game state. Includes happiness, seafaring, wonders (also projects with kind \"wonder\"), coinage (kind \"process\"), the Space Program (kind \"victory\"), cultureVictory and civilizations[].cities.",
        "properties": {
          "purchasing": {
            "type": "object",
            "description": "Current-queue rush rules. Payment fills missing production; eligible units/buildings complete during the next own income phase. Wonders, Coinage and Space Program are excluded.",
            "properties": {
              "technology": {
                "const": "currency"
              },
              "goldPerProduction": {
                "const": 4
              },
              "purchasedUnitsCanAct": {
                "const": false,
                "description": "False because no purchased unit exists during the payment turn; normal unit readiness applies when production completes at the next own turn."
              },
              "currentProjectOnly": {
                "const": true
              },
              "completion": {
                "const": "next_own_turn"
              },
              "purchasesPerCityTurn": {
                "const": 1
              }
            },
            "required": [
              "technology",
              "goldPerProduction",
              "purchasedUnitsCanAct",
              "currentProjectOnly",
              "completion",
              "purchasesPerCityTurn"
            ],
            "additionalProperties": false
          },
          "terrains": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "yields": {
                  "type": "object",
                  "properties": {
                    "food": {
                      "type": "number"
                    },
                    "production": {
                      "type": "number"
                    },
                    "gold": {
                      "type": "number"
                    },
                    "science": {
                      "type": "number"
                    },
                    "culture": {
                      "type": "number"
                    }
                  },
                  "description": "Gross yield; city food consumption is two per population each owning turn."
                },
                "movementCost": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "Default movement cost; null for impassable terrain. Roads, railroads and remaining movement can modify cost without making impassable terrain traversable."
                },
                "water": {
                  "type": "boolean"
                },
                "workable": {
                  "type": "boolean"
                },
                "settleable": {
                  "type": "boolean"
                },
                "defenseBonus": {
                  "type": "number",
                  "minimum": 0,
                  "description": "Fractional defense bonus for a unit defending this terrain: 0.2 means +20%. Stacks multiplicatively with fortification; does not modify city defense."
                },
                "landPassable": {
                  "type": "boolean",
                  "description": "Ordinary land traversal. Land units never enter water on their own; they cross water only aboard a friendly ship. Ice and mountains remain impassable."
                },
                "navalPassable": {
                  "type": "boolean",
                  "description": "Water accessible to ships; early ships additionally need Navigation for ocean."
                }
              },
              "required": [
                "id",
                "name",
                "description",
                "yields"
              ]
            }
          },
          "resources": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "yields": {
                  "type": "object",
                  "properties": {
                    "food": {
                      "type": "number"
                    },
                    "production": {
                      "type": "number"
                    },
                    "gold": {
                      "type": "number"
                    },
                    "science": {
                      "type": "number"
                    },
                    "culture": {
                      "type": "number"
                    }
                  },
                  "description": "Gross yield; city food consumption is two per population each owning turn."
                }
              },
              "required": [
                "id",
                "name",
                "description",
                "yields"
              ]
            }
          },
          "improvements": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "yields": {
                  "type": "object",
                  "properties": {
                    "food": {
                      "type": "number"
                    },
                    "production": {
                      "type": "number"
                    },
                    "gold": {
                      "type": "number"
                    },
                    "science": {
                      "type": "number"
                    },
                    "culture": {
                      "type": "number"
                    }
                  },
                  "description": "Gross yield; city food consumption is two per population each owning turn."
                },
                "tech": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "buildable": {
                  "type": "boolean"
                },
                "terrains": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "resources": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "id",
                "name",
                "description",
                "yields"
              ]
            }
          },
          "cityFocuses": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "civilizations": {
            "type": "array",
            "description": "Historical display names with stable IDs and unchanged bonuses for legacy civilizations. Twelve distinct choices support twelve-player games. History and sources are reference material, separate from gameplay bonuses.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "bonus": {
                  "type": "string"
                },
                "history": {
                  "type": "string"
                },
                "historySources": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string"
                      },
                      "url": {
                        "type": "string",
                        "format": "uri",
                        "pattern": "^https://"
                      }
                    },
                    "required": [
                      "title",
                      "url"
                    ]
                  }
                },
                "leader": {
                  "type": "string",
                  "description": "Historical leader of the computer player."
                },
                "temperament": {
                  "type": "object",
                  "description": "How the computer leader plays: style, summary and weights from 0 to 1 (aggression, expansion, science, wonders, culture, trade, forgiveness, greed)."
                }
              },
              "required": [
                "id",
                "name",
                "description",
                "bonus",
                "history",
                "historySources"
              ]
            }
          },
          "eras": {
            "type": "array",
            "description": "The six eras in order: ancient, classical, medieval, renaissance, industrial, modern.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name"
              ]
            }
          },
          "techs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "cost": {
                  "type": "integer"
                },
                "prerequisites": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "era": {
                  "type": "string",
                  "description": "An id from rules.eras."
                },
                "description": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name",
                "cost",
                "prerequisites",
                "era"
              ]
            }
          },
          "units": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "cost": {
                  "type": "integer"
                },
                "movement": {
                  "type": "integer"
                },
                "strength": {
                  "type": "number",
                  "description": "Melee strength; for aircraft, air combat strength used in interceptions."
                },
                "ranged": {
                  "type": "number",
                  "description": "Aircraft strike strength. Siege engines use bombard instead and cannot attack units."
                },
                "range": {
                  "type": "integer",
                  "description": "Attack distance in hexes: 1 for every land and sea unit; for aircraft, the strike radius from their city."
                },
                "naval": {
                  "type": "boolean"
                },
                "air": {
                  "type": "boolean",
                  "description": "Aircraft: based in cities, strike within range, rebase between cities."
                },
                "interceptor": {
                  "type": "boolean",
                  "description": "Intercepts enemy air strikes within its range once per turn."
                },
                "civilian": {
                  "type": "boolean"
                },
                "capacity": {
                  "type": "integer"
                },
                "defenseBonus": {
                  "type": "number",
                  "description": "Extra defense when this unit defends, as a fraction (Archer and Musketeer 0.5: +50%)."
                },
                "cityDefenseBonus": {
                  "type": "number",
                  "description": "Replaces defenseBonus when this unit defends a city tile (Archer and Musketeer 1: +100%)."
                },
                "defenseless": {
                  "type": "boolean",
                  "description": "Settlers, Workers, Catapults, Cannons and Artillery: never defend a stack or a city with a fighting unit present. A melee attack on them alone destroys each, or captures it (rules.capture.chance) when a land unit moves in; ranged attacks and air strikes damage them as usual."
                },
                "capturedAs": {
                  "type": "string",
                  "description": "The unit type a captured unit becomes (Settler: worker); otherwise it keeps its type."
                },
                "sight": {
                  "type": "integer"
                },
                "tech": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "upgradesTo": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "bombard": {
                  "type": "integer",
                  "description": "Fortification percentage points removed by one adjacent bombardment: Catapult 25, Cannon 50, Artillery 100. Walls first, then unit entrenchment; at zero defense, disables one random intact ordinary building until repaired for half its shield cost (rounded up). Never health damage."
                }
              },
              "required": [
                "id",
                "name",
                "cost",
                "movement",
                "strength",
                "range",
                "naval",
                "air",
                "civilian",
                "capacity",
                "tech",
                "upgradesTo"
              ]
            }
          },
          "air": {
            "type": "object",
            "properties": {
              "cityCapacity": {
                "type": "integer"
              },
              "rebaseRangeMultiplier": {
                "type": "integer"
              },
              "interceptionsPerTurn": {
                "type": "integer"
              }
            }
          },
          "airlift": {
            "type": "object",
            "properties": {
              "building": {
                "type": "string"
              },
              "unitsPerCityPerTurn": {
                "type": "integer"
              }
            }
          },
          "cityDefense": {
            "type": "object",
            "description": "Intact walls grant (wallsMultiplier\u22121)\u00d7100 percentage points of defense; bombardment reduces them. Damaged walls are repaired from the hex's per-turn fortification allowance (fortification.perTurn) before units' entrenchment grows. Civilization multipliers are separate and unaffected.",
            "properties": {
              "wallsMultiplier": {
                "type": "number"
              },
              "civilizationMultipliers": {
                "type": "object",
                "additionalProperties": {
                  "type": "number"
                }
              }
            }
          },
          "pillage": {
            "type": "object",
            "description": "Gold a pillage order pays per destroyed improvement, the movement it uses, and the health it restores to the pillager through living off the land. This is the only recovery allowed in enemy territory.",
            "properties": {
              "movementCost": {
                "type": "number"
              },
              "gold": {
                "type": "object",
                "additionalProperties": {
                  "type": "integer"
                }
              },
              "heal": {
                "type": "integer"
              }
            }
          },
          "capture": {
            "type": "object",
            "description": "Chance that a land melee attacker captures each unit that cannot fight, instead of destroying it.",
            "properties": {
              "chance": {
                "type": "number"
              }
            }
          },
          "clearing": {
            "type": "object",
            "description": "A farm, mine, pasture, plantation or canal built on these terrains clears them, leaving the land beneath (baseTerrain, otherwise plains for forest and grassland for rainforest), and gives this much production to the city whose borders hold the tile, or the owner's nearest city.",
            "properties": {
              "terrains": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "production": {
                "type": "integer"
              }
            }
          },
          "healing": {
            "type": "object",
            "description": "A unit that neither moves nor acts during its owner\u2019s turn heals this much health as the turn ends: ownTerritory on its owner\u2019s land or water only. Enemy, friendly foreign and unclaimed tiles never heal resting units; elsewhere is 0 for compatibility. Pillaging is a separate recovery exception on enemy tiles. Fortifying does not count as acting; units aboard ships do not heal. There is no heal order.",
            "properties": {
              "ownTerritory": {
                "type": "integer"
              },
              "elsewhere": {
                "type": "integer"
              }
            }
          },
          "ethnicities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Ethnicity"
            },
            "description": "All supported ethnicities and their fixed visual identities."
          },
          "demographics": {
            "type": "object",
            "description": "Public family branching thresholds and probabilities. Early ordinary births bypass size checks only below both the city and civilization diversity targets. Local targets count city citizens; civilization diversity includes affiliated citizens and units. Political births use their separate rule; counters stay private.",
            "properties": {
              "branchChance": {
                "type": "number",
                "minimum": 0,
                "maximum": 1,
                "description": "Ordinary birth branch chance once either diversity target is reached (currently 0.25), subject to local family/city size requirements."
              },
              "minBranchPopulation": {
                "type": "integer",
                "minimum": 1,
                "description": "Minimum selected-family citizens in the growing city before an ordinary branch roll (currently 4). Ignored only by the early-diversity and political birth rules; units and other cities do not count toward local size."
              },
              "citizensPerFamily": {
                "type": "integer",
                "minimum": 1,
                "description": "Minimum average citizens per represented family in the growing city before an ordinary branch roll (currently 4). Ignored only by the early-diversity and political birth rules."
              },
              "minFamilyPopulationBeforeBranch": {
                "type": "integer",
                "minimum": 1,
                "description": "After the early-diversity phase, a successful ordinary branch roll adds the newborn to the smallest local family below this size (currently 5), choosing randomly among ties; otherwise creates a branch. Only this city\u2019s citizens count toward local size. Early-diversity and political births bypass this diversion."
              },
              "foreignBirthBranchChance": {
                "type": "number",
                "minimum": 0,
                "maximum": 1,
                "description": "Chance (currently 0.5) that a birth from a foreign, unaligned family joins or forms a same-ethnicity branch loyal to the city owner. Replaces ordinary branching for that birth and bypasses population minimums."
              },
              "cityLoyaltyShiftChance": {
                "type": "number",
                "minimum": 0,
                "maximum": 1,
                "description": "One chance per eligible owned city at turn start (currently 0.1) to transfer one existing foreign citizen to a loyal branch. Their exact family must still have citizens under its ethnicity's original civilization. Runs before births; units do not satisfy homeland membership."
              },
              "startingFamilies": {
                "type": "integer",
                "const": 1
              },
              "cityFamilyDiversityTarget": {
                "type": "integer",
                "minimum": 1,
                "description": "Local family diversity target (currently 2). Count only distinct family IDs among citizens in the growing city."
              },
              "earlyBranchChance": {
                "type": "number",
                "minimum": 0,
                "maximum": 1,
                "description": "Ordinary birth chance to form a new branch below the local target and while the civilization has fewer than three living families (currently 0.5); bypasses size minimums and smallest-family diversion."
              },
              "fragmentationCitizensPerFamily": {
                "type": "number",
                "description": "Target local population per resident family after Renaissance entry."
              },
              "fragmentationCityCooldown": {
                "type": "integer",
                "description": "Minimum owning turns between additional splits in a city."
              },
              "fragmentationFamilyCooldown": {
                "type": "integer",
                "description": "Minimum owning turns between repeated splits of a family."
              },
              "fragmentationMinimumBranch": {
                "type": "integer",
                "description": "Minimum transferred residents; at least this many also remain with the parent."
              },
              "familyDiversityTarget": {
                "type": "integer",
                "minimum": 1,
                "description": "Civilization-wide living family diversity target (currently 3), counting families represented by affiliated citizens or units. Early branching stops once this target is reached."
              }
            }
          },
          "happiness": {
            "type": "object",
            "properties": {
              "baseContent": {
                "const": 4
              },
              "freeCities": {
                "const": 4
              },
              "citiesPerUnhappy": {
                "const": 5,
                "description": "Under Despotism and Monarchy, every city loses floor(ownedCityCount / 5) content slots. The first four cities have no empire-size penalty."
              },
              "luxuryContent": {
                "const": 1,
                "description": "Content slots in every city per distinct owned luxury with its required improvement and a road or railroad connection to the current capital. Duplicate copies never stack."
              },
              "luxuryImprovements": {
                "const": {
                  "gold": "mine",
                  "gems": "mine",
                  "spices": "plantation",
                  "silk": "plantation"
                }
              },
              "citizensPerForeignUnhappy": {
                "const": 5,
                "description": "Pool all foreign-ethnicity citizens in this city and round down the count divided by five."
              },
              "citizensPerForeignFamilyUnhappy": {
                "const": 5,
                "description": "For each foreign-origin family not loyal to the current city owner, separately round down its citizen count in this city divided by five; add the results. Direct or inherited loyalty exempts only the family penalty."
              },
              "luxuries": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "baseContent",
              "freeCities",
              "citiesPerUnhappy",
              "luxuryContent",
              "luxuryImprovements",
              "citizensPerForeignUnhappy",
              "citizensPerForeignFamilyUnhappy",
              "luxuries"
            ]
          },
          "buildings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BuildingWorkRules"
            }
          },
          "projects": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BuildingWorkRules"
            }
          },
          "familyTraits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FamilyTrait"
            },
            "description": "Independent dwelling, profession, character and feat categories. Urban acquisition 5% per worker, combined cap20%; ten/twenty-turn work histories permit change. Achievement contributions retain existing rules."
          },
          "governments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "enum": [
                    "despotism",
                    "monarchy",
                    "republic",
                    "democracy",
                    "dictatorship"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "strength": {
                  "type": "integer",
                  "enum": [
                    1,
                    2
                  ],
                  "description": "National family-trait strength; personal member effects are separate."
                },
                "technology": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Required technology for reforming to this government."
                },
                "electionTurns": {
                  "type": "integer",
                  "enum": [
                    0,
                    6,
                    10
                  ]
                },
                "officeYields": {
                  "type": "object",
                  "properties": {
                    "gold": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "science": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "production": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "culture": {
                      "type": "integer",
                      "minimum": 0
                    }
                  },
                  "description": "Per staffed Palace/Government Quarters before personal traits and city-wide percentages."
                },
                "contentPenalty": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Flat content penalty per city. Republic and Democracy each have one."
                },
                "politicalExpectationsPenalty": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Separate Democracy content penalty per city; stacks with contentPenalty."
                },
                "goldMultiplier": {
                  "type": "number",
                  "minimum": 0
                },
                "scienceMultiplier": {
                  "type": "number",
                  "minimum": 0
                },
                "cultureMultiplier": {
                  "type": "number",
                  "minimum": 0
                },
                "unitProductionMultiplier": {
                  "type": "number",
                  "description": "City production multiplier for every unit project, including civilians."
                },
                "longRuleGrievanceCap": {
                  "type": "integer",
                  "minimum": 0
                },
                "militaryProductionMultiplier": {
                  "type": "number",
                  "minimum": 0
                },
                "militaryUpkeepMultiplier": {
                  "type": "number",
                  "minimum": 0,
                  "description": "Multiplier applied to baseMilitaryUpkeep (2 gold per chargeable unit): Despotism 1, Monarchy 0.5, Republic 1.5, Democracy 2, Dictatorship 0.5."
                },
                "militaryUpkeepPerUnit": {
                  "type": "integer",
                  "minimum": 1,
                  "description": "Gold per chargeable military unit per own turn: Despotism 2, Monarchy 1, Republic 3, Democracy 4, Dictatorship 1. Siege, ships and aircraft count; Workers and Scouts pay half; Settlers are exempt. Every government supports one unit per city free of charge."
                },
                "freeUnitsPerCity": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Full units each owned city supports without upkeep: 1 in every government."
                },
                "taxDefault": {
                  "type": "integer",
                  "minimum": 0
                },
                "taxBand": {
                  "type": "array",
                  "items": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "jobGoldMultiplier": {
                  "type": "number"
                },
                "wealthWeight": {
                  "type": "number"
                }
              }
            },
            "description": "Five implemented governments. Code of Laws unlocks Monarchy/Republic; National Sovereignty unlocks Democracy/Dictatorship. Catalog yields are office base output before personal traits and city-wide percentages."
          },
          "government": {
            "type": "object",
            "description": "Shared government rules; use advertised legal actions and owner governmentDetails for current eligibility.",
            "properties": {
              "technology": {
                "const": "code_of_laws"
              },
              "electionTurns": {
                "const": 10
              },
              "transitionTurns": {
                "const": 2
              },
              "cooldownTurns": {
                "const": 20
              },
              "transitionYieldMultiplier": {
                "const": 0.75
              },
              "governorServiceWeight": {
                "const": 0.2,
                "description": "Support per actual worked governor income phase in both Republic and Democracy."
              },
              "governorVoteCap": {
                "const": 0.5,
                "description": "Maximum governor support as a fraction of a family's average resident population in either elected government."
              },
              "modernTechnology": {
                "const": "national_sovereignty"
              },
              "democracyElectionTurns": {
                "const": 6
              },
              "militaryServiceWindow": {
                "const": 5
              },
              "militaryGovernorWeight": {
                "const": 10
              },
              "economicRounding": {
                "const": "floor_per_city",
                "description": "Apply percentages once after actual jobs, family bonuses and Coinage conversion, rounding each complete city output down before army upkeep. One-off transactions are unchanged."
              },
              "warWeariness": {
                "type": "object",
                "properties": {
                  "offensiveTurns": {
                    "const": 3
                  },
                  "peacefulTurns": {
                    "const": 2
                  },
                  "maximumPenalty": {
                    "const": 4
                  }
                }
              },
              "elections": {
                "type": "object",
                "properties": {
                  "nativeEthnicity": {
                    "const": "civilization_original"
                  },
                  "republicEligibility": {
                    "const": "native_only"
                  },
                  "democracyEligibility": {
                    "const": "native_or_loyal"
                  },
                  "firstRoundThreshold": {
                    "const": 0.5
                  },
                  "maximumRounds": {
                    "const": null
                  },
                  "runoffCandidates": {
                    "const": 2
                  },
                  "campaignMinimum": {
                    "const": 0.85
                  },
                  "campaignMaximum": {
                    "const": 1.15
                  },
                  "runoffPreferences": {
                    "type": "object",
                    "properties": {
                      "ownFamily": {
                        "const": 3
                      },
                      "sameAncestralRoot": {
                        "const": 2
                      },
                      "sharedTrait": {
                        "const": 1.25
                      },
                      "sameEthnicity": {
                        "const": 1.25
                      },
                      "previousVote": {
                        "const": 3
                      }
                    }
                  }
                },
                "description": "Election franchise and runoff rules. Fresh campaign swing each round. Each runoff voter multiplies candidate support by ownFamily, otherwise sameAncestralRoot; sharedTrait once per matching nonempty trait category, capped at two categories; sameEthnicity; and previousVote when the first-round choice survives. Factors multiply; ballots remain random. At least firstRoundThreshold wins immediately."
              },
              "baseMilitaryUpkeep": {
                "const": 2,
                "description": "Base gold cost per chargeable military unit per own turn, before the government multiplier."
              }
            }
          },
          "movement": {
            "type": "object",
            "description": "Land movement rules. Cities connect roads and railroads. Railroad travel costs zero but every step requires positive remaining movement. Exhausted units cannot move until movement refreshes next turn. Ships and aircraft retain their normal domains and actions still require their normal movement.",
            "properties": {
              "roadStepCost": {
                "type": "number",
                "const": 0.3333333333333333
              },
              "railroadStepCost": {
                "type": "number",
                "const": 0
              },
              "roughStepCost": {
                "type": "number",
                "const": 2
              },
              "citiesCountAsRoads": {
                "type": "boolean",
                "const": true
              },
              "citiesCountAsRailroads": {
                "type": "boolean",
                "const": true
              }
            },
            "additionalProperties": true
          },
          "fortification": {
            "type": "object",
            "properties": {
              "bonus": {
                "type": "integer",
                "description": "Initial and field entrenchment bonus in percentage points (25)."
              },
              "cityBonus": {
                "type": "integer",
                "description": "Maximum city entrenchment bonus (50)."
              },
              "perTurn": {
                "type": "integer",
                "description": "Most fortification points a hex regains per owning turn (25), wall repairs first, then entrenchment built by fortified units. Several units fortifying in one turn add it once."
              },
              "meleeDamage": {
                "type": "integer",
                "const": 10,
                "description": "Fortification percentage points removed after each attack by a unit with wearsFortifications (the gunpowder melee units: Musketeer, Cavalry, Rifleman, Tank), irrespective of combat result. Walls first, then the hex's entrenchment. Earlier melee units do not wear fortifications. Never damages buildings."
              }
            }
          },
          "familyTraitRules": {
            "type": "object",
            "description": "Authoritative tradition acquisition, history windows, character evolution settings and active personal character effects.",
            "properties": {
              "characterEffects": {
                "type": "object",
                "description": "Personal effects only; character grants no ruling-family national policy. Yield bonuses apply to actual qualifying work before government modifiers.",
                "properties": {
                  "boldAttackBonus": {
                    "type": "number",
                    "description": "Fractional attack multiplier bonus for Bold units, including strikes and interceptions (0.1)."
                  },
                  "fearfulDefenseBonus": {
                    "type": "number",
                    "description": "Fractional defense multiplier bonus for Fearful defenders or intercepted aircraft (0.1); not protection from retaliation against an initiating attacker."
                  },
                  "freedomLovingScience": {
                    "type": "number",
                    "description": "Science per actual Library/Academy/University/Observatory worker under Republic or Democracy (1)."
                  },
                  "traditionalistCulture": {
                    "type": "number",
                    "description": "Culture per actual Temple/Cathedral worker (1)."
                  },
                  "ambitiousGovernorProduction": {
                    "type": "number",
                    "description": "Production per actual working governor in a Palace or Government Quarters (1)."
                  },
                  "ambitiousGovernorServiceWeight": {
                    "type": "number",
                    "description": "Election support per completed governor turn for Ambitious families (0.25); total service bonus remains capped at half average family population."
                  },
                  "fearfulWithdrawalChance": {
                    "type": "number",
                    "description": "Chance for a fighting Fearful defender to withdraw to the legal opposite adjacent hex before a non-air attack (0.2). Blocked retreats fight normally; withdrawal spends the unit turn and may abandon a city."
                  },
                  "traditionalistSciencePenalty": {
                    "type": "number",
                    "description": "Science removed per Science District worker, floored at zero (1)."
                  },
                  "corruptGoldPenalty": {
                    "type": "number",
                    "description": "Gold removed from complete personal building job output, floored at zero (1)."
                  },
                  "quarrelsomeContentPenalty": {
                    "type": "number",
                    "description": "Content capacity removed per resident Quarrelsome family per city (1)."
                  },
                  "ambitiousExcludedContentPenalty": {
                    "type": "number",
                    "description": "Content capacity removed per resident Ambitious family per city when it has neither ruler nor appointed governor in that civilization (1)."
                  },
                  "powerHungryAmbition": {
                    "type": "number",
                    "description": "Rivalry ambition of a Power-hungry family (50); the rivalry challenge chance is 0.10 + ambition/400."
                  },
                  "powerHungryRivalryShare": {
                    "type": "number",
                    "description": "Share of the ruling family's power at which a Power-hungry family accumulates rivalry turns (0.75; other families need 1.25)."
                  },
                  "powerHungryNearPowerShare": {
                    "type": "number",
                    "description": "Share of the ruling family's power the strongest outside family needs under Monarchy or Dictatorship to count a turn near the throne (0.6); five consecutive turns offer the negative-character check."
                  },
                  "powerHungryAutocraticPenalty": {
                    "type": "number",
                    "description": "Gold and culture removed from every city while a Power-hungry family rules under Despotism, Monarchy or Dictatorship (2), after government multipliers, floored at zero."
                  },
                  "powerHungryElectedPenalty": {
                    "type": "number",
                    "description": "Gold and culture removed from every city while a Power-hungry family rules under Republic or Democracy (1), floored at zero."
                  }
                }
              },
              "cityDwellerNaturalWorkerEquivalent": {
                "type": "number",
                "description": "Natural-dweller per-worker chance multiplier for a district worker (5); not a claim of five independent rolls."
              },
              "cityDwellerMemberChance": {
                "type": "number",
                "description": "Exact City dwellers acquisition chance contributed per actual building worker per owning turn (0.025). Existing twenty-turn dwelling history and 0.2 family/category cap remain unchanged."
              },
              "characterRandomChance": {
                "type": "number",
                "description": "Baseline acquisition chance once per owning turn while character is empty (0.01). Newly formed families wait until a subsequent turn; recent experiences weight the choice while all eight characters remain possible; Corrupt, Quarrelsome and Power-hungry use one-quarter ordinary weight."
              },
              "characterTravelTiles": {
                "type": "integer",
                "description": "Actual ordinary map steps per travel experience favoring Bold (10)."
              },
              "characterExperienceThreshold": {
                "type": "integer",
                "description": "Matching recent experience episodes needed for an event-driven acquisition/change check (3)."
              },
              "characterExperienceChance": {
                "type": "number",
                "description": "Chance for an eligible experience to acquire or change character (0.15), checked at most once per world round."
              },
              "characterCooldownTurns": {
                "type": "integer",
                "description": "World rounds after acquisition or change before another event-driven character change (20). Despite the legacy field name, measured in world rounds."
              },
              "negativeCharacterWeight": {
                "type": "number",
                "description": "Relative baseline and per-experience random weight for Corrupt, Quarrelsome and Power-hungry (0.25 versus 1 for other characters)."
              },
              "negativeCharacterExperienceChance": {
                "type": "number",
                "description": "Acquisition/change probability for an eligible negative-character episode (0.05)."
              },
              "negativeCharacterExperienceThreshold": {
                "type": "integer",
                "description": "Matching episodes among the last ten recorded experiences needed for a negative-character check (5)."
              }
            }
          },
          "combat": {
            "type": "object",
            "description": "Melee battles are fought blow by blow until one unit falls: each blow is landed by the attacker with probability attack/(attack+defense), otherwise by the defender, for blowDamage \u00b1 blowSpread damage. Single strikes without retaliation use the clamped rounded base times the attack/defense ratio to strengthExponent. Live combat and AI forecasts share the same calculation.",
            "properties": {
              "blowDamage": {
                "type": "integer"
              },
              "blowSpread": {
                "type": "integer"
              },
              "baseDamage": {
                "type": "integer"
              },
              "minDamage": {
                "type": "integer"
              },
              "maxDamage": {
                "type": "integer"
              },
              "strengthExponent": {
                "type": "number"
              }
            }
          },
          "familyWealth": {
            "type": "object",
            "description": "Private purse, adjustable national job taxes, wealth power, benefaction, war chest and loan rules.",
            "properties": {
              "decayRate": {
                "type": "number",
                "minimum": 0
              },
              "officeStipend": {
                "type": "number",
                "minimum": 0
              },
              "lootShare": {
                "type": "number",
                "minimum": 0
              },
              "richAt": {
                "type": "number",
                "minimum": 0
              },
              "veryRichAt": {
                "type": "number",
                "minimum": 0
              },
              "defaultTaxRates": {
                "type": "object",
                "additionalProperties": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 100
                }
              },
              "taxCooldown": {
                "type": "number"
              },
              "taxStep": {
                "type": "number"
              },
              "loanMinimumWealth": {
                "type": "number"
              },
              "loanShare": {
                "type": "number"
              },
              "loanInterest": {
                "type": "number"
              },
              "loanInterestTurns": {
                "type": "number"
              },
              "loanDueTurns": {
                "type": "number"
              },
              "defaultGrievance": {
                "type": "number"
              },
              "defaultLeaning": {
                "type": "number"
              },
              "warChestShare": {
                "type": "number"
              },
              "militiaGold": {
                "type": "number"
              },
              "taxBands": {
                "type": "object",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "minItems": 2,
                  "maxItems": 2
                }
              },
              "wealthWeights": {
                "type": "object",
                "additionalProperties": {
                  "type": "number"
                }
              }
            }
          },
          "agreements": {
            "type": "object",
            "description": "Writing, maximum gold and agreements per pair, duration until_cancelled, firstPayment on_acceptance."
          },
          "cityWorkAccess": {
            "type": "object",
            "properties": {
              "steps": {
                "type": "integer",
                "const": 3
              }
            },
            "description": "Maximum one-cost hex steps from the city center to a worked tile. Land and water paths are separate; units and naval blockades exclude hexes."
          },
          "navalBlockade": {
            "type": "object",
            "description": "Economic exclusion around hostile naval units: radius 1 (water in the ship hex and six adjacent hexes), includesLand false, requiresWar true. Blocks city tile work and all domestic/foreign supply and luxury route types. Routes reroute around blocked hexes and fail only when no valid path remains between endpoints."
          },
          "workerAutomation": {
            "type": "object",
            "description": "preserveWoodlandsByDefault, clearingMode, and aiClearingTechnology."
          },
          "cityTrade": {
            "type": "object",
            "properties": {
              "maxShipment": {
                "type": "integer",
                "minimum": 1,
                "maximum": 20
              },
              "maxPrice": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              },
              "technology": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "defaultFoodReserve": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "baseShipment": {
                "type": "integer",
                "const": 10
              },
              "bankShipment": {
                "type": "integer",
                "const": 15
              },
              "stockExchangeShipment": {
                "type": "integer",
                "const": 20
              }
            }
          },
          "localResources": {
            "type": "object",
            "description": "Local radius-two resource coefficients, early military bonus, Darwin multiplier and the +50% Horses multiplier for chariot, horseman, knight and cavalry."
          }
        }
      },
      "EncyclopediaEntry": {
        "type": "object",
        "description": "One encyclopedia entry as plain text. Icon markers such as [food] or [strength] stand for the in-game pictures.",
        "properties": {
          "category": {
            "enum": [
              "concepts",
              "terrain",
              "resources",
              "improvements",
              "units",
              "buildings",
              "wonders",
              "research",
              "governments",
              "civilizations",
              "family_traits"
            ]
          },
          "categoryName": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "The rule ID (unit, building, technology and so on) or a concept ID such as combat or pillage. IDs are unique within a category; stone is both a resource and a civilization."
          },
          "title": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "stats": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "label",
                "value"
              ],
              "additionalProperties": false
            },
            "description": "Statistics as displayed, for example Strength 29 or Cost 95 production."
          },
          "rules": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Rules and notes, one per item. Concepts under How to play hold the general rules."
          },
          "seeAlso": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Titles of related entries."
          },
          "history": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string"
              },
              "sources": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "title",
                    "url"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "text",
              "sources"
            ],
            "additionalProperties": false,
            "description": "Civilizations only."
          },
          "cities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Civilizations only: city names in founding order."
          }
        },
        "required": [
          "category",
          "categoryName",
          "id",
          "title",
          "summary",
          "stats",
          "rules",
          "seeAlso"
        ],
        "additionalProperties": false
      },
      "Ethnicity": {
        "type": "object",
        "description": "A cultural identity with a fixed clothing color, independent of the current political owner.",
        "required": [
          "id",
          "name",
          "color",
          "symbol"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$"
          },
          "symbol": {
            "type": "string"
          },
          "civilizationId": {
            "type": "string",
            "description": "Existing civilization catalog ID used for initial ethnicity assignment."
          },
          "familyNames": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Illustrative cultural family/clan name palette used for founding families."
          }
        }
      },
      "Citizen": {
        "type": "object",
        "description": "One persistent citizen in an owned city. Identity and appearance survive job changes, recruitment as a settler, settlement and conquest.",
        "required": [
          "id",
          "familyId",
          "ethnicityId",
          "appearanceSeed"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "familyId": {
            "type": "string"
          },
          "ethnicityId": {
            "type": "string"
          },
          "appearanceSeed": {
            "type": "integer",
            "description": "Public deterministic portrait seed; unrelated to the private world or combat random state.",
            "minimum": 0,
            "maximum": 4294967295
          }
        }
      },
      "Family": {
        "type": "object",
        "description": "An authorized family record or an ancestor of one. It does not expose global membership counts or hidden cities. A branch has its own ID and parent; extinct ancestors remain available.",
        "required": [
          "id",
          "name",
          "ethnicityId",
          "parentFamilyId",
          "appearanceSeed",
          "lifestyleTraitId",
          "featTraitId",
          "dwellingTraitId",
          "professionTraitId",
          "characterTraitId"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "ethnicityId": {
            "type": "string"
          },
          "parentFamilyId": {
            "type": [
              "string",
              "null"
            ]
          },
          "appearanceSeed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4294967295
          },
          "foundedTurn": {
            "type": [
              "integer",
              "null"
            ]
          },
          "foundedCityId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Only revealed when the founding city is already known to the viewer."
          },
          "loyalToPlayerId": {
            "type": "string",
            "description": "Optional recorded allegiance of a political branch. Ordinary descendants inherit from their nearest marked ancestor. The affiliation is retained after capture; it does not expose current membership locations or counts."
          },
          "originCivilizationId": {
            "type": "string",
            "description": "Civilization under which this family itself originated; a new branch records its founding ruler, independently of ethnicity and parent origin. Capture and adoption never change it. Missing legacy origins are inferred from retained history, falling back to ethnicity civilization when unavailable."
          },
          "lifestyleTraitId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Deprecated compatibility alias for one dwelling or profession; use the independent category fields.",
            "deprecated": true
          },
          "featTraitId": {
            "type": [
              "string",
              "null"
            ],
            "description": "One earned feat trait from rules.familyTraits, or null. Founding families and new branches start empty. Traits apply to exact family membership, without ancestry inheritance."
          },
          "dwellingTraitId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Independent dwelling category from rules.familyTraits."
          },
          "professionTraitId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Independent profession category from rules.familyTraits."
          },
          "characterTraitId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Independent character category from rules.familyTraits. Founders and descendant branches begin null; characters develop during play and are not inherited. Existing saved characters are preserved. Personal character effects never become national policy."
          },
          "traditions": {
            "type": "object",
            "description": "Owner-specific summaries for dwelling and profession. Does not expose work ledgers.",
            "properties": {
              "dwelling": {
                "type": "object",
                "properties": {
                  "phase": {
                    "type": "string",
                    "enum": [
                      "Established",
                      "Fading",
                      "Emerging"
                    ]
                  },
                  "traitId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "emergingTraitId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "explanation": {
                    "type": "string"
                  }
                }
              },
              "profession": {
                "type": "object",
                "properties": {
                  "phase": {
                    "type": "string",
                    "enum": [
                      "Established",
                      "Fading",
                      "Emerging"
                    ]
                  },
                  "traitId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "emergingTraitId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "explanation": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "heritageFeatIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Ancestral heritage, without active earned bonuses."
          },
          "demographicGroupFamilyId": {
            "type": "string",
            "description": "Source group used to retain demographic treatment across Renaissance fragmentation."
          },
          "headquarters": {
            "type": [
              "object",
              "null"
            ],
            "description": "City with the most civilian residents from this exact family; city ID breaks ties. Null if there are no settled members or the true seat is not inspectable.",
            "properties": {
              "cityId": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "ownerId": {
                "type": "string"
              },
              "members": {
                "type": "integer",
                "minimum": 1
              }
            }
          },
          "wealth": {
            "type": "integer",
            "minimum": 0,
            "description": "Exact private gold, visible only to loyal/resident countries and revealed world views. Missing legacy wealth reads as zero."
          },
          "wealthBand": {
            "type": "string",
            "enum": [
              "modest",
              "rich",
              "very rich"
            ],
            "description": "Used instead of exact wealth for other known families; thresholds are 100 and 500."
          },
          "wealthLedger": {
            "type": "object",
            "description": "Prospective lifetime totals, visible with exact wealth. Never a per-turn forecast.",
            "properties": {
              "income": {
                "type": "object",
                "properties": {
                  "work": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "office": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "loot": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "patronage": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "corruption": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "loanRepayments": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "warChestReturns": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              },
              "taxesPaid": {
                "type": "integer",
                "minimum": 0
              },
              "decay": {
                "type": "integer",
                "minimum": 0
              },
              "inherited": {
                "type": "integer",
                "minimum": 0
              },
              "escheated": {
                "type": "integer",
                "minimum": 0
              },
              "spending": {
                "type": "object",
                "properties": {
                  "benefactions": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "warChest": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "loans": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              }
            }
          },
          "loans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FamilyLoan"
            },
            "description": "Outstanding contracts, only visible with exact wealth."
          }
        }
      },
      "CityHappiness": {
        "type": "object",
        "properties": {
          "limit": {
            "type": "integer",
            "minimum": 0
          },
          "unhappy": {
            "type": "integer",
            "minimum": 0
          },
          "working": {
            "type": "integer",
            "minimum": 0
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": [
                    "number",
                    "string"
                  ]
                }
              },
              "required": [
                "label",
                "value"
              ]
            }
          },
          "breakdown": {
            "$ref": "#/components/schemas/HappinessBreakdown"
          },
          "contentCitizenIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Owner-only IDs of citizens currently content. An appointed governor reserves a working slot; use these IDs rather than assuming content citizens are the first entries in the population array."
          }
        },
        "required": [
          "limit",
          "unhappy",
          "working",
          "sources",
          "breakdown"
        ],
        "description": "Owner-only city happiness. A ruling family of a different ethnicity from the civilization\u2019s founding ethnicity adds the foreign_ruling_family effect: -1 content capacity in every city under every government, including Persia. Working equals population minus unhappy, including idle content citizens. Penalties reduce content capacity; bonuses offset them. Raw capacity is clamped to at least one unless Shakespeare\u2019s Theatre sets all citizens content."
      },
      "HappinessBreakdown": {
        "type": "object",
        "properties": {
          "population": {
            "type": "integer",
            "minimum": 0
          },
          "rawLimit": {
            "type": "integer"
          },
          "minimumContent": {
            "const": 1
          },
          "minimumAdjustment": {
            "type": "integer",
            "minimum": 0
          },
          "allContent": {
            "type": "boolean"
          },
          "preventedUnhappy": {
            "type": "integer",
            "minimum": 0
          },
          "effects": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "category": {
                  "enum": [
                    "base",
                    "empire",
                    "luxury",
                    "building",
                    "wonder",
                    "ethnicity",
                    "family",
                    "government",
                    "civilization"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": "integer"
                },
                "description": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "category",
                "label",
                "value",
                "description"
              ]
            }
          },
          "foreignPopulation": {
            "type": "integer",
            "minimum": 0
          },
          "citizensPerForeignUnhappy": {
            "const": 5
          },
          "foreignEthnicityUnhappy": {
            "type": "integer",
            "minimum": 0
          },
          "foreignEthnicities": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ethnicityId": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "population": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "required": [
                "ethnicityId",
                "name",
                "population"
              ]
            }
          },
          "citizensPerForeignFamilyUnhappy": {
            "const": 5
          },
          "foreignFamilyUnhappy": {
            "type": "integer",
            "minimum": 0
          },
          "foreignFamilies": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "familyId": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "originCivilizationId": {
                  "type": "string"
                },
                "originCivilizationName": {
                  "type": "string"
                },
                "population": {
                  "type": "integer",
                  "minimum": 0
                },
                "unhappy": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Zero when loyalToRuler is true; otherwise floor(population / citizensPerForeignFamilyUnhappy)."
                },
                "loyalToRuler": {
                  "type": "boolean",
                  "description": "Whether the family\u2019s effective allegiance (its own loyalToPlayerId, otherwise the nearest ancestor\u2019s) matches the current city owner. True exempts this family from the family penalty without changing historical origin or the ethnicity penalty."
                }
              },
              "required": [
                "familyId",
                "name",
                "originCivilizationId",
                "originCivilizationName",
                "population",
                "unhappy",
                "loyalToRuler"
              ]
            },
            "description": "All foreign-origin families represented by citizens in this city, including loyal families and groups below the threshold. Loyal families remain visible with unhappy:0 and a zero-valued family effect explaining the exemption."
          },
          "empirePopulation": {
            "type": "integer",
            "minimum": 0,
            "description": "Republic and Democracy: total resident population across owned cities, excluding units."
          },
          "empireForeignEthnicities": {
            "type": "array",
            "description": "Republic and Democracy: each foreign ethnicity\u2019s empire-wide resident share and whether it reaches the ten-percent penalty threshold. Persian tolerance waives penalties without hiding counts.",
            "items": {
              "type": "object",
              "properties": {
                "ethnicityId": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "population": {
                  "type": "integer",
                  "minimum": 0
                },
                "qualifies": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "required": [
          "population",
          "rawLimit",
          "minimumContent",
          "minimumAdjustment",
          "allContent",
          "preventedUnhappy",
          "effects",
          "foreignPopulation",
          "citizensPerForeignUnhappy",
          "foreignEthnicityUnhappy",
          "foreignEthnicities",
          "citizensPerForeignFamilyUnhappy",
          "foreignFamilyUnhappy",
          "foreignFamilies"
        ],
        "description": "Demographic group counts are local citizens, except the explicitly named empirePopulation and empireForeignEthnicities for elected governments. Numeric effects sum to rawLimit; minimumAdjustment=max(0,1-rawLimit). Without allContent, limit=rawLimit+minimumAdjustment. Shakespeare\u2019s Theatre sets allContent=true and limit=population; preventedUnhappy records how many would otherwise be unhappy. Ethnicity is pooled across foreign ethnicities; foreign-origin families each round down separately unless direct or inherited allegiance matches the current city owner. Loyal families have no family penalty, but foreign ethnicity still counts and historical origin never changes. Zero-penalty foreign groups remain visible. No hidden foreign city or unit counts are included."
      },
      "CitizenAssignment": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "citizenId": {
                "type": "string"
              },
              "kind": {
                "const": "tile"
              },
              "tileId": {
                "type": "string"
              }
            },
            "required": [
              "citizenId",
              "kind",
              "tileId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "citizenId": {
                "type": "string"
              },
              "kind": {
                "const": "district"
              },
              "districtId": {
                "type": "string",
                "description": "science, commerce, industrial, religious, entertainment or administrative (the governor)."
              }
            },
            "required": [
              "citizenId",
              "kind",
              "districtId"
            ],
            "additionalProperties": false
          }
        ]
      },
      "BuildingWorkRules": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "cost": {
            "type": "integer"
          },
          "tech": {
            "type": [
              "string",
              "null"
            ]
          },
          "yields": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            },
            "description": "Universal building base output. Palace and Government Quarters each have gold/culture/production/science 1. Effective staffed office base output in gold/science/production/culture order is Republic 3/3/1/1, Democracy 4/4/1/2 and Dictatorship 2/1/4/1; owner workplace yields add personal traits, while city aggregation applies percentages."
          },
          "district": {
            "type": [
              "string",
              "null"
            ],
            "description": "The district this building belongs to, or null for passive buildings and wonders."
          },
          "districtSlot": {
            "type": "boolean",
            "description": "The building opens one worker slot in its district."
          },
          "content": {
            "type": "integer",
            "minimum": 0,
            "description": "Content capacity: per priest in the religious district, once while the district is worked for Entertainment buildings and the Courthouse, otherwise passive."
          },
          "growthCap": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Aqueduct: 12; Sewer: null (no upper population limit). The population the city may grow to while this building is intact."
          },
          "needsFreshWaterNearby": {
            "type": "boolean",
            "description": "Aqueduct: requires a fresh-water hex among the hexes the city can work (city.freshWaterNearby), and is not built by a city on a river or beside a lake (city.freshWater), which needs none."
          },
          "needsWaterSupply": {
            "type": "boolean",
            "description": "Sewer: requires an Aqueduct, or a city on a river or beside a lake (city.freshWater)."
          },
          "foodRetention": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Passive fraction of the new population's food threshold retained after natural growth, plus ordinary overflow, or refilled after starvation population loss if the city survives. Granary: 0.5. Requires an undamaged Granary, but no worker."
          },
          "minPopulation": {
            "type": "integer",
            "description": "Minimum city population to build or buy this project; Palace and Government Quarters require three."
          },
          "capitalOnly": {
            "type": "boolean",
            "description": "Only the current capital can build this project (Palace)."
          },
          "nonCapitalOnly": {
            "type": "boolean",
            "description": "Only cities other than the current capital can build this project (Government Quarters)."
          },
          "repairBuildingId": {
            "type": "string",
            "description": "Present only on repair projects. The built building to restore; project id is repair_BUILDING_ID, kind building, cost ceil(original cost/2). Requires damage, no new technology or population requirement. Completes through shields at the next owning income with enough production; cannot be rushed with gold."
          }
        }
      },
      "MapOffer": {
        "type": "object",
        "properties": {
          "tiles": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of giver-known coordinates the receiver has never explored."
          },
          "value": {
            "type": "integer",
            "minimum": 0,
            "description": "Estimated map value, one gold per five new tiles rounded down; acceptance still depends on AI attitude and temperament."
          }
        },
        "required": [
          "tiles",
          "value"
        ],
        "additionalProperties": false,
        "description": "Owner-only aggregate map-sale quote. No buyer map coordinates or hidden entities are exposed."
      },
      "TradeSide": {
        "type": "object",
        "properties": {
          "techIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Technologies this side gives. New offers always use techIds."
          },
          "techId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Single technology of an offer saved before techIds; read techIds when present."
          },
          "gold": {
            "type": "integer",
            "minimum": 0
          },
          "maps": {
            "const": true,
            "description": "Present only when this side gives its explored map; maps trade only between a person and a computer leader."
          }
        },
        "required": [
          "gold"
        ],
        "additionalProperties": false
      },
      "FamilyTrait": {
        "type": "object",
        "required": [
          "id",
          "name",
          "kind",
          "description",
          "acquisition",
          "chance"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "dwelling",
              "profession",
              "character",
              "feat"
            ]
          },
          "description": {
            "type": "string",
            "description": "Effect on exact family members."
          },
          "acquisition": {
            "type": "string",
            "description": "Qualifying event and acquisition chance."
          },
          "chance": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 1,
            "description": "Chance contributed by a qualifying worker/unit/event; family acquisition combines opportunities with a category cap. Null means character development uses familyTraitRules, or 1 divided by player count for Great scientists."
          }
        }
      },
      "GovernorOption": {
        "type": "object",
        "properties": {
          "citizenId": {
            "type": "string"
          },
          "familyId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "appointed": {
            "type": "boolean"
          },
          "available": {
            "type": "boolean"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "description": "An owner-only resident candidate for Government Quarters. Palace options are unavailable because its ruling-family governor is automatic."
      },
      "ElectionCandidate": {
        "type": "object",
        "properties": {
          "familyId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "population": {
            "type": "integer",
            "minimum": 0,
            "description": "Current eligible resident count in this family."
          },
          "averagePopulation": {
            "type": "number",
            "description": "Current resident count for new elections; historical average in older reports."
          },
          "governorService": {
            "type": "number",
            "description": "Recorded income phases; no direct ballot multiplier."
          },
          "incumbentMultiplier": {
            "type": "number"
          },
          "score": {
            "type": "number",
            "description": "Appeal without population. National record for Republic; scandal factor for Democracy."
          },
          "governorBonus": {
            "type": "number",
            "description": "Zero in the electoral overhaul; preserved in older reports."
          },
          "performanceMultiplier": {
            "type": "number",
            "minimum": 0.75,
            "maximum": 1.25,
            "description": "Regular incumbent term-performance factor; one for challengers and inaugural elections."
          },
          "probability": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Expected first-round individual ballot share before hidden campaign swings; not the probability of winning."
          },
          "expectedVotes": {
            "type": "number",
            "minimum": 0,
            "description": "Expected first-round ballot share multiplied by eligibleVoters, before campaign randomness."
          },
          "votes": {
            "type": "integer",
            "minimum": 0,
            "description": "Completed election results only: actual ballots cast for this family."
          },
          "campaignMultiplier": {
            "type": "number",
            "minimum": 0.85,
            "maximum": 1.15,
            "description": "Completed election results only: family\u2019s saved hidden campaign swing."
          },
          "adjustedSupport": {
            "type": "number",
            "minimum": 0,
            "description": "Appeal times campaign swing and paid campaign boost. Individual ballots also apply local preferences."
          },
          "governorServiceWeight": {
            "type": "number",
            "description": "Applied election service coefficient: 0.25 for an Ambitious family and 0.2 otherwise. Optional in historical saved results."
          },
          "standing": {
            "type": "number",
            "description": "Nomination rank combines current residents, power and appeal. Only five stand."
          }
        },
        "description": "Owner-only nomination standing, size-free ballot appeal and expected first-ballot vote shares. Republic uses local patronage and national record; Democracy uses personal views and local record. Historical records retain their original fields."
      },
      "GovernmentDetails": {
        "type": "object",
        "properties": {
          "id": {
            "enum": [
              "despotism",
              "monarchy",
              "republic",
              "democracy",
              "dictatorship"
            ]
          },
          "name": {
            "type": "string"
          },
          "strength": {
            "type": "integer",
            "enum": [
              1,
              2
            ]
          },
          "completedOwnTurns": {
            "type": "integer",
            "minimum": 0
          },
          "rulingFamilyId": {
            "type": [
              "string",
              "null"
            ]
          },
          "rulingFamilyName": {
            "type": [
              "string",
              "null"
            ]
          },
          "nationalBonuses": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "traitId": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                }
              }
            }
          },
          "election": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "turnsRemaining": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "termTurns": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "candidates": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/ElectionCandidate"
                    }
                  },
                  "lastResult": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/ElectionResult"
                      }
                    ]
                  },
                  "period": {
                    "type": "integer",
                    "enum": [
                      6,
                      10
                    ]
                  },
                  "governorInfluence": {
                    "type": "boolean",
                    "description": "True for Republic local patronage; false for Democracy. Direct historical governor-service ballot bonuses no longer apply."
                  },
                  "performance": {
                    "$ref": "#/components/schemas/ElectionPerformance"
                  },
                  "electorate": {
                    "$ref": "#/components/schemas/ElectionElectorate"
                  }
                }
              }
            ]
          },
          "reform": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "governmentId": {
                    "enum": [
                      "monarchy",
                      "republic",
                      "democracy",
                      "dictatorship"
                    ]
                  },
                  "status": {
                    "enum": [
                      "waiting_election",
                      "transition"
                    ]
                  },
                  "turnsRemaining": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "cost": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "crownFamilyId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              }
            ]
          },
          "reformCooldownRemaining": {
            "type": "integer",
            "minimum": 0
          },
          "reformOptions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "governmentId": {
                  "enum": [
                    "monarchy",
                    "republic",
                    "democracy",
                    "dictatorship"
                  ]
                },
                "cost": {
                  "type": "integer",
                  "minimum": 0
                },
                "available": {
                  "type": "boolean"
                },
                "reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "modifiers": {
            "type": "object",
            "properties": {
              "gold": {
                "type": "number",
                "minimum": 0
              },
              "science": {
                "type": "number",
                "minimum": 0
              },
              "culture": {
                "type": "number",
                "minimum": 0
              },
              "unitProduction": {
                "type": "number",
                "minimum": 0
              },
              "militaryProduction": {
                "type": "number",
                "minimum": 0
              },
              "militaryUpkeep": {
                "type": "number",
                "minimum": 0,
                "description": "Relative to the base military upkeep of 2 gold; use militaryUpkeepPerUnit for the exact gold charge."
              }
            },
            "description": "Effective government multiplier fractions; 1.5 means +50%, before reform-transition penalties."
          },
          "dictatorship": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "windowTurns": {
                    "const": 5
                  },
                  "candidates": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/DictatorshipCandidate"
                    }
                  }
                }
              }
            ]
          },
          "warWeariness": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/WarWeariness"
              }
            ]
          },
          "lastSuccession": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/SuccessionResult"
              },
              {
                "type": "null"
              }
            ]
          },
          "militaryUpkeepPerUnit": {
            "type": "integer",
            "minimum": 1,
            "description": "Gold per chargeable military unit per own turn: Despotism 2, Monarchy 1, Republic 3, Democracy 4, Dictatorship 1. Siege, ships and aircraft count; Workers and Scouts pay half; Settlers are exempt. Every government supports one unit per city free of charge."
          },
          "freeUnitsPerCity": {
            "type": "integer",
            "minimum": 0,
            "description": "Full units each owned city supports without upkeep: 1 in every government."
          }
        },
        "description": "Owner-only government, national policies, output/upkeep multipliers, election franchise and forecasts, Dictatorship support, Democratic war weariness and reform availability. Republic elects every ten own turns and Democracy every six. Elections restrict voters and candidates by original ethnicity and, in Democracy, family loyalty; Republic holds a top-two runoff if nobody exceeds 50%; Democracy holds a runoff for an exact 50\u201350 vote between its two leaders. Tied runoffs repeat until one family exceeds 50%. Dictatorship chooses by support on entry or family extinction; sustained rival backing can also trigger an internal leadership challenge. Clients cannot choose the ruler. Legacy reads normalize missing ledgers without rewriting storage. Elections save all rounds and term-performance factors; forecast ballot share is not a promise of victory. Power struggles and royal successions save lastSuccession with candidate backing, eligibility, random swing and final score."
      },
      "DictatorshipCandidate": {
        "type": "object",
        "properties": {
          "familyId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "population": {
            "type": "integer",
            "minimum": 0
          },
          "militarySupport": {
            "type": "number",
            "minimum": 0
          },
          "averageGovernorships": {
            "type": "number",
            "minimum": 0
          },
          "governorSupport": {
            "type": "number",
            "minimum": 0
          },
          "score": {
            "type": "number",
            "minimum": 0
          },
          "wealthPower": {
            "type": "number",
            "description": "Government wealth weight times private wealth / 20. Omitted when exact wealth is private."
          }
        },
        "description": "Owner-only Dictatorship support: sum eligible unit max(baseStrength,baseRanged)*hp/maxHp, plus ten times staffed governorships from the last five completed income phases divided by five. Civilians/scouts excluded; siege/naval/air included; family and terrain bonuses excluded. Missing phases count as zero. These are raw forecasts. Committing a contest applies a random 0.8\u20131.2 multiplier to each family; highest adjusted support wins (family ID breaks exact ties). Rising support does not replace a surviving ruling family."
      },
      "WarWeariness": {
        "type": "object",
        "properties": {
          "penalty": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4
          },
          "offensiveTurns": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2
          },
          "peacefulTurns": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1
          },
          "attackedThisTurn": {
            "type": "boolean"
          }
        },
        "description": "Owner-only Democracy record. A nonbarbarian attack/capture outside own territory, measured before the action, flags the turn; air sorties count even if intercepted. Every three completed offensive own turns add one content penalty per city up to four. Two consecutive quiet own turns remove one; partial offensive progress remains. Outside Democracy the record is retained with effects and advancement suspended. Reads and exact retries do not change it."
      },
      "ElectionPerformance": {
        "type": "object",
        "properties": {
          "citiesTaken": {
            "type": "integer",
            "minimum": 0
          },
          "citiesLost": {
            "type": "integer",
            "minimum": 0
          },
          "militaryKills": {
            "type": "integer",
            "minimum": 0
          },
          "militaryLosses": {
            "type": "integer",
            "minimum": 0
          },
          "technologiesDiscovered": {
            "type": "integer",
            "minimum": 0,
            "description": "Own research and Darwin's Voyage free discoveries during this term. Diplomatic technology transfers do not count. Optional on historical records."
          },
          "worldFirstDiscoveries": {
            "type": "integer",
            "minimum": 0,
            "description": "Subset of technologiesDiscovered that no other civilization knew immediately before discovery; each adds 0.05 to the incumbent's performance adjustment. Optional on historical records."
          },
          "citiesFounded": {
            "type": "integer",
            "minimum": 0,
            "description": "Cities founded during this term, including overseasCitiesFounded. Each adds 0.05 to the incumbent's performance adjustment. Optional on historical records."
          },
          "overseasCitiesFounded": {
            "type": "integer",
            "minimum": 0,
            "description": "Subset of citiesFounded on a different landmass from the current capital at founding. Adds a further 0.05, for 0.10 total per overseas city. Connected nonwater hexes include mountains and map wrapping and ignore ownership; the first city is ordinary founding. Optional on historical records."
          },
          "technologyTrackingComplete": {
            "type": "boolean",
            "description": "Whether technology discovery tracking covers the whole current or saved term. New terms are true; legacy terms missing discovery history are false until their next reset. Optional on historical records."
          },
          "noTechnologyPenalty": {
            "type": "number",
            "enum": [
              -0.05,
              0
            ],
            "description": "Signed performance adjustment: -0.05 when at least one term turn has completed, technologiesDiscovered is zero and technologyTrackingComplete is true; otherwise zero, including inaugural elections. Optional on historical records."
          },
          "multiplier": {
            "type": "number",
            "minimum": 0.75,
            "maximum": 1.25
          }
        },
        "description": "Owner-only current or completed election-term performance. Incumbent factor = 1 + clamp(.05*citiesTaken - .10*citiesLost + .01*militaryKills - .02*militaryLosses + .05*citiesFounded + .05*overseasCitiesFounded + .05*worldFirstDiscoveries + noTechnologyPenalty,-.25,.25). Military performance counts foreign-civilization combat only; destroyed or captured military units count as kills/losses; civilians, scouts and barbarians are excluded. Own research and Darwin's Voyage count as discoveries, diplomatic transfers do not. Legacy terms without complete discovery tracking waive the no-discovery penalty until reset, while new achievements still count. All new fields are optional for unchanged historical results/events. Initial elections ignore this factor."
      },
      "ElectionResult": {
        "type": "object",
        "properties": {
          "completedOwnTurn": {
            "type": "integer",
            "minimum": 0
          },
          "winnerFamilyId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Final winning family, even if different from the first-round leader; null when no voters are eligible."
          },
          "previousFamilyId": {
            "type": [
              "string",
              "null"
            ]
          },
          "initial": {
            "type": "boolean"
          },
          "performance": {
            "$ref": "#/components/schemas/ElectionPerformance"
          },
          "totalVotes": {
            "type": "integer",
            "minimum": 0,
            "description": "First-round eligible ballots, not the sum of all rounds."
          },
          "candidates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ElectionCandidate"
            },
            "description": "Saved first-round candidates and actual ballots, retained here for compatibility. Read rounds for the runoff."
          },
          "rounds": {
            "type": "array",
            "maxItems": 2,
            "items": {
              "$ref": "#/components/schemas/ElectionRound"
            },
            "description": "Both recorded rounds, or one for an immediate first-round victory. Empty if no voters are eligible. Omitted in older results."
          },
          "runoff": {
            "type": "boolean",
            "description": "Whether a second round was held."
          },
          "finalRound": {
            "type": [
              "integer",
              "null"
            ],
            "enum": [
              1,
              2,
              null
            ],
            "description": "Winning round, or null when no voters are eligible."
          },
          "electorate": {
            "$ref": "#/components/schemas/ElectionElectorate"
          },
          "status": {
            "enum": [
              "elected",
              "no_eligible_voters"
            ],
            "description": "No eligible voters records an empty ballot and leaves the current ruler unchanged; winnerFamilyId is null."
          },
          "coalitionFamilyIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "platform": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "voterFamilies": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "seats": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object"
            }
          },
          "cityResults": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "previousPlatform": {
            "type": "object"
          },
          "coalitionNegotiations": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "mandate": {
            "type": "number",
            "minimum": 0
          },
          "politicalCapital": {
            "type": "integer",
            "minimum": 0,
            "description": "Political capital in whole points, rounded down. Historical saved fractions are floored in the projection."
          },
          "minority": {
            "type": "boolean"
          }
        },
        "description": "Saved owner-only election. Republic uses one or two ballots and final voter-family tallies; Democracy uses one ballot, 100 seats and a negotiated coalition. Historical results remain unchanged."
      },
      "ElectionElectorate": {
        "type": "object",
        "properties": {
          "nativeEthnicityId": {
            "type": [
              "string",
              "null"
            ]
          },
          "nativeEthnicityName": {
            "type": [
              "string",
              "null"
            ]
          },
          "residentPopulation": {
            "type": "integer",
            "minimum": 0
          },
          "eligibleVoters": {
            "type": "integer",
            "minimum": 0
          },
          "excludedResidents": {
            "type": "integer",
            "minimum": 0
          },
          "eligibleFamilyIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rule": {
            "enum": [
              "native_only",
              "native_or_loyal"
            ]
          }
        },
        "description": "Owner-only current or saved electorate. Republic admits only residents and candidate families of the civilization's original ethnicity; Democracy also admits foreign families with effective direct or inherited loyalty to the current player and their residents. Candidate families need eligible residents. Units never vote. Original ethnicity does not change with the ruler. residentPopulation equals eligibleVoters plus excludedResidents. Eligibility is evaluated at forecast/election time, preserving historical term population and empire-wide contentment counters."
      },
      "ElectionTransfer": {
        "type": "object",
        "properties": {
          "fromFamilyId": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "description": "Saved name of the first-round candidate."
          },
          "totalVotes": {
            "type": "integer",
            "minimum": 0
          },
          "votesByFamily": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "minimum": 0
            },
            "description": "Finalist family IDs mapped to second-round ballot counts; sums to totalVotes."
          }
        },
        "description": "Saved runoff transfers grouped by the candidate each voter supported in round one, not the voter's own family. Includes supporters of finalists as well as eliminated candidates."
      },
      "ElectionRound": {
        "type": "object",
        "properties": {
          "number": {
            "type": "integer",
            "enum": [
              1,
              2
            ]
          },
          "totalVotes": {
            "type": "integer",
            "minimum": 0
          },
          "candidates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ElectionCandidate"
            }
          },
          "winnerFamilyId": {
            "type": [
              "string",
              "null"
            ]
          },
          "transfers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ElectionTransfer"
            },
            "description": "Runoff only: saved second-round choices grouped by first-round candidate."
          }
        },
        "description": "Saved election round. At least 50% of first-round votes wins immediately; otherwise winnerFamilyId is null and the top two face round two. Both rounds use the same eligible voters; totals must not be added. Vote ties use expected support, incumbent, then a stable seeded draw. Only the last round names the final winner."
      },
      "SuccessionResult": {
        "type": "object",
        "description": "Private recorded power-struggle or royal-succession outcome. Seeded 0.8\u20131.2 swings are committed once, never rerolled by reads or retries. Highest eligible adjusted support wins (family ID breaks exact ties). Absent for legacy contests. Event snapshots also carry id/seq/turn/round/text/kind/playerId/familyId/fromFamilyId.",
        "properties": {
          "governmentId": {
            "enum": [
              "dictatorship",
              "monarchy"
            ]
          },
          "reason": {
            "enum": [
              "reform",
              "extinction"
            ]
          },
          "sequence": {
            "type": "integer",
            "minimum": 1
          },
          "completedOwnTurn": {
            "type": "integer"
          },
          "previousFamilyId": {
            "type": [
              "string",
              "null"
            ]
          },
          "previousFamilyName": {
            "type": "string"
          },
          "winnerFamilyId": {
            "type": "string"
          },
          "winnerFamilyName": {
            "type": "string"
          },
          "randomMinimum": {
            "const": 0.8
          },
          "randomMaximum": {
            "const": 1.2
          },
          "equalFallback": {
            "type": "boolean",
            "description": "Every eligible raw score was zero: use base backing 1 before the swing."
          },
          "candidates": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "Dictatorship candidates retain militarySupport, averageGovernorships and governorSupport. Monarchy candidates retain lifetime governorService and governorSupport=10*service; score=population+governorSupport. Only closest surviving descendant branches qualify, or all living domestic families if no descendants remain.",
              "properties": {
                "familyId": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "population": {
                  "type": "integer"
                },
                "score": {
                  "type": "number"
                },
                "eligible": {
                  "type": "boolean"
                },
                "dynasticDistance": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "Monarchy only: generations from former ruler, null outside that dynasty."
                },
                "swingMultiplier": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "minimum": 0.8,
                  "maximum": 1.2,
                  "description": "Null for ineligible later dynastic branches."
                },
                "adjustedSupport": {
                  "type": "number",
                  "minimum": 0
                }
              }
            }
          }
        }
      },
      "PoliticalFamily": {
        "type": "object",
        "properties": {
          "opposition": {
            "type": "array",
            "description": "Why the house is in opposition; empty when it is not. stance is opposition whenever this is not empty.",
            "items": {
              "type": "object",
              "properties": {
                "cause": {
                  "type": "string",
                  "enum": [
                    "grievance",
                    "views",
                    "ambition",
                    "election"
                  ]
                },
                "route": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                }
              }
            }
          },
          "aggrieved": {
            "type": "boolean",
            "description": "Grievance minus fear has reached the house's limit, or it is committed to a conspiracy."
          },
          "convinced": {
            "type": "boolean",
            "description": "Under an elected government: leans 40 or more towards authority and prefers an autocracy."
          },
          "shutOut": {
            "type": "boolean",
            "description": "Under an elected government: a voting house outside the governing coalition and without office."
          },
          "termLimitClaim": {
            "type": "object",
            "description": "Present while a Republic's ruling house barred from a third term may refuse the election held without it."
          },
          "familyId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "grievance": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "stance": {
            "enum": [
              "government",
              "discontent",
              "opposition"
            ]
          },
          "preferredGovernmentId": {
            "type": "string"
          },
          "population": {
            "type": "integer"
          },
          "unhappy": {
            "type": "integer"
          },
          "militarySupport": {
            "type": "number",
            "description": "Potential health-adjusted military backing, including eligible disbanded units."
          },
          "averageGovernorships": {
            "type": "number"
          },
          "patronageRemaining": {
            "type": "integer"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "ambition": {
            "type": "number",
            "description": "Drive for leadership, independent of grievances."
          },
          "disbandedUnits": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of retained disbanded units, including civilians."
          },
          "disbandedRemaining": {
            "type": "integer",
            "minimum": 0,
            "description": "Longest remaining retention window, measured in completed own turns."
          },
          "disbandmentRemaining": {
            "type": "integer",
            "minimum": 0,
            "description": "Own turns remaining for grievance pressure caused by disbandment."
          },
          "disbandedMilitarySupport": {
            "type": "number",
            "minimum": 0,
            "description": "The part of militarySupport provided by retained disbanded units; civilians and scouts add none."
          },
          "wealthPower": {
            "type": "number",
            "description": "Government wealth weight times private wealth / 20. Omitted when exact wealth is private."
          },
          "power": {
            "type": "number"
          },
          "foreignRulerGrievance": {
            "type": "integer",
            "enum": [
              0,
              1
            ],
            "description": "Additional grievance per own turn for a family of the founding ethnicity while a family of another ethnicity rules. Ordinary calming effects can offset it. Applies under every government, including Persia."
          },
          "taxGrievance": {
            "type": "number"
          },
          "taxLegitimacy": {
            "type": "number"
          }
        },
        "description": "Owner-only family support within this country. Distinct from loyalToPlayerId national allegiance."
      },
      "InternalConflict": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "reform",
              "rebellion",
              "dictatorship",
              "election",
              "rivalry"
            ]
          },
          "mode": {
            "enum": [
              "civil_war",
              "coup"
            ]
          },
          "rebelPlayerId": {
            "type": "string"
          },
          "leaderFamilyId": {
            "type": "string"
          },
          "leaderName": {
            "type": "string"
          },
          "familyIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "governmentId": {
            "type": "string"
          },
          "governmentGovernmentId": {
            "type": "string"
          },
          "capitalCityId": {
            "type": "string"
          },
          "capitalTileId": {
            "type": "string"
          },
          "turnsRemaining": {
            "type": [
              "integer",
              "null"
            ]
          },
          "consolidationTurns": {
            "type": "integer"
          },
          "consolidatingSide": {
            "type": [
              "string",
              "null"
            ]
          },
          "incumbentDecision": {
            "type": "object",
            "description": "The ruling family\u2019s autonomous response to the challenge."
          },
          "headquartersRules": {
            "type": "integer",
            "description": "Version 2 protects the initial capital and treats an opening rebel-turn capital capture as a coup. Version 3 uses shared separation and surprise in every city on both sides, gives rebels the opening turn, classifies conflicts by initial rebel cities, and ends them immediately on headquarters capture. Coups also end after three rebel turns or destruction of opposition military forces."
          },
          "surprisedCityIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "All cities belonging to the affected country at the outbreak. Wall and garrison fortification protection is zero on both sides through the opening rebel turn."
          },
          "governmentFamilyId": {
            "type": [
              "string",
              "null"
            ]
          },
          "governmentHeadquartersId": {
            "type": [
              "string",
              "null"
            ]
          },
          "rebelHeadquartersId": {
            "type": [
              "string",
              "null"
            ]
          },
          "startedRound": {
            "type": "integer"
          },
          "rebelTurns": {
            "type": "integer"
          },
          "initialMilitaryStrength": {
            "type": "object",
            "description": "Health-adjusted land army estimates announced to both camps at the split.",
            "properties": {
              "government": {
                "type": "number"
              },
              "opposition": {
                "type": "number"
              }
            }
          },
          "recalledUnitIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Previously disbanded units successfully returned to the board before initial army strengths were computed."
          },
          "outbreakReport": {
            "$ref": "#/components/schemas/ConflictOutbreakReport"
          },
          "humanChoice": {
            "type": "object",
            "properties": {
              "status": {
                "enum": [
                  "pending",
                  "committed"
                ]
              },
              "side": {
                "enum": [
                  "government",
                  "opposition",
                  null
                ]
              },
              "playerId": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        },
        "description": "Saved internal conflict. Version 3: the government initially holds the capital and disloyal troops leave for nearby legal positions. Other cities follow family support: any rebel city at the outbreak makes a civil war, otherwise it is a coup. Rebels act first with wall and garrison fortification protection reset to zero in every city on both sides, and the government resumes without repeating income or production. Capturing the opposing headquarters wins a civil war immediately. Rebels win coups by capturing the government capital; the government wins by surviving three rebel turns or destroying all opposition military forces. Peace and independence is available after more than 20 rounds of civil war. Older conflicts retain their saved headquarters and resolution rules. Human-involved outbreaks pause after actual allegiance, militia, recalled troops, treasury and positions are finalized. The affected account submits choose_internal_side once. Human rebels play the opening turn; a government choice lets the rebel AI play first. The selected faction controls command authorization and determines campaign victory or defeat. Reloads and duplicate requests preserve this choice and opening boundary. Partition keeps only the selected side under human control."
      },
      "InternalPolitics": {
        "type": "object",
        "properties": {
          "opposition": {
            "type": "object",
            "description": "Every house that may move against the ruling family, whatever drives it (grievance, political views, ambition or a refused election). Empty for computer players, during a conspiracy and during an internal conflict. pause explains why no house can move now, when that is so.",
            "properties": {
              "pause": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "rows": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "familyId": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "route": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "dictatorship, election, term_limit, rivalry, rebellion (grievance), views (a rising to end elections), secession, succession, supporter (would follow another house's bloc), or null when the house cannot act."
                    },
                    "governmentId": {
                      "type": "string",
                      "description": "The government the challenge would install."
                    },
                    "ready": {
                      "type": "boolean",
                      "description": "True when the route is open now; chance is then the chance it is taken at the next income phase."
                    },
                    "chance": {
                      "type": "number"
                    },
                    "held": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "What holds the house back, when it is not ready."
                    },
                    "causes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Why the house is in opposition."
                    },
                    "familyIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "The bloc, leader included."
                    },
                    "militarySupport": {
                      "type": "number"
                    },
                    "governmentMilitarySupport": {
                      "type": "number"
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "civil_war",
                        "coup"
                      ]
                    }
                  }
                }
              }
            }
          },
          "norms": {
            "type": "object",
            "description": "Breaches of an elected government's norms still remembered (an internal conflict, emergency powers, a war declared against the Republic's vote). leaning is what every house moves towards authority each turn; factor multiplies every challenge chance.",
            "properties": {
              "count": {
                "type": "integer"
              },
              "leaning": {
                "type": "number"
              },
              "factor": {
                "type": "number"
              },
              "percent": {
                "type": "integer"
              },
              "turns": {
                "type": "integer"
              },
              "breaches": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string"
                    },
                    "turnsRemaining": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "families": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PoliticalFamily"
            }
          },
          "capitalDefenders": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "crisis": {
            "type": [
              "object",
              "null"
            ]
          },
          "conflict": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/InternalConflict"
              },
              {
                "type": "null"
              }
            ]
          },
          "lastConflict": {
            "type": [
              "object",
              "null"
            ],
            "description": "Last settlement, including any frozen outbreakReport and overthrowGrievance. A deposed ruling family receives at least 80 grievance; higher existing anger is retained."
          },
          "recoveryTurns": {
            "type": "integer"
          },
          "reformForecasts": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "riotCities": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "peace": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "available": {
                "type": "boolean"
              },
              "elapsedTurns": {
                "type": "integer"
              },
              "afterTurns": {
                "type": "integer",
                "const": 20
              },
              "independentName": {
                "type": "string"
              }
            },
            "description": "After more than twenty turns of civil war, offer_peace/accept_peace can recognize an independent civilization. Legal options are marked independence:true and explain the permanent territorial division."
          }
        },
        "description": "Owner-only political forecasts, warning, active conflict and latest settlement. Reads are pure; old saves begin political histories on mutation with five income phases of grace."
      },
      "RewindPoint": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "integer"
          },
          "round": {
            "type": "integer"
          },
          "turn": {
            "type": "integer"
          },
          "revision": {
            "type": "integer"
          },
          "kind": {
            "enum": [
              "turn_start",
              "checkpoint",
              "before_rewind",
              "marked"
            ]
          },
          "created": {
            "type": "integer"
          },
          "label": {
            "type": [
              "string",
              "null"
            ],
            "description": "Label for a preserved marked position. Legacy test checkpoints may be mid-turn; loading resumes the side whose turn was saved."
          }
        },
        "required": [
          "id",
          "round",
          "turn",
          "revision",
          "kind",
          "created"
        ]
      },
      "RewindHistory": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "revision": {
            "type": "integer"
          },
          "preparing": {
            "type": "boolean",
            "const": false
          },
          "error": {
            "type": "string"
          },
          "points": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RewindPoint"
            }
          },
          "anyTurn": {
            "type": [
              "object",
              "null"
            ],
            "description": "Available turn-start snapshots. Load directly with round and playerId. Older games may have gaps; absent snapshots return 404.",
            "properties": {
              "firstRound": {
                "type": "integer"
              },
              "lastRound": {
                "type": "integer"
              },
              "sides": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "civilization": {
                      "type": "string"
                    },
                    "civilizationName": {
                      "type": "string"
                    },
                    "internalFactionOf": {
                      "type": "string"
                    },
                    "eliminated": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          }
        },
        "required": [
          "revision",
          "preparing",
          "points"
        ]
      },
      "RewindRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "entry": {
            "type": "integer",
            "minimum": 1,
            "description": "A listed position of the world history (points[].entry). Send one of entry, pointId, or round and playerId."
          },
          "pointId": {
            "type": "integer",
            "minimum": 1,
            "description": "A listed position saved by an older release (points[].id)."
          },
          "round": {
            "type": "integer",
            "minimum": 1,
            "description": "With playerId: load the full saved state at the start of that side\u2019s turn in this round."
          },
          "playerId": {
            "type": "string",
            "description": "With round: the side whose saved turn is loaded, one of anyTurn.sides."
          },
          "requestId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{8,80}$"
          }
        },
        "required": [
          "revision",
          "requestId"
        ]
      },
      "ConflictOutbreakReport": {
        "type": "object",
        "description": "Frozen national opening ledger, private during active play. Captured before the first rebel action, retained on the outbreak event and last settlement even after immediate victory. Formation is null for older mobilizations; missing past rolls are never reconstructed. Field strength is deployed land backing; family backing includes retained, air and naval units.",
        "properties": {
          "version": {
            "type": "integer",
            "const": 1
          },
          "round": {
            "type": "integer"
          },
          "mode": {
            "enum": [
              "coup",
              "civil_war"
            ]
          },
          "kind": {
            "type": "string"
          },
          "government": {
            "type": "object"
          },
          "opposition": {
            "type": "object"
          },
          "formation": {
            "type": [
              "object",
              "null"
            ],
            "description": "Original coalition membership, family figures and actual attempted challenge rolls. Reform opposition has no challenge rolls."
          },
          "incumbentDecision": {
            "type": "object",
            "description": "Actual concession roll and threshold, decision, character, and the military/population shares used."
          },
          "families": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "cities": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Resident counts plus governor service weight, popular majority, initial control and capital override."
          },
          "units": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Every original or recalled rebel unit: identity, family, HP, backing, original tile, deployment, actual side and any cargo/surrender/recall exception."
          },
          "militaryStrength": {
            "type": "object"
          }
        }
      },
      "TakeoverRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "playerId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "requestId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{8,80}$"
          }
        },
        "required": [
          "revision",
          "playerId",
          "requestId"
        ]
      },
      "ReplayRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Open with entry, round and playerId, or live. Continue with session plus one of move, playerId, step and playback:true, or step and actions. Playback reads recorded history without altering the live game.",
        "properties": {
          "entry": {
            "type": "integer",
            "minimum": 1
          },
          "round": {
            "type": "integer",
            "minimum": 1,
            "maximum": 400
          },
          "playerId": {
            "type": "string",
            "maxLength": 120
          },
          "live": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "session": {
            "type": "string"
          },
          "move": {
            "type": "string",
            "enum": [
              "back",
              "forward"
            ]
          },
          "step": {
            "type": "integer",
            "minimum": 0
          },
          "actions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 24,
            "items": {
              "$ref": "#/components/schemas/Action"
            }
          },
          "playback": {
            "type": "boolean",
            "const": true,
            "description": "Advance one recorded history frame; requires session and current step."
          },
          "anchorEntry": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "description": "For move or playerId navigation only: the entry currently displayed by the client, or null for live. Preserves correct navigation if a paused playback request has advanced the server cursor offscreen."
          },
          "world": {
            "type": "boolean",
            "description": "With a session: true shows the whole map and steps through every side's turns; false returns to one side."
          }
        }
      },
      "ResearchBonus": {
        "type": "object",
        "description": "Aggregate research diffusion for this technology. Each bordering independent civilization that already knows it adds 20% of base science. Countries count once; temporary factions represent their parent country. No neighboring identities or foreign technology lists are disclosed.",
        "properties": {
          "techId": {
            "type": [
              "string",
              "null"
            ]
          },
          "neighborCount": {
            "type": "integer",
            "minimum": 0
          },
          "bonusPercent": {
            "type": "number",
            "minimum": 0
          },
          "multiplier": {
            "type": "number",
            "minimum": 1
          },
          "effectiveScience": {
            "type": "number",
            "minimum": 0
          }
        },
        "required": [
          "techId",
          "neighborCount",
          "bonusPercent",
          "multiplier",
          "effectiveScience"
        ],
        "additionalProperties": false
      },
      "ContinueRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "requestId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{8,80}$"
          },
          "session": {
            "type": "string"
          },
          "step": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "revision",
          "requestId",
          "session",
          "step"
        ]
      },
      "CityDistrict": {
        "type": "object",
        "description": "A district of an owned city. Every worker produces the summed yields of its intact buildings.",
        "properties": {
          "districtId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "worker": {
            "type": "string",
            "description": "Name of one worker, e.g. scholar."
          },
          "slots": {
            "type": "integer",
            "minimum": 0,
            "description": "Current worker slots: one per intact slot-giving building, capped at maxWorkers; one while any building stands if none of them is intact; the administrative district has one while its office is intact."
          },
          "maxWorkers": {
            "type": "integer"
          },
          "workers": {
            "type": "integer",
            "minimum": 0
          },
          "citizenIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "buildings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "buildingId": {
                  "type": "string"
                },
                "damaged": {
                  "type": "boolean"
                },
                "repairCost": {
                  "type": "integer"
                },
                "opensSlot": {
                  "type": "boolean"
                },
                "yields": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "number"
                  },
                  "description": "Added to every worker; the administrative district shows yields scaled by the government."
                },
                "content": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "required": [
                "buildingId",
                "damaged",
                "repairCost",
                "opensSlot",
                "yields",
                "content"
              ]
            }
          },
          "yields": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            },
            "description": "One worker's output before personal family traits and city-wide percentages."
          },
          "workerYields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "citizenId": {
                  "type": "string"
                },
                "yields": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "number"
                  }
                }
              },
              "required": [
                "citizenId",
                "yields"
              ]
            },
            "description": "Each actual worker's output including personal family traits."
          },
          "content": {
            "type": "integer",
            "minimum": 0,
            "description": "Content capacity this district currently provides."
          },
          "contentEach": {
            "type": "integer",
            "minimum": 0,
            "description": "Per worker in the religious district; otherwise once while the district is worked."
          },
          "contentPerWorker": {
            "type": "boolean"
          },
          "resourceCulture": {
            "type": [
              "object",
              "null"
            ],
            "description": "Each working priest in the Religious District adds +1 culture per connected local Spices deposit; each working performer in the Entertainment District adds +1 per connected local Wine deposit. Building count does not multiply the bonus. `culture` is per worker and is already included in the district's `yields`; an unstaffed district gives none. Null for other districts. `waiting` lists owned deposits within two hexes that give nothing yet: `improvement` when the Plantation is missing, `replaced` (with `improvement`) when another improvement such as a Canal stands on the deposit, `road` when no road reaches the city center.",
            "properties": {
              "resource": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "improvement": {
                "type": "string"
              },
              "deposits": {
                "type": "integer"
              },
              "buildings": {
                "type": "integer"
              },
              "perDeposit": {
                "type": "integer",
                "description": "Culture per working district worker per connected local deposit."
              },
              "culture": {
                "type": "integer"
              },
              "waiting": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "tileId": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string",
                      "enum": [
                        "improvement",
                        "replaced",
                        "road"
                      ]
                    },
                    "improvement": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "canAdd": {
            "type": "boolean"
          },
          "canRemove": {
            "type": "boolean"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why a worker cannot be added."
          },
          "removeReason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "districtId",
          "name",
          "worker",
          "slots",
          "maxWorkers",
          "workers",
          "citizenIds",
          "buildings",
          "yields",
          "workerYields",
          "content",
          "contentEach",
          "contentPerWorker",
          "canAdd",
          "canRemove",
          "reason",
          "removeReason"
        ]
      },
      "FamilyLoan": {
        "type": "object",
        "description": "Owner-visible family contract. Interest is 10% per started ten-own-turn block, at least one block, rounded up; debt remains owed and accrues after default.",
        "properties": {
          "id": {
            "type": "string"
          },
          "familyId": {
            "type": "string"
          },
          "principal": {
            "type": "integer",
            "minimum": 0
          },
          "borrowedOwnTurn": {
            "type": "integer"
          },
          "dueOwnTurn": {
            "type": "integer"
          },
          "amountDue": {
            "type": "integer",
            "minimum": 0
          },
          "turnsRemaining": {
            "type": "integer",
            "minimum": 0
          },
          "status": {
            "enum": [
              "active",
              "default",
              "repaid",
              "cancelled"
            ]
          },
          "paid": {
            "type": "integer",
            "minimum": 0
          },
          "closedOwnTurn": {
            "type": "integer"
          },
          "defaultedOwnTurn": {
            "type": "integer"
          },
          "playerId": {
            "type": "string"
          },
          "playerName": {
            "type": "string"
          }
        }
      },
      "FamilyLoanOffer": {
        "type": "object",
        "properties": {
          "familyId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "maxAmount": {
            "type": "integer",
            "minimum": 0
          },
          "wealthLimit": {
            "type": "integer",
            "minimum": 0
          },
          "available": {
            "type": "boolean"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "interestPerTenTurns": {
            "type": "number"
          },
          "dueTurns": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "FamilyTax": {
        "type": "object",
        "properties": {
          "rate": {
            "type": "integer",
            "minimum": 0
          },
          "min": {
            "type": "integer",
            "minimum": 0
          },
          "max": {
            "type": "integer",
            "minimum": 0
          },
          "defaultRate": {
            "type": "integer",
            "minimum": 0
          },
          "step": {
            "type": "integer",
            "minimum": 0
          },
          "cooldownRemaining": {
            "type": "integer",
            "minimum": 0
          },
          "nextChangeOwnTurn": {
            "type": "integer",
            "minimum": 0
          },
          "forecasts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "rate": {
                  "type": "integer",
                  "minimum": 0
                },
                "stateIncome": {
                  "type": "number"
                },
                "privateIncome": {
                  "type": "number"
                },
                "challengeRisk": {
                  "type": "number"
                },
                "grievances": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "familyId": {
                        "type": "string"
                      },
                      "grievance": {
                        "type": "number"
                      },
                      "legitimacy": {
                        "type": "number"
                      },
                      "incomeShare": {
                        "type": "number"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "FamilyEconomy": {
        "type": "object",
        "description": "Pure owner-only forecast. State income includes upkeep and office stipends, before loan repayments.",
        "properties": {
          "tax": {
            "$ref": "#/components/schemas/FamilyTax"
          },
          "loans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FamilyLoan"
            }
          },
          "loanOffers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FamilyLoanOffer"
            }
          }
        }
      },
      "ElectoralDetails": {
        "type": [
          "object",
          "null"
        ],
        "description": "Owner-only coalition, capital, platform progress, city mandates, patronage or local approval, seats, candidate eligibility, emergency powers and war-consent forecasts. Legacy saves show zero capital and an empty platform until an election. Reads never mutate this state."
      },
      "AgreementSide": {
        "type": "object",
        "properties": {
          "goldPerTurn": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "luxuries": {
            "type": "array",
            "maxItems": 7,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "gold",
                "gems",
                "silk",
                "spices",
                "furs",
                "dyes",
                "wine"
              ]
            }
          }
        },
        "required": [
          "goldPerTurn",
          "luxuries"
        ]
      },
      "Agreement": {
        "type": "object",
        "description": "Visible only to the two partners (or at game end). Private physical source tile IDs and payment clocks are not exposed.",
        "properties": {
          "id": {
            "type": "string"
          },
          "by": {
            "type": "string"
          },
          "startedRound": {
            "type": "integer"
          },
          "give": {
            "$ref": "#/components/schemas/AgreementSide"
          },
          "get": {
            "$ref": "#/components/schemas/AgreementSide"
          }
        },
        "required": [
          "id",
          "by",
          "give",
          "get"
        ]
      },
      "LuxuryInventory": {
        "type": "object",
        "description": "Counts visible for every met civilization; no resource coordinates are revealed. Available means improved copies not committed to exports; a specific recipient also needs a route.",
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "gold",
              "gems",
              "silk",
              "spices",
              "furs",
              "dyes",
              "wine"
            ]
          },
          "owned": {
            "type": "integer",
            "minimum": 0
          },
          "improved": {
            "type": "integer",
            "minimum": 0
          },
          "exported": {
            "type": "integer",
            "minimum": 0
          },
          "available": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "CityTradePolicy": {
        "type": "object",
        "properties": {
          "foodLimit": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "productionLimit": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "foodReserve": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "foodTarget": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "productionTarget": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "foodPrice": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "productionPrice": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "protectFood": {
            "type": "boolean"
          }
        },
        "required": [
          "foodLimit",
          "productionLimit",
          "foodReserve",
          "foodTarget",
          "productionTarget",
          "foodPrice",
          "productionPrice",
          "protectFood"
        ],
        "additionalProperties": false
      },
      "CityTradeOverview": {
        "type": "object",
        "description": "Commercial data for own cities and current Trade Agreement partners. No foreign food reserves, construction projects, city policies or military details. Paths reveal commercial geometry, never terrain or units. Ships hostile to either endpoint exclude their own water hex and adjacent water hexes, never land or city centers. The route searches every remaining road/sea path; only a complete cut blocks delivery, such as a blockade covering every water exit from a port. Current rates are estimates; actual shipments are committed once at the seller\u2019s income phase and paid at that moment. Foreign goods are stored in a delivery ledger for the buyer\u2019s next income phase.",
        "properties": {
          "cities": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "name": {
                  "type": "string"
                },
                "ownerId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "tileId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "population": {
                  "type": "number"
                },
                "localFoodBalance": {
                  "type": "number"
                },
                "foodBalance": {
                  "type": "number"
                },
                "foodImports": {
                  "type": "number"
                },
                "foodExports": {
                  "type": "number"
                },
                "localProduction": {
                  "type": "number"
                },
                "production": {
                  "type": "number"
                },
                "productionImports": {
                  "type": "number"
                },
                "productionExports": {
                  "type": "number"
                },
                "gold": {
                  "type": "number"
                },
                "traders": {
                  "type": "number"
                },
                "freeTraders": {
                  "type": "number"
                },
                "available": {
                  "type": "object",
                  "description": "Uncommitted local output, after existing routes and protected local needs.",
                  "properties": {
                    "food": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000000
                    },
                    "production": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000000
                    }
                  }
                },
                "needs": {
                  "type": "object",
                  "properties": {
                    "food": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000000
                    },
                    "production": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000000
                    }
                  }
                },
                "prices": {
                  "type": "object",
                  "properties": {
                    "food": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 100
                    },
                    "production": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 100
                    }
                  }
                },
                "policy": {
                  "$ref": "#/components/schemas/CityTradePolicy",
                  "description": "Own city only."
                },
                "editable": {
                  "type": "boolean",
                  "description": "Own city only; false for cities outside direct control."
                },
                "foodStored": {
                  "type": "number",
                  "description": "Own city only."
                },
                "turnsUntilStarvation": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "Own city only. First income phase that exhausts food, assuming current output and population."
                },
                "withoutImports": {
                  "type": "number",
                  "description": "Own city only: food balance if all imports stop."
                },
                "turnsWithoutImports": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "Own city only; excludes already purchased deliveries."
                },
                "delivery": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "description": "Own city only; purchased food/production awaiting its income phase."
                },
                "importDiscount": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Gold discounted from each incoming route total, capped at actual delivery price."
                },
                "routeCapacity": {
                  "enum": [
                    10,
                    15,
                    20
                  ]
                },
                "dispatch": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "description": "Own cities only: goods this city returns under foreign barter routes, deducted at its next income phase."
                }
              }
            }
          },
          "routes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "sellerCityId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "buyerCityId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "operatorCityId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "operatorId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "sellerId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "buyerId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "proposedBy": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "good": {
                  "enum": [
                    "food",
                    "production"
                  ]
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 20
                },
                "unitPrice": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 100
                },
                "status": {
                  "enum": [
                    "pending",
                    "active"
                  ]
                },
                "delivered": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 20
                },
                "payment": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 2000,
                  "description": "Full seller payment; buyerPayment is reduced by the local Gold discount."
                },
                "reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "path": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  }
                },
                "lastDelivery": {
                  "type": "object",
                  "properties": {
                    "turn": {
                      "type": "integer"
                    },
                    "quantity": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 20
                    },
                    "gold": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 600
                    }
                  }
                },
                "buyerPayment": {
                  "type": "integer",
                  "minimum": 0
                },
                "discount": {
                  "type": "integer",
                  "minimum": 0
                },
                "importDiscount": {
                  "type": "integer",
                  "minimum": 0
                },
                "capacity": {
                  "enum": [
                    0,
                    10,
                    15,
                    20
                  ]
                },
                "returnGood": {
                  "enum": [
                    "food",
                    "production"
                  ],
                  "description": "Present on barter routes: the good the buyer city returns instead of gold. Barter routes have no unitPrice."
                },
                "returnQuantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 20
                },
                "returnDelivered": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 20,
                  "description": "Barter: returned units expected this income phase."
                }
              }
            }
          },
          "connections": {
            "type": "array",
            "description": "Available in full UI projections; omitted from lightweight action/AI path computations as an empty list.",
            "items": {
              "type": "object",
              "properties": {
                "fromCityId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "toCityId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "reachable": {
                  "type": "boolean"
                },
                "path": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  }
                }
              }
            }
          },
          "rules": {
            "type": "object"
          }
        }
      }
    }
  }
}
