{
  "components": {
    "schemas": {
      "modelsv2.AccountConflictErrorResponse": {
        "properties": {
          "account": {
            "$ref": "#/components/schemas/modelsv2.AccountsLinkedPlayer"
          },
          "code": {
            "$ref": "#/components/schemas/modelsv2.ErrorCode"
          },
          "message": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AccountsCOCAccountRequest": {
        "properties": {
          "api_token": {
            "type": "string"
          },
          "player_tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AccountsLastLoginResponse": {
        "properties": {
          "timestamp": {
            "type": "string"
          },
          "updated_count": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.AccountsLinkResponse": {
        "properties": {
          "account": {
            "$ref": "#/components/schemas/modelsv2.AccountsLinkedPlayer"
          },
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AccountsLinkVisibilityRequest": {
        "properties": {
          "hidden": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "modelsv2.AccountsLinkedAccount": {
        "properties": {
          "added_at": {
            "type": "string"
          },
          "hidden": {
            "type": "boolean"
          },
          "is_verified": {
            "type": "boolean"
          },
          "last_login": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "order_index": {
            "type": "integer"
          },
          "player_tag": {
            "type": "string"
          },
          "user_id": {
            "type": "string"
          },
          "verified_at": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AccountsLinkedPlayer": {
        "properties": {
          "hidden": {
            "type": "boolean"
          },
          "is_verified": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "townHallLevel": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.AccountsListResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.AccountsLinkedAccount"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.AccountsMessageResponse": {
        "properties": {
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AccountsReorderAccountsRequest": {
        "properties": {
          "ordered_tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.Achievement": {
        "properties": {
          "asset_url": {
            "type": "string"
          },
          "earned_count": {
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "repeatable": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "modelsv2.AchievementsResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.Achievement"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.ActiveAnnouncementResponse": {
        "properties": {
          "item": {
            "$ref": "#/components/schemas/modelsv2.Announcement"
          }
        },
        "type": "object"
      },
      "modelsv2.AddClanResponse": {
        "properties": {
          "clan_name": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "server_id": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.Announcement": {
        "properties": {
          "banner_image_url": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "ends_at": {
            "type": "string"
          },
          "html_object_key": {
            "type": "string"
          },
          "html_url": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "min_app_version": {
            "type": "string"
          },
          "starts_at": {
            "type": "string"
          },
          "status": {
            "enum": [
              "draft",
              "scheduled",
              "published",
              "archived"
            ],
            "type": "string"
          },
          "subtitle": {
            "type": "string"
          },
          "target": {
            "enum": [
              "all",
              "ios",
              "android"
            ],
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AnnouncementListResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.Announcement"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.AnnouncementRequest": {
        "properties": {
          "banner_image_url": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "ends_at": {
            "type": "string"
          },
          "html_object_key": {
            "type": "string"
          },
          "html_url": {
            "type": "string"
          },
          "min_app_version": {
            "type": "string"
          },
          "starts_at": {
            "type": "string"
          },
          "status": {
            "enum": [
              "draft",
              "scheduled",
              "published",
              "archived"
            ],
            "type": "string"
          },
          "subtitle": {
            "type": "string"
          },
          "target": {
            "enum": [
              "all",
              "ios",
              "android"
            ],
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ApproveMessage": {
        "properties": {
          "message": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AuthDiscordOAuthRequest": {
        "properties": {
          "code": {
            "type": "string"
          },
          "code_verifier": {
            "type": "string"
          },
          "device_id": {
            "type": "string"
          },
          "redirect_uri": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AuthEmailAuthRequest": {
        "properties": {
          "device_id": {
            "type": "string"
          },
          "device_name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "password": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AuthEmailCodeRequest": {
        "properties": {
          "code": {
            "type": "string"
          },
          "email": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AuthEmailRegisterRequest": {
        "properties": {
          "device_id": {
            "type": "string"
          },
          "device_name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "locale": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "username": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AuthForgotPasswordRequest": {
        "properties": {
          "email": {
            "type": "string"
          },
          "locale": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AuthForgotPasswordResponse": {
        "properties": {
          "message": {
            "type": "string"
          },
          "reset_code": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AuthRefreshTokenRequest": {
        "properties": {
          "device_id": {
            "type": "string"
          },
          "refresh_token": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AuthRefreshTokenResponse": {
        "properties": {
          "access_token": {
            "type": "string"
          },
          "refresh_token": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AuthResetPasswordRequest": {
        "properties": {
          "device_id": {
            "type": "string"
          },
          "device_name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "new_password": {
            "type": "string"
          },
          "reset_code": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AuthResponse": {
        "properties": {
          "access_token": {
            "type": "string"
          },
          "refresh_token": {
            "type": "string"
          },
          "user": {
            "$ref": "#/components/schemas/modelsv2.AuthUserInfo"
          }
        },
        "type": "object"
      },
      "modelsv2.AuthUserInfo": {
        "properties": {
          "auth_methods": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "avatar_url": {
            "type": "string"
          },
          "user_id": {
            "type": "string"
          },
          "username": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AuthVerificationResponse": {
        "properties": {
          "message": {
            "type": "string"
          },
          "verification_code": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AuthWebRefreshResponse": {
        "properties": {
          "access_token": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AuthWebResponse": {
        "properties": {
          "access_token": {
            "type": "string"
          },
          "user": {
            "$ref": "#/components/schemas/modelsv2.AuthUserInfo"
          }
        },
        "type": "object"
      },
      "modelsv2.AutoBoardCapabilitiesResponse": {
        "properties": {
          "boardTypes": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.AutoBoardTypeCapability"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.AutoBoardConfig": {
        "properties": {
          "boardType": {
            "type": "string"
          },
          "channelDeleted": {
            "type": "boolean"
          },
          "channelId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "deliveryMode": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "intervalMinutes": {
            "type": "integer"
          },
          "lastRunAt": {
            "type": "string"
          },
          "messageId": {
            "type": "string"
          },
          "nextRunAt": {
            "type": "string"
          },
          "schedule": {
            "$ref": "#/components/schemas/modelsv2.AutoBoardSchedule"
          },
          "targetKind": {
            "type": "string"
          },
          "targetScope": {
            "type": "string"
          },
          "targets": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "threadId": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AutoBoardDeleteResponse": {
        "properties": {
          "deleted": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.AutoBoardItemResponse": {
        "properties": {
          "item": {
            "$ref": "#/components/schemas/modelsv2.AutoBoardConfig"
          }
        },
        "type": "object"
      },
      "modelsv2.AutoBoardRefreshIntervalCapability": {
        "properties": {
          "defaultMinutes": {
            "type": "integer"
          },
          "maxMinutes": {
            "type": "integer"
          },
          "minMinutes": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.AutoBoardSchedule": {
        "properties": {
          "dayOfMonth": {
            "type": "integer"
          },
          "kind": {
            "type": "string"
          },
          "timeOfDay": {
            "type": "string"
          },
          "weekdays": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.AutoBoardTypeCapability": {
        "properties": {
          "allowedModes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "allowedScopes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "boardType": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "maxTargets": {
            "type": "integer"
          },
          "minTargets": {
            "type": "integer"
          },
          "refreshInterval": {
            "$ref": "#/components/schemas/modelsv2.AutoBoardRefreshIntervalCapability"
          },
          "targetKind": {
            "type": "string"
          },
          "uiCapabilities": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.BanEdit": {
        "properties": {
          "previous": {
            "$ref": "#/components/schemas/modelsv2.BanEditPrevious"
          },
          "user": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BanEditPrevious": {
        "properties": {
          "reason": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BanItem": {
        "properties": {
          "DateCreated": {
            "type": "string"
          },
          "Notes": {
            "type": "string"
          },
          "VillageName": {
            "type": "string"
          },
          "VillageTag": {
            "type": "string"
          },
          "added_by": {
            "type": "string"
          },
          "added_by_avatar_url": {
            "type": "string"
          },
          "added_by_username": {
            "type": "string"
          },
          "clan_name": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "current_role": {
            "type": "string"
          },
          "edited_by": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.BanEdit"
            },
            "type": "array"
          },
          "image": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "server": {
            "type": "integer"
          },
          "town_hall": {
            "type": "integer"
          },
          "trophies": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.BanListResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.BanItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.BanMutationResponse": {
        "properties": {
          "player_name": {
            "type": "string"
          },
          "player_tag": {
            "type": "string"
          },
          "server_id": {
            "type": "integer"
          },
          "status": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BanRequest": {
        "properties": {
          "added_by": {
            "type": "string"
          },
          "image": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.Base": {
        "properties": {
          "baseLink": {
            "type": "string"
          },
          "channelId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "discordMessageUrl": {
            "type": "string"
          },
          "downloadCount": {
            "type": "integer"
          },
          "downloaders": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "downvotes": {
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "images": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "messageId": {
            "type": "string"
          },
          "serverId": {
            "type": "string"
          },
          "upvotes": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.BaseCreateErrorResponse": {
        "properties": {
          "code": {
            "$ref": "#/components/schemas/modelsv2.ErrorCode"
          },
          "databaseInserted": {
            "type": "boolean"
          },
          "discordMessageCleanup": {
            "enum": [
              "notNeeded",
              "deleted",
              "alreadyMissing",
              "failed"
            ],
            "type": "string"
          },
          "discordMessageCreated": {
            "type": "boolean"
          },
          "discordMessageId": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "requestId": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "modelsv2.BaseDeleteErrorResponse": {
        "properties": {
          "baseId": {
            "type": "string"
          },
          "code": {
            "$ref": "#/components/schemas/modelsv2.ErrorCode"
          },
          "databaseDeleted": {
            "type": "boolean"
          },
          "discordMessageCleanup": {
            "enum": [
              "deleted",
              "alreadyMissing",
              "failed"
            ],
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "requestId": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "modelsv2.BaseDeleteResponse": {
        "properties": {
          "baseId": {
            "type": "string"
          },
          "databaseDeleted": {
            "type": "boolean"
          },
          "discordMessageCleanup": {
            "enum": [
              "deleted",
              "alreadyMissing"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BaseDownloadResponse": {
        "properties": {
          "baseId": {
            "type": "string"
          },
          "downloadCount": {
            "type": "integer"
          },
          "userId": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BaseDownloaderProfile": {
        "properties": {
          "avatarUrl": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "userId": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BaseVoteRequest": {
        "properties": {
          "direction": {
            "enum": [
              "up",
              "down"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BaseVoteResponse": {
        "properties": {
          "baseId": {
            "type": "string"
          },
          "direction": {
            "type": "string"
          },
          "voterId": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BasesResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.Base"
            },
            "type": "array"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.BattlelogArmiesResponse": {
        "properties": {
          "battle_type": {
            "type": "string"
          },
          "count": {
            "type": "integer"
          },
          "filters": {
            "$ref": "#/components/schemas/modelsv2.BattlelogArmyFilters"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.BattlelogArmyItem"
            },
            "type": "array"
          },
          "limit": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.BattlelogArmyFilters": {
        "properties": {
          "contains": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "excludes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "league_id": {
            "type": "integer"
          },
          "min_usage_count": {
            "type": "integer"
          },
          "sort_by": {
            "type": "string"
          },
          "time": {
            "$ref": "#/components/schemas/modelsv2.PublicStatsTimeRange"
          },
          "townhall_level": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.BattlelogArmyItem": {
        "properties": {
          "army_counts": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object"
          },
          "army_items": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "army_share_code": {
            "type": "string"
          },
          "average_destruction": {
            "type": "number"
          },
          "average_stars": {
            "type": "number"
          },
          "contains_match_percent": {
            "type": "number"
          },
          "three_star_rate": {
            "type": "number"
          },
          "three_stars": {
            "type": "integer"
          },
          "usage_count": {
            "type": "integer"
          },
          "usage_rate": {
            "type": "number"
          }
        },
        "type": "object"
      },
      "modelsv2.BattlelogEntry": {
        "properties": {
          "army_counts": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object"
          },
          "army_items": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "army_share_code": {
            "type": "string"
          },
          "attack": {
            "type": "boolean"
          },
          "battle_id": {
            "type": "string"
          },
          "battle_type": {
            "type": "string"
          },
          "dark_elixir": {
            "type": "integer"
          },
          "destruction_percentage": {
            "type": "integer"
          },
          "duration": {
            "type": "integer"
          },
          "elixir": {
            "type": "integer"
          },
          "gold": {
            "type": "integer"
          },
          "opponent_name": {
            "type": "string"
          },
          "opponent_tag": {
            "type": "string"
          },
          "opponent_townhall": {
            "type": "integer"
          },
          "player_name": {
            "type": "string"
          },
          "player_tag": {
            "type": "string"
          },
          "player_townhall": {
            "type": "integer"
          },
          "stars": {
            "type": "integer"
          },
          "timestamp": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BattlelogItemFilters": {
        "properties": {
          "leagueId": {
            "type": "integer"
          },
          "townHallLevel": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.BattlelogItemHitratePoint": {
        "properties": {
          "date": {
            "type": "string"
          },
          "hitRate": {
            "type": "number"
          },
          "threeStars": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.BattlelogItemHitrateResponse": {
        "properties": {
          "dimension": {
            "type": "string"
          },
          "filters": {
            "$ref": "#/components/schemas/modelsv2.BattlelogItemFilters"
          },
          "item": {
            "type": "string"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.BattlelogItemHitratePoint"
            },
            "type": "array"
          },
          "metric": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BattlelogItemUsagePoint": {
        "properties": {
          "date": {
            "type": "string"
          },
          "total": {
            "type": "integer"
          },
          "usageRate": {
            "type": "number"
          },
          "used": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.BattlelogItemUsageResponse": {
        "properties": {
          "dimension": {
            "type": "string"
          },
          "filters": {
            "$ref": "#/components/schemas/modelsv2.BattlelogItemFilters"
          },
          "item": {
            "type": "string"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.BattlelogItemUsagePoint"
            },
            "type": "array"
          },
          "metric": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BillingAssignmentRequest": {
        "properties": {
          "serverId": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BillingCheckoutRequest": {
        "properties": {
          "serverId": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BillingSessionResponse": {
        "properties": {
          "url": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BillingSubscriptionResponse": {
        "properties": {
          "active": {
            "type": "boolean"
          },
          "assignedServerId": {
            "type": "string"
          },
          "bookmarkNotificationsLimit": {
            "type": "integer"
          },
          "checkoutEnabled": {
            "type": "boolean"
          },
          "provider": {
            "type": "string"
          },
          "rosterAssistantMonthlyCreditUsd": {
            "type": "number"
          },
          "rosterAssistantRemainingUsd": {
            "type": "number"
          },
          "rosterAssistantSpentUsd": {
            "type": "number"
          },
          "status": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BillingUsageResponse": {
        "properties": {
          "assignedSubscriberCount": {
            "type": "integer"
          },
          "globalFreeAvailable": {
            "type": "boolean"
          },
          "paidLimitUsd": {
            "type": "number"
          },
          "paidRemainingUsd": {
            "type": "number"
          },
          "paidSpentUsd": {
            "type": "number"
          },
          "resetsAt": {
            "type": "string"
          },
          "serverId": {
            "type": "string"
          },
          "serverLimitUsd": {
            "type": "number"
          },
          "serverSpentUsd": {
            "type": "number"
          },
          "subscriptionActive": {
            "type": "boolean"
          },
          "userLimitUsd": {
            "type": "number"
          },
          "userSpentUsd": {
            "type": "number"
          }
        },
        "type": "object"
      },
      "modelsv2.BotGuildProfile": {
        "properties": {
          "avatar_inherited": {
            "type": "boolean"
          },
          "avatar_url": {
            "type": "string"
          },
          "banner_inherited": {
            "type": "boolean"
          },
          "banner_url": {
            "type": "string"
          },
          "bio": {
            "type": "string"
          },
          "bio_inherited": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "name_inherited": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "modelsv2.BotGuildProfileUpdate": {
        "properties": {
          "avatar": {
            "type": "string"
          },
          "banner": {
            "type": "string"
          },
          "bio": {
            "type": "string"
          },
          "clear_avatar": {
            "type": "boolean"
          },
          "clear_banner": {
            "type": "boolean"
          },
          "clear_bio": {
            "type": "boolean"
          },
          "clear_name": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BuilderBaseLeague": {
        "properties": {
          "iconUrls": {
            "$ref": "#/components/schemas/modelsv2.PublicIconURLs"
          },
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.BuilderBaseLeaguesResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.BuilderBaseLeague"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.CDNUploadResponse": {
        "properties": {
          "filename": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLBonusRecipient": {
        "properties": {
          "medalCount": {
            "type": "integer"
          },
          "playerTag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLBonusRecipientsResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLBonusRecipient"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLClan": {
        "properties": {
          "badgeUrls": {
            "$ref": "#/components/schemas/modelsv2.WarBadgeURLs"
          },
          "clanLevel": {
            "type": "integer"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLMember"
            },
            "type": "array"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "warLeague": {
            "$ref": "#/components/schemas/modelsv2.CWLLeague"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLClanHistoryResponse": {
        "properties": {
          "clanTag": {
            "type": "string"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLHistoryItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLClanRanking": {
        "properties": {
          "destruction": {
            "type": "number"
          },
          "name": {
            "type": "string"
          },
          "rounds": {
            "$ref": "#/components/schemas/modelsv2.CWLRankingRounds"
          },
          "stars": {
            "type": "integer"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLGroupClan": {
        "properties": {
          "badgeToken": {
            "type": "string"
          },
          "clanLevel": {
            "type": "integer"
          },
          "clanTag": {
            "type": "string"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLMember"
            },
            "type": "array"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLGroupMember": {
        "properties": {
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "townHallLevel": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLGroupResponse": {
        "properties": {
          "clan_rankings": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLClanRanking"
            },
            "type": "array"
          },
          "clans": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLClan"
            },
            "type": "array"
          },
          "rounds": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLRound"
            },
            "type": "array"
          },
          "season": {
            "type": "string"
          },
          "state": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLGroupRound": {
        "properties": {
          "warTags": {
            "items": {},
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLHistoryItem": {
        "properties": {
          "clan": {
            "$ref": "#/components/schemas/modelsv2.CWLGroupClan"
          },
          "cwlLeagueId": {
            "type": "integer"
          },
          "rounds": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLRound"
            },
            "type": "array"
          },
          "season": {
            "type": "string"
          },
          "standing": {
            "$ref": "#/components/schemas/modelsv2.CWLStanding"
          },
          "state": {
            "type": "string"
          },
          "warSize": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLLeague": {
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLLeagueRankingsResponse": {
        "properties": {
          "cwlLeagueId": {
            "type": "integer"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLStanding"
            },
            "type": "array"
          },
          "season": {
            "type": "string"
          },
          "warSize": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLMember": {
        "properties": {
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "townHallLevel": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLPlayerAttackPlacement": {
        "properties": {
          "clan": {
            "type": "integer"
          },
          "group": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLPlayerClanPlacement": {
        "properties": {
          "global": {
            "type": [
              "integer",
              "null"
            ]
          },
          "group": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "modelsv2.CWLPlayerHistoryAttack": {
        "properties": {
          "defender": {
            "$ref": "#/components/schemas/modelsv2.CWLPlayerHistoryAttackDefender"
          },
          "destructionPercentage": {
            "type": "integer"
          },
          "duration": {
            "type": "integer"
          },
          "opponent": {
            "$ref": "#/components/schemas/modelsv2.CWLPlayerHistoryAttackOpponent"
          },
          "order": {
            "type": "integer"
          },
          "round": {
            "type": "integer"
          },
          "stars": {
            "type": "integer"
          },
          "warTag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLPlayerHistoryAttackDefender": {
        "properties": {
          "mapPosition": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "townHallLevel": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLPlayerHistoryAttackOpponent": {
        "properties": {
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLPlayerHistoryClan": {
        "properties": {
          "badgeUrls": {
            "$ref": "#/components/schemas/modelsv2.WarBadgeURLs"
          },
          "name": {
            "type": "string"
          },
          "placement": {
            "allOf": [
              {
                "$ref": "#/components/schemas/modelsv2.CWLPlayerClanPlacement"
              }
            ],
            "type": [
              "object",
              "null"
            ]
          },
          "tag": {
            "type": "string"
          },
          "totalStars": {
            "type": [
              "integer",
              "null"
            ]
          },
          "wars": {
            "allOf": [
              {
                "$ref": "#/components/schemas/modelsv2.CWLPlayerHistoryWarRecord"
              }
            ],
            "type": [
              "object",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "modelsv2.CWLPlayerHistoryItem": {
        "properties": {
          "attacks": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLPlayerHistoryAttack"
            },
            "type": "array"
          },
          "clan": {
            "$ref": "#/components/schemas/modelsv2.CWLPlayerHistoryClan"
          },
          "cwlLeagueId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "missedAttacks": {
            "type": "integer"
          },
          "placement": {
            "allOf": [
              {
                "$ref": "#/components/schemas/modelsv2.CWLPlayerAttackPlacement"
              }
            ],
            "type": [
              "object",
              "null"
            ]
          },
          "season": {
            "type": "string"
          },
          "townHallLevel": {
            "type": "integer"
          },
          "warSize": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "modelsv2.CWLPlayerHistoryResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLPlayerHistoryItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLPlayerHistoryWarRecord": {
        "properties": {
          "lost": {
            "type": "integer"
          },
          "tied": {
            "type": "integer"
          },
          "won": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLRankingRounds": {
        "properties": {
          "lost": {
            "type": "integer"
          },
          "tied": {
            "type": "integer"
          },
          "won": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLResponse": {
        "properties": {
          "clans": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLStoredGroupClan"
            },
            "type": "array"
          },
          "rounds": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLGroupRound"
            },
            "type": "array"
          },
          "season": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "warLeague": {
            "$ref": "#/components/schemas/modelsv2.LeagueReference"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLRound": {
        "properties": {
          "warTags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLSeasonItem": {
        "properties": {
          "destruction": {
            "type": "number"
          },
          "rank": {
            "type": "integer"
          },
          "rounds": {
            "$ref": "#/components/schemas/modelsv2.CWLRankingRounds"
          },
          "season": {
            "type": "string"
          },
          "stars": {
            "type": "integer"
          },
          "state": {
            "type": "string"
          },
          "warLeague": {
            "$ref": "#/components/schemas/modelsv2.LeagueReference"
          },
          "warSize": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLSeasonsResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLSeasonItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLStanding": {
        "properties": {
          "clanTag": {
            "type": "string"
          },
          "cwlLeagueId": {
            "type": "integer"
          },
          "destruction": {
            "type": "number"
          },
          "globalRank": {
            "type": "integer"
          },
          "groupRank": {
            "type": "integer"
          },
          "losses": {
            "type": "integer"
          },
          "season": {
            "type": "string"
          },
          "stars": {
            "type": "integer"
          },
          "ties": {
            "type": "integer"
          },
          "totalClansInGroup": {
            "type": "integer"
          },
          "updatedAt": {
            "type": "string"
          },
          "warSize": {
            "type": "integer"
          },
          "warsFinished": {
            "type": "integer"
          },
          "wins": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLStoredGroupClan": {
        "properties": {
          "badgeUrls": {
            "$ref": "#/components/schemas/modelsv2.PublicBadgeURLs"
          },
          "clanLevel": {
            "type": "integer"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLGroupMember"
            },
            "type": "array"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLThresholdItem": {
        "properties": {
          "demote": {
            "type": "integer"
          },
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "promo": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.CWLThresholdResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLThresholdItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanBadgeURLs": {
        "properties": {
          "large": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanBasicRecords": {
        "properties": {
          "clanPoints": {
            "$ref": "#/components/schemas/modelsv2.ClanRecordEntry"
          },
          "warWinStreak": {
            "$ref": "#/components/schemas/modelsv2.ClanRecordEntry"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanBasicResponse": {
        "properties": {
          "badgeUrls": {
            "$ref": "#/components/schemas/modelsv2.ClanBadgeURLs"
          },
          "capitalLeague": {
            "$ref": "#/components/schemas/modelsv2.ClanLeagueRef"
          },
          "clanLevel": {
            "type": "integer"
          },
          "clanPoints": {
            "type": "integer"
          },
          "description": {
            "type": "string"
          },
          "lastActive": {
            "type": "string"
          },
          "location": {
            "$ref": "#/components/schemas/modelsv2.ClanLeagueRef"
          },
          "memberCount": {
            "type": "integer"
          },
          "members": {},
          "name": {
            "type": "string"
          },
          "publicWarLog": {
            "type": "boolean"
          },
          "records": {
            "$ref": "#/components/schemas/modelsv2.ClanBasicRecords"
          },
          "tag": {
            "type": "string"
          },
          "troopsDonated": {
            "type": "integer"
          },
          "troopsReceived": {
            "type": "integer"
          },
          "warLeague": {
            "$ref": "#/components/schemas/modelsv2.ClanLeagueRef"
          },
          "warWinStreak": {
            "type": "integer"
          },
          "warWins": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanCategoriesResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ClanCategory"
            },
            "type": "array"
          },
          "total": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanCategory": {
        "properties": {
          "clanCount": {
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          },
          "serverId": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanCategoryCreateResponse": {
        "properties": {
          "category": {
            "$ref": "#/components/schemas/modelsv2.ClanCategory"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanCategoryDeletePreviewResponse": {
        "properties": {
          "affectedClanCount": {
            "type": "integer"
          },
          "category": {
            "$ref": "#/components/schemas/modelsv2.ClanCategory"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanCategoryDeleteResponse": {
        "properties": {
          "categoryId": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "uncategorizedClanCount": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanCategoryRenameResponse": {
        "properties": {
          "category": {
            "$ref": "#/components/schemas/modelsv2.ClanCategory"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanChangeRecord": {
        "properties": {
          "current": {
            "$ref": "#/components/schemas/modelsv2.ClanChangeValue"
          },
          "previous": {
            "$ref": "#/components/schemas/modelsv2.ClanChangeValue"
          },
          "time": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanChangeValue": {
        "properties": {
          "integer": {
            "type": "integer"
          },
          "kind": {
            "enum": [
              "text",
              "integer"
            ],
            "type": "string"
          },
          "text": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanChangesResponse": {
        "properties": {
          "badgeUrls": {
            "$ref": "#/components/schemas/modelsv2.PublicBadgeURLs"
          },
          "count": {
            "type": "integer"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ClanChangeRecord"
            },
            "type": "array"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanCountdownsResponse": {
        "properties": {
          "clan_tag": {
            "type": "string"
          },
          "countdowns": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CountdownStatus"
            },
            "type": "array"
          },
          "server_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanLeaderboardHistoryResponse": {
        "properties": {
          "clanTag": {
            "type": "string"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.LeaderboardEntityHistoryItem"
            },
            "type": "array"
          },
          "type": {
            "$ref": "#/components/schemas/modelsv2.LeaderboardHistoryType"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanLeagueRef": {
        "properties": {
          "id": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanLegendHistoryResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.LegendHistoryItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanListItem": {
        "properties": {
          "added_at": {
            "type": "string"
          },
          "badge_url": {
            "type": "string"
          },
          "level": {
            "type": "integer"
          },
          "member_count": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "settings": {
            "$ref": "#/components/schemas/modelsv2.ClanSettings"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanRankingCategory": {
        "properties": {
          "placements": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ClanRankingPlacement"
            },
            "type": "array"
          },
          "points": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanRankingPlacement": {
        "properties": {
          "locationId": {
            "type": "string"
          },
          "points": {
            "type": "integer"
          },
          "rank": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanRankingsResponse": {
        "properties": {
          "badge": {
            "type": "string"
          },
          "builderBase": {
            "$ref": "#/components/schemas/modelsv2.ClanRankingCategory"
          },
          "clanCapital": {
            "$ref": "#/components/schemas/modelsv2.ClanRankingCategory"
          },
          "homeVillage": {
            "$ref": "#/components/schemas/modelsv2.ClanRankingCategory"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanRecordEntry": {
        "properties": {
          "time": {
            "type": "string"
          },
          "value": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanReference": {
        "properties": {
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanSettings": {
        "properties": {
          "abbreviation": {
            "type": "string"
          },
          "category": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanSettingsDetail": {
        "properties": {
          "abbreviation": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "server_id": {
            "type": "integer"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanSettingsResponse": {
        "properties": {
          "category": {
            "$ref": "#/components/schemas/modelsv2.ClanCategory"
          },
          "clan_tag": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "server_id": {
            "type": "integer"
          },
          "updated_fields": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanSettingsUpdate": {
        "properties": {
          "abbreviation": {
            "type": "string"
          },
          "category": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanTagsBody": {
        "properties": {
          "clan_tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanWarHitResult": {
        "properties": {
          "clan_tag": {
            "type": "string"
          },
          "players": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.PlayerWarHitResult"
            },
            "type": "array"
          },
          "wars": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.WarHitWar"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.ClanWarHitsResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ClanWarHitResult"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.CountdownStatus": {
        "properties": {
          "channel_id": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.CreateAutoBoardRequest": {
        "properties": {
          "boardType": {
            "type": "string"
          },
          "channelId": {
            "type": "string"
          },
          "deliveryMode": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "intervalMinutes": {
            "type": "integer"
          },
          "schedule": {
            "$ref": "#/components/schemas/modelsv2.AutoBoardSchedule"
          },
          "targetScope": {
            "type": "string"
          },
          "targets": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "threadId": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.CreateBaseRequest": {
        "properties": {
          "baseLink": {
            "type": "string"
          },
          "channelId": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "images": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.CreateClanCategoryRequest": {
        "properties": {
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.CreatePanelRequest": {
        "properties": {
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.CreateReminderRequest": {
        "properties": {
          "attack_threshold": {
            "type": "integer"
          },
          "channel_id": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "custom_text": {
            "type": "string"
          },
          "ping_type": {
            "type": "string"
          },
          "point_threshold": {
            "type": "integer"
          },
          "roles": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "roster_id": {
            "type": "string"
          },
          "thread_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "time": {
            "type": "string"
          },
          "townhall_filter": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "type": {
            "type": "string"
          },
          "war_types": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.CreateRosterRequest": {
        "properties": {
          "alias": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "group_id": {
            "type": "string"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterMember"
            },
            "type": "array"
          },
          "roster_type": {
            "enum": [
              "clan",
              "family"
            ],
            "type": "string"
          },
          "signup_scope": {
            "enum": [
              "clan-only",
              "family-wide"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.CurrentDatesResponse": {
        "properties": {
          "clan-games": {
            "type": "string"
          },
          "legend": {
            "type": "string"
          },
          "raid": {
            "type": "string"
          },
          "season": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.CurrentUserInfo": {
        "properties": {
          "account_summary": {
            "$ref": "#/components/schemas/modelsv2.UserAccountSummary"
          },
          "auth_methods": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "avatar_url": {
            "type": "string"
          },
          "user_id": {
            "type": "string"
          },
          "username": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.DashboardAccessConfig": {
        "properties": {
          "grants": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.DashboardAccessGrant"
            },
            "type": "array"
          },
          "roles": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.DashboardAccessRole"
            },
            "type": "array"
          },
          "sections": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "server_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.DashboardAccessGrant": {
        "properties": {
          "access_level": {
            "$ref": "#/components/schemas/modelsv2.DashboardAccessLevel"
          },
          "role_id": {
            "type": "string"
          },
          "section": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.DashboardAccessLevel": {
        "enum": [
          "view",
          "manage"
        ],
        "type": "string",
        "x-enum-varnames": [
          "DashboardAccessView",
          "DashboardAccessManage"
        ]
      },
      "modelsv2.DashboardAccessRole": {
        "properties": {
          "color": {
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.DashboardAccessUpdate": {
        "properties": {
          "grants": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.DashboardAccessGrant"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.DashboardCapabilities": {
        "properties": {
          "full_access": {
            "type": "boolean"
          },
          "sections": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          "server_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.DateItemsResponse": {
        "properties": {
          "items": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.DisableCountdownRequest": {
        "properties": {
          "clan_tag": {
            "type": "string"
          },
          "countdown_type": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.DisableCountdownResponse": {
        "properties": {
          "countdown_type": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.DiscohookResolveResponse": {
        "properties": {
          "payload": {},
          "resolvedUrl": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.DiscordChannel": {
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "parent_id": {
            "type": "string"
          },
          "parent_name": {
            "type": "string"
          },
          "type": {
            "enum": [
              "category",
              "text",
              "news",
              "forum"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.DiscordEmbed": {
        "properties": {
          "author": {
            "$ref": "#/components/schemas/modelsv2.DiscordEmbedAuthor"
          },
          "color": {
            "type": "integer"
          },
          "description": {
            "type": "string"
          },
          "fields": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.DiscordEmbedField"
            },
            "type": "array"
          },
          "footer": {
            "$ref": "#/components/schemas/modelsv2.DiscordEmbedFooter"
          },
          "image": {
            "$ref": "#/components/schemas/modelsv2.DiscordEmbedMedia"
          },
          "thumbnail": {
            "$ref": "#/components/schemas/modelsv2.DiscordEmbedMedia"
          },
          "timestamp": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.DiscordEmbedAuthor": {
        "properties": {
          "icon_url": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.DiscordEmbedField": {
        "properties": {
          "inline": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.DiscordEmbedFooter": {
        "properties": {
          "icon_url": {
            "type": "string"
          },
          "text": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.DiscordEmbedMedia": {
        "properties": {
          "url": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.DiscordEmoji": {
        "properties": {
          "animated": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.DiscordRole": {
        "properties": {
          "color": {
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "managed": {
            "type": "boolean"
          },
          "mentionable": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.DiscordRolesResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "roles": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.DiscordRole"
            },
            "type": "array"
          },
          "server_id": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.DiscordStatusResponse": {
        "properties": {
          "bot_token_present": {
            "type": "boolean"
          },
          "guild_name": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "status_code": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.DiscordThread": {
        "properties": {
          "archived": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "parent_channel_id": {
            "type": "string"
          },
          "parent_channel_name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.EmbedColorResponse": {
        "properties": {
          "embed_color": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "server_id": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.EnableCountdownRequest": {
        "properties": {
          "clan_tag": {
            "type": "string"
          },
          "countdown_type": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.EnableCountdownResponse": {
        "properties": {
          "channel_id": {
            "type": "string"
          },
          "channel_name": {
            "type": "string"
          },
          "countdown_type": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.EnumCatalogResponse": {
        "properties": {
          "countdown_types": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.EnumValue"
            },
            "type": "array"
          },
          "log_types": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.EnumValue"
            },
            "type": "array"
          },
          "role_modes": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.EnumValue"
            },
            "type": "array"
          },
          "role_types": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.EnumValue"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.EnumValue": {
        "properties": {
          "description": {
            "type": "string"
          },
          "id": {
            "type": "integer"
          },
          "scope": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.EnumValuesResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "values": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.EnumValue"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.ErrorCode": {
        "enum": [
          "invalid_request",
          "validation_failed",
          "unauthenticated",
          "forbidden",
          "not_found",
          "conflict",
          "rate_limited",
          "not_implemented",
          "upstream_unavailable",
          "internal_error"
        ],
        "type": "string",
        "x-enum-varnames": [
          "ErrorCodeInvalidRequest",
          "ErrorCodeValidationFailed",
          "ErrorCodeUnauthenticated",
          "ErrorCodeForbidden",
          "ErrorCodeNotFound",
          "ErrorCodeConflict",
          "ErrorCodeRateLimited",
          "ErrorCodeNotImplemented",
          "ErrorCodeUpstreamUnavailable",
          "ErrorCodeInternal"
        ]
      },
      "modelsv2.ErrorResponse": {
        "properties": {
          "code": {
            "$ref": "#/components/schemas/modelsv2.ErrorCode"
          },
          "details": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.FieldError"
            },
            "type": "array"
          },
          "message": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.FieldError": {
        "properties": {
          "field": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.GiveawayBooster": {
        "properties": {
          "roles": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "value": {
            "type": "number"
          }
        },
        "type": "object"
      },
      "modelsv2.GiveawayConfig": {
        "properties": {
          "boosters": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.GiveawayBooster"
            },
            "type": "array"
          },
          "channelId": {
            "type": "string"
          },
          "cocAccountRequired": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string"
          },
          "end": {
            "type": "string"
          },
          "entries": {
            "items": {},
            "type": "array"
          },
          "eventPending": {
            "type": "string"
          },
          "eventPendingAt": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "imageUrl": {
            "type": "string"
          },
          "mentions": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "messageId": {
            "type": "string"
          },
          "prize": {
            "type": "string"
          },
          "profilePictureRequired": {
            "type": "boolean"
          },
          "roles": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "rolesMode": {
            "type": "string"
          },
          "serverId": {
            "type": "string"
          },
          "start": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "textAboveEmbed": {
            "type": "string"
          },
          "textInEmbed": {
            "type": "string"
          },
          "textOnEnd": {
            "type": "string"
          },
          "updated": {
            "type": "boolean"
          },
          "updatedAt": {
            "type": "string"
          },
          "winners": {
            "type": "integer"
          },
          "winnersList": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.GiveawayWinner"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.GiveawayEntrant": {
        "properties": {
          "entries": {
            "type": "integer"
          },
          "userId": {
            "type": "string"
          },
          "winChance": {
            "type": "number"
          }
        },
        "type": "object"
      },
      "modelsv2.GiveawayEntriesResponse": {
        "properties": {
          "entrants": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.GiveawayEntrant"
            },
            "type": "array"
          },
          "giveawayId": {
            "type": "string"
          },
          "serverId": {
            "type": "string"
          },
          "totalEntries": {
            "type": "integer"
          },
          "uniqueUsers": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.GiveawayMutationResponse": {
        "properties": {
          "giveawayId": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "serverId": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.GiveawayRerollRequest": {
        "properties": {
          "user_ids_to_replace": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.GiveawayRerollResponse": {
        "properties": {
          "giveawayId": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "newWinners": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "serverId": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.GiveawayWinner": {
        "properties": {
          "avatarUrl": {
            "type": "string"
          },
          "inServer": {
            "type": "boolean"
          },
          "reason": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "timestamp": {
            "type": "string"
          },
          "userId": {
            "type": "string"
          },
          "username": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.GlobalCountsResponse": {
        "properties": {
          "clan_count": {
            "type": "integer"
          },
          "clans_in_war": {
            "type": "integer"
          },
          "player_count": {
            "type": "integer"
          },
          "players_in_legends": {
            "type": "integer"
          },
          "players_in_war": {
            "type": "integer"
          },
          "total_join_leaves": {
            "type": "integer"
          },
          "wars_stored": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.GroupedCountItem": {
        "properties": {
          "capital_league_id": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          },
          "cwl_league_id": {
            "type": "integer"
          },
          "league_tier_id": {
            "type": "integer"
          },
          "location_id": {
            "type": "integer"
          },
          "townhall_level": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.GroupedCountsResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.GroupedCountItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.GuildDetails": {
        "properties": {
          "banner": {
            "type": "string"
          },
          "boost_count": {
            "type": "integer"
          },
          "description": {
            "type": "string"
          },
          "features": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "icon": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "member_count": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "owner_id": {
            "type": "string"
          },
          "premium_tier": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.GuildInfo": {
        "properties": {
          "delegated": {
            "type": "boolean"
          },
          "features": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "has_bot": {
            "type": "boolean"
          },
          "icon": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "inactive": {
            "type": "boolean"
          },
          "last_command_at": {
            "type": "string"
          },
          "member_count": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "owner": {
            "type": "boolean"
          },
          "permissions": {
            "type": "string"
          },
          "role": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.GuildSummaryClanRow": {
        "properties": {
          "active_members": {
            "type": "integer"
          },
          "activity_rate": {
            "type": "number"
          },
          "average_donations_received": {
            "type": "number"
          },
          "average_donations_sent": {
            "type": "number"
          },
          "average_trophies": {
            "type": "number"
          },
          "clan_name": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "inactive_members": {
            "type": "integer"
          },
          "total_donations_received": {
            "type": "integer"
          },
          "total_donations_sent": {
            "type": "integer"
          },
          "total_members": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.GuildSummaryResponse": {
        "properties": {
          "clans": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.GuildSummaryClanRow"
            },
            "type": "array"
          },
          "guild_id": {
            "type": "integer"
          },
          "overall_activity_rate": {
            "type": "number"
          },
          "total_active_members": {
            "type": "integer"
          },
          "total_clans": {
            "type": "integer"
          },
          "total_donations_received": {
            "type": "integer"
          },
          "total_donations_sent": {
            "type": "integer"
          },
          "total_inactive_members": {
            "type": "integer"
          },
          "total_members": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.HomeActivityItem": {
        "properties": {
          "clan_name": {
            "type": "string"
          },
          "clan_tag": {
            "type": [
              "string",
              "null"
            ]
          },
          "event_type": {
            "type": "string"
          },
          "player_name": {
            "type": "string"
          },
          "player_tag": {
            "type": "string"
          },
          "timestamp": {
            "type": "string"
          },
          "townhall_level": {
            "type": "integer"
          },
          "type": {
            "enum": [
              "join_leave"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.HomeActivityPlayerMapping": {
        "properties": {
          "clan_tag": {
            "type": [
              "string",
              "null"
            ]
          },
          "player_tag": {
            "type": "string"
          }
        },
        "required": [
          "player_tag"
        ],
        "type": "object"
      },
      "modelsv2.HomeActivityRequest": {
        "properties": {
          "account_id": {
            "type": "string"
          },
          "limit": {
            "type": "integer"
          },
          "mappings": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.HomeActivityPlayerMapping"
            },
            "type": "array"
          }
        },
        "required": [
          "account_id",
          "mappings"
        ],
        "type": "object"
      },
      "modelsv2.HomeActivityResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.HomeActivityItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.JoinLeaveClan": {
        "properties": {
          "badge": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.JoinLeaveClanTotal": {
        "properties": {
          "clan": {
            "$ref": "#/components/schemas/modelsv2.JoinLeaveClan"
          },
          "minutes": {
            "type": "integer"
          },
          "visits": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.JoinLeaveEvent": {
        "properties": {
          "clan": {
            "$ref": "#/components/schemas/modelsv2.JoinLeaveClan"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "townHallLevel": {
            "type": "integer"
          },
          "type": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.JoinLeaveResponse": {
        "properties": {
          "available": {
            "type": "integer"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.JoinLeaveEvent"
            },
            "type": "array"
          },
          "uniquePlayers": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.JoinLeaveSharedClanTotal": {
        "properties": {
          "clan": {
            "$ref": "#/components/schemas/modelsv2.JoinLeaveClan"
          },
          "minutes": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.JoinLeaveSharedResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.JoinLeaveSharedClanTotal"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.JoinLeaveTotalsResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.JoinLeaveClanTotal"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.LeaderboardClan": {
        "properties": {
          "badge": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.LeaderboardEntityHistoryItem": {
        "properties": {
          "date": {
            "type": "string"
          },
          "details": {
            "$ref": "#/components/schemas/modelsv2.LeaderboardHistoryItem"
          },
          "locationId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "rank": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.LeaderboardHistoryClanReference": {
        "properties": {
          "badgeUrls": {
            "$ref": "#/components/schemas/modelsv2.PublicBadgeURLs"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.LeaderboardHistoryItem": {
        "properties": {
          "attackWins": {
            "type": "integer"
          },
          "badgeUrls": {
            "$ref": "#/components/schemas/modelsv2.PublicBadgeURLs"
          },
          "builderBaseBattleWins": {
            "type": "integer"
          },
          "builderBaseLeague": {
            "$ref": "#/components/schemas/modelsv2.LeaderboardHistoryLeagueReference"
          },
          "builderBasePoints": {
            "type": "integer"
          },
          "builderBaseTrophies": {
            "type": "integer"
          },
          "capitalPoints": {
            "type": "integer"
          },
          "clan": {
            "$ref": "#/components/schemas/modelsv2.LeaderboardHistoryClanReference"
          },
          "clanLevel": {
            "type": "integer"
          },
          "clanPoints": {
            "type": "integer"
          },
          "defenseWins": {
            "type": "integer"
          },
          "expLevel": {
            "type": "integer"
          },
          "league": {
            "$ref": "#/components/schemas/modelsv2.LeaderboardHistoryLeagueReference"
          },
          "leagueTier": {
            "$ref": "#/components/schemas/modelsv2.LeaderboardHistoryLeagueReference"
          },
          "location": {
            "$ref": "#/components/schemas/modelsv2.LeaderboardHistoryLocationReference"
          },
          "members": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "previousRank": {
            "type": "integer"
          },
          "rank": {
            "type": "integer"
          },
          "tag": {
            "type": "string"
          },
          "trophies": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.LeaderboardHistoryLeagueReference": {
        "properties": {
          "iconUrls": {
            "$ref": "#/components/schemas/modelsv2.PublicIconURLs"
          },
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.LeaderboardHistoryLocationReference": {
        "properties": {
          "countryCode": {
            "type": "string"
          },
          "id": {
            "type": "integer"
          },
          "isCountry": {
            "type": "boolean"
          },
          "localizedName": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.LeaderboardHistoryType": {
        "enum": [
          "player_home_trophies",
          "player_builder_base_trophies",
          "clan_home_points",
          "clan_builder_base_points",
          "clan_capital_points"
        ],
        "type": "string",
        "x-enum-varnames": [
          "LeaderboardHistoryTypePlayerHomeTrophies",
          "LeaderboardHistoryTypePlayerBuilderBaseTrophies",
          "LeaderboardHistoryTypeClanHomePoints",
          "LeaderboardHistoryTypeClanBuilderBasePoints",
          "LeaderboardHistoryTypeClanCapitalPoints"
        ]
      },
      "modelsv2.LeaderboardLeague": {
        "properties": {
          "badge": {
            "type": "string"
          },
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.LeaderboardSnapshotHistoryResponse": {
        "properties": {
          "date": {
            "type": "string"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.LeaderboardHistoryItem"
            },
            "type": "array"
          },
          "locationId": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/modelsv2.LeaderboardHistoryType"
          }
        },
        "type": "object"
      },
      "modelsv2.LeagueReference": {
        "properties": {
          "iconUrl": {
            "type": "string"
          },
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.LegendHistoryClan": {
        "properties": {
          "badgeUrls": {
            "$ref": "#/components/schemas/modelsv2.PublicBadgeURLs"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.LegendHistoryItem": {
        "properties": {
          "attackWins": {
            "type": "integer"
          },
          "clan": {
            "$ref": "#/components/schemas/modelsv2.LegendHistoryClan"
          },
          "defenseWins": {
            "type": "integer"
          },
          "expLevel": {
            "type": "integer"
          },
          "leagueTier": {
            "$ref": "#/components/schemas/modelsv2.LegendHistoryLeagueTier"
          },
          "name": {
            "type": "string"
          },
          "rank": {
            "type": "integer"
          },
          "season": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "trophies": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.LegendHistoryLeagueTier": {
        "properties": {
          "iconUrls": {
            "$ref": "#/components/schemas/modelsv2.PublicIconURLs"
          },
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.LegendSeasonHistoryResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.LegendHistoryItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.LinkParseSettings": {
        "properties": {
          "army": {
            "type": "boolean"
          },
          "base": {
            "type": "boolean"
          },
          "clan": {
            "type": "boolean"
          },
          "player": {
            "type": "boolean"
          },
          "show": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "modelsv2.MessageResponse": {
        "properties": {
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.MissingRosterMember": {
        "properties": {
          "name": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "trophies": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.MissingRosterMembersResponse": {
        "properties": {
          "query_type": {
            "enum": [
              "roster",
              "group"
            ],
            "type": "string"
          },
          "query_value": {
            "type": "string"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.MissingRosterResult"
            },
            "type": "array"
          },
          "server_id": {
            "type": "string"
          },
          "total_rosters_checked": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.MissingRosterResult": {
        "properties": {
          "clan_tag": {
            "type": "string"
          },
          "missing_count": {
            "type": "integer"
          },
          "missing_members": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.MissingRosterMember"
            },
            "type": "array"
          },
          "roster_alias": {
            "type": "string"
          },
          "roster_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.MobilePlayerTagsRequest": {
        "properties": {
          "clan_tags": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          "player_tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.MobilePublicConfigResponse": {
        "properties": {
          "sentry_dsn": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.NotificationAccount": {
        "properties": {
          "active": {
            "type": "boolean"
          },
          "playerTag": {
            "type": "string"
          },
          "source": {
            "enum": [
              "verified"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.NotificationAccountPreferenceRequest": {
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "modelsv2.NotificationDeviceRequest": {
        "properties": {
          "app_version": {
            "type": "string"
          },
          "authorization_status": {
            "enum": [
              "authorized",
              "provisional",
              "denied",
              "not_determined"
            ],
            "type": "string"
          },
          "device_id": {
            "type": "string"
          },
          "environment": {
            "enum": [
              "sandbox",
              "production"
            ],
            "type": "string"
          },
          "locale": {
            "type": "string"
          },
          "platform": {
            "enum": [
              "android",
              "ios"
            ],
            "type": "string"
          },
          "provider": {
            "enum": [
              "fcm"
            ],
            "type": "string"
          },
          "token": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.NotificationDeviceResponse": {
        "properties": {
          "authorization_status": {
            "type": "string"
          },
          "device_id": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "environment": {
            "type": "string"
          },
          "last_seen_at": {
            "type": "string"
          },
          "platform": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.NotificationMessageResponse": {
        "properties": {
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.NotificationPreferencesRequest": {
        "properties": {
          "announcementsEnabled": {
            "type": "boolean"
          },
          "deviceId": {
            "type": "string"
          },
          "environment": {
            "enum": [
              "sandbox",
              "production"
            ],
            "type": "string"
          },
          "eventsEnabled": {
            "type": "boolean"
          },
          "monthlySupportEnabled": {
            "type": "boolean"
          },
          "notificationsEnabled": {
            "type": "boolean"
          },
          "raidReminderTimings": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "raidRemindersEnabled": {
            "type": "boolean"
          },
          "reminderTimings": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "warAttacksEnabled": {
            "type": "boolean"
          },
          "warRemindersEnabled": {
            "type": "boolean"
          },
          "warStateEnabled": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "modelsv2.NotificationPreferencesResponse": {
        "properties": {
          "accounts": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.NotificationAccount"
            },
            "type": "array"
          },
          "announcementsEnabled": {
            "type": "boolean"
          },
          "deviceId": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "eventsEnabled": {
            "type": "boolean"
          },
          "monthlySupportEnabled": {
            "type": "boolean"
          },
          "notificationsEnabled": {
            "type": "boolean"
          },
          "raidReminderTimings": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "raidRemindersEnabled": {
            "type": "boolean"
          },
          "reminderTimings": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "warAttacksEnabled": {
            "type": "boolean"
          },
          "warRemindersEnabled": {
            "type": "boolean"
          },
          "warStateEnabled": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerBattlelogHistoryResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.BattlelogEntry"
            },
            "type": "array"
          },
          "limit": {
            "type": "integer"
          },
          "player_tag": {
            "type": "string"
          },
          "time": {
            "$ref": "#/components/schemas/modelsv2.PublicStatsTimeRange"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerChangeRecord": {
        "properties": {
          "clan_tag": {
            "type": "string"
          },
          "current": {
            "$ref": "#/components/schemas/modelsv2.PlayerChangeValue"
          },
          "player_tag": {
            "type": "string"
          },
          "previous": {
            "$ref": "#/components/schemas/modelsv2.PlayerChangeValue"
          },
          "time": {
            "type": "string"
          },
          "townhall_level": {
            "type": "integer"
          },
          "type": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerChangeValue": {
        "properties": {
          "level": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerChangesResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.PlayerChangeRecord"
            },
            "type": "array"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerLeaderboardHistoryResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.LeaderboardEntityHistoryItem"
            },
            "type": "array"
          },
          "playerTag": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/modelsv2.LeaderboardHistoryType"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerLeaderboardItem": {
        "properties": {
          "clan": {
            "$ref": "#/components/schemas/modelsv2.LeaderboardClan"
          },
          "clan_tag": {
            "type": "string"
          },
          "country_code": {
            "type": "string"
          },
          "country_name": {
            "type": "string"
          },
          "league": {
            "$ref": "#/components/schemas/modelsv2.LeaderboardLeague"
          },
          "league_id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "rank": {
            "type": "integer"
          },
          "tag": {
            "type": "string"
          },
          "townhall_level": {
            "type": "integer"
          },
          "trophies": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerLeaderboardResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "generated_at": {
            "type": "string"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.PlayerLeaderboardItem"
            },
            "type": "array"
          },
          "league_tier_id": {
            "type": "integer"
          },
          "townhall_level": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerLegendHistoryResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.LegendHistoryItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerRankedBattlelogResponse": {
        "properties": {
          "battlelogs": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.BattlelogEntry"
            },
            "type": "array"
          },
          "member": {
            "$ref": "#/components/schemas/modelsv2.RankedMember"
          },
          "season": {
            "type": "integer"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerRankedGroupResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "group": {
            "$ref": "#/components/schemas/modelsv2.RankedMember"
          },
          "group_tag": {
            "type": "string"
          },
          "league_tier_id": {
            "type": "integer"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RankedMember"
            },
            "type": "array"
          },
          "player": {
            "$ref": "#/components/schemas/modelsv2.RankedMember"
          },
          "season": {
            "type": "integer"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerRankingCategory": {
        "properties": {
          "countryCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "globalRank": {
            "type": [
              "integer",
              "null"
            ]
          },
          "localRank": {
            "type": [
              "integer",
              "null"
            ]
          },
          "locationId": {
            "type": [
              "string",
              "null"
            ]
          },
          "locationName": {
            "type": [
              "string",
              "null"
            ]
          },
          "points": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerRankingsResponse": {
        "properties": {
          "builderBase": {
            "$ref": "#/components/schemas/modelsv2.PlayerRankingCategory"
          },
          "homeVillage": {
            "$ref": "#/components/schemas/modelsv2.PlayerRankingCategory"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerStatChange": {
        "properties": {
          "clanTag": {
            "type": [
              "string",
              "null"
            ]
          },
          "currentValue": {
            "type": "integer"
          },
          "delta": {
            "type": "integer"
          },
          "eventTime": {
            "format": "date-time",
            "type": "string"
          },
          "previousValue": {
            "type": "integer"
          },
          "statType": {
            "$ref": "#/components/schemas/modelsv2.PlayerStatType"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerStatHistoryResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.PlayerStatChange"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerStatType": {
        "enum": [
          "donated",
          "received",
          "clan_games",
          "season_pass",
          "capital_gold_donated"
        ],
        "type": "string",
        "x-enum-varnames": [
          "PlayerStatTypeDonated",
          "PlayerStatTypeReceived",
          "PlayerStatTypeClanGames",
          "PlayerStatTypeSeasonPass",
          "PlayerStatTypeCapitalGoldDonated"
        ]
      },
      "modelsv2.PlayerUpgradePreferencesPatchRequest": {
        "properties": {
          "preferences": {
            "additionalProperties": {},
            "type": "object"
          }
        },
        "required": [
          "preferences"
        ],
        "type": "object"
      },
      "modelsv2.PlayerUpgradePreferencesResponse": {
        "properties": {
          "player_tag": {
            "type": "string"
          },
          "preferences": {
            "additionalProperties": {},
            "type": "object"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerUpgradesReplaceRequest": {
        "properties": {
          "data": {
            "additionalProperties": {},
            "type": "object"
          }
        },
        "required": [
          "data"
        ],
        "type": "object"
      },
      "modelsv2.PlayerUpgradesResponse": {
        "properties": {
          "data": {
            "additionalProperties": {},
            "type": "object"
          },
          "player_tag": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerWarAttackItem": {
        "properties": {
          "attackOrder": {
            "type": "integer"
          },
          "attackerMapPosition": {
            "type": "integer"
          },
          "attackerName": {
            "type": "string"
          },
          "attackerTag": {
            "type": "string"
          },
          "attackerTownhall": {
            "type": "integer"
          },
          "attackingClanTag": {
            "type": "string"
          },
          "battleModifier": {
            "type": "string"
          },
          "defenderMapPosition": {
            "type": "integer"
          },
          "defenderName": {
            "type": "string"
          },
          "defenderTag": {
            "type": "string"
          },
          "defenderTownhall": {
            "type": "integer"
          },
          "defendingClanTag": {
            "type": "string"
          },
          "destructionPercentage": {
            "type": "integer"
          },
          "duration": {
            "type": "integer"
          },
          "side": {
            "type": "string"
          },
          "stars": {
            "type": "integer"
          },
          "warEndTime": {
            "type": "string"
          },
          "warSize": {
            "type": "integer"
          },
          "warType": {
            "type": "string"
          },
          "war_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerWarAttacksResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.PlayerWarAttackItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerWarHitResult": {
        "properties": {
          "name": {
            "type": "string"
          },
          "stats": {
            "$ref": "#/components/schemas/modelsv2.WarHitStats"
          },
          "tag": {
            "type": "string"
          },
          "timeRange": {
            "$ref": "#/components/schemas/modelsv2.TimeRange"
          },
          "townhallLevel": {
            "type": "integer"
          },
          "wars": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.WarHitWar"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerWarHitsResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.PlayerWarHitResult"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerWarStatsBucket": {
        "properties": {
          "attacks": {
            "type": "integer"
          },
          "averageDestruction": {
            "type": "number"
          },
          "averageDuration": {
            "type": "number"
          },
          "averageStars": {
            "type": "number"
          },
          "dipAttacks": {
            "type": "integer"
          },
          "dipHitrate": {
            "type": "number"
          },
          "expectedAttacks": {
            "type": "integer"
          },
          "hitUpAttacks": {
            "type": "integer"
          },
          "hitUpHitrate": {
            "type": "number"
          },
          "hitrate": {
            "type": "number"
          },
          "missedAttacks": {
            "type": "integer"
          },
          "oneStarRate": {
            "type": "number"
          },
          "perfectAttackRate": {
            "type": "number"
          },
          "sameTownhallAttacks": {
            "type": "integer"
          },
          "sameTownhallHitrate": {
            "type": "number"
          },
          "stars": {
            "type": "integer"
          },
          "threeStarRate": {
            "type": "number"
          },
          "twoStarRate": {
            "type": "number"
          },
          "wars": {
            "type": "integer"
          },
          "zeroStarRate": {
            "type": "number"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerWarStatsExportRequest": {
        "properties": {
          "limit": {
            "type": "integer"
          },
          "player_tag": {
            "type": "string"
          },
          "timestamp_end": {
            "type": "number"
          },
          "timestamp_start": {
            "type": "number"
          }
        },
        "type": "object"
      },
      "modelsv2.PlayerWarStatsResponse": {
        "properties": {
          "cwl": {
            "$ref": "#/components/schemas/modelsv2.PlayerWarStatsBucket"
          },
          "friendly": {
            "$ref": "#/components/schemas/modelsv2.PlayerWarStatsBucket"
          },
          "playerTag": {
            "type": "string"
          },
          "random": {
            "$ref": "#/components/schemas/modelsv2.PlayerWarStatsBucket"
          },
          "timestampEnd": {
            "type": "integer"
          },
          "timestampStart": {
            "type": "integer"
          },
          "total": {
            "$ref": "#/components/schemas/modelsv2.PlayerWarStatsBucket"
          }
        },
        "type": "object"
      },
      "modelsv2.PublicBadgeURLs": {
        "properties": {
          "large": {
            "type": "string"
          },
          "medium": {
            "type": "string"
          },
          "small": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.PublicClanLeaderboardItem": {
        "properties": {
          "badgeUrls": {
            "$ref": "#/components/schemas/modelsv2.PublicBadgeURLs"
          },
          "badge_url": {
            "type": "string"
          },
          "donations": {
            "type": "integer"
          },
          "location_id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "rank": {
            "type": "integer"
          },
          "tag": {
            "type": "string"
          },
          "war_win_streak": {
            "type": "integer"
          },
          "war_wins": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.PublicClanLeaderboardResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.PublicClanLeaderboardItem"
            },
            "type": "array"
          },
          "kind": {
            "type": "string"
          },
          "location_id": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.PublicConfigResponse": {
        "properties": {
          "sentry_dsn_mobile": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.PublicIconURLs": {
        "properties": {
          "large": {
            "type": "string"
          },
          "medium": {
            "type": "string"
          },
          "small": {
            "type": "string"
          },
          "tiny": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.PublicRosterMember": {
        "properties": {
          "currentClanName": {
            "type": "string"
          },
          "currentClanTag": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "playerTag": {
            "type": "string"
          },
          "townhall": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.PublicRosterViewerResponse": {
        "properties": {
          "clanBadgeUrl": {
            "type": "string"
          },
          "clanName": {
            "type": "string"
          },
          "clanTag": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.PublicRosterMember"
            },
            "type": "array"
          },
          "name": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.PublicStatsTimeRange": {
        "properties": {
          "end": {
            "type": "string"
          },
          "start": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RankedMember": {
        "properties": {
          "attack_lose_count": {
            "type": "integer"
          },
          "attack_win_count": {
            "type": "integer"
          },
          "clan_name": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "defense_lose_count": {
            "type": "integer"
          },
          "defense_win_count": {
            "type": "integer"
          },
          "group_tag": {
            "type": "string"
          },
          "league_tier_id": {
            "type": "integer"
          },
          "league_trophies": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "placement": {
            "type": "integer"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ReminderConfig": {
        "properties": {
          "attack_threshold": {
            "type": "integer"
          },
          "channel_id": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "custom_text": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "ping_type": {
            "type": "string"
          },
          "point_threshold": {
            "type": "integer"
          },
          "roles": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "roster_id": {
            "type": "string"
          },
          "thread_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "time": {
            "type": "string"
          },
          "townhall_filter": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "type": {
            "type": "string"
          },
          "war_types": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.ReminderOperationResponse": {
        "properties": {
          "message": {
            "type": "string"
          },
          "reminder_id": {
            "type": "string"
          },
          "server_id": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.RemoveClanResponse": {
        "properties": {
          "clan_tag": {
            "type": "string"
          },
          "deleted_count": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "server_id": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.RenameClanCategoryRequest": {
        "properties": {
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ReorderClanCategoriesRequest": {
        "properties": {
          "categoryIds": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.ReplaceAutoBoardRequest": {
        "properties": {
          "boardType": {
            "type": "string"
          },
          "channelId": {
            "type": "string"
          },
          "deliveryMode": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "intervalMinutes": {
            "type": "integer"
          },
          "schedule": {
            "$ref": "#/components/schemas/modelsv2.AutoBoardSchedule"
          },
          "targetScope": {
            "type": "string"
          },
          "targets": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "threadId": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ReplaceCWLBonusRecipientsRequest": {
        "properties": {
          "recipients": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CWLBonusRecipient"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.RoleSettingsResponse": {
        "properties": {
          "auto_eval_nickname": {
            "type": "boolean"
          },
          "auto_eval_status": {
            "type": "boolean"
          },
          "autoeval_log": {
            "type": "string"
          },
          "autoeval_triggers": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "server_id": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.RoleSettingsUpdate": {
        "properties": {
          "auto_eval_nickname": {
            "type": "boolean"
          },
          "auto_eval_status": {
            "type": "boolean"
          },
          "autoeval_log": {
            "type": "string"
          },
          "autoeval_triggers": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.Roster": {
        "properties": {
          "alias": {
            "type": "string"
          },
          "clan_badge": {
            "type": "string"
          },
          "clan_name": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "columns": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "created_at": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "event_start_time": {
            "type": "integer"
          },
          "group_id": {
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "image": {
            "type": "string"
          },
          "max_accounts_per_user": {
            "type": "integer"
          },
          "max_th": {
            "type": "integer"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterMember"
            },
            "type": "array"
          },
          "message_id": {
            "type": "string"
          },
          "min_signups": {
            "type": "integer"
          },
          "min_th": {
            "type": "integer"
          },
          "recurrence_day_of_month": {
            "type": "integer"
          },
          "recurrence_days": {
            "type": "integer"
          },
          "roster_type": {
            "enum": [
              "clan",
              "family"
            ],
            "type": "string"
          },
          "server_id": {
            "type": "string"
          },
          "signup_scope": {
            "enum": [
              "clan-only",
              "family-wide"
            ],
            "type": "string"
          },
          "sort": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterViewSort"
            },
            "type": "array"
          },
          "updated_at": {
            "type": "string"
          },
          "webhook_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterAIMessage": {
        "properties": {
          "content": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "parts": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterAIMessagePart"
            },
            "type": "array"
          },
          "role": {
            "enum": [
              "user",
              "assistant"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterAIMessagePart": {
        "properties": {
          "approval": {
            "$ref": "#/components/schemas/modelsv2.RosterAIToolApproval"
          },
          "input": {},
          "state": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "toolCallId": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterAIRequest": {
        "properties": {
          "messages": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterAIMessage"
            },
            "type": "array"
          },
          "rosterIds": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "serverId": {
            "type": "string"
          },
          "viewId": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterAIToolApproval": {
        "properties": {
          "approved": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterAccountSelector": {
        "properties": {
          "id": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "type": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterAutomation": {
        "properties": {
          "action_type": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "automation_id": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "discord_channel_id": {
            "type": "string"
          },
          "executed": {
            "type": "boolean"
          },
          "executed_at": {
            "type": "integer"
          },
          "execution_status": {
            "type": "string"
          },
          "group_id": {
            "type": "string"
          },
          "last_missed_at": {
            "type": "integer"
          },
          "last_triggered_at": {
            "type": "integer"
          },
          "options": {
            "$ref": "#/components/schemas/modelsv2.RosterAutomationOptions"
          },
          "roster_id": {
            "type": "string"
          },
          "scheduled_at": {
            "type": "string"
          },
          "server_id": {
            "type": "string"
          },
          "trigger_type": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterAutomationListResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "group_id": {
            "type": "string"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterAutomation"
            },
            "type": "array"
          },
          "roster_id": {
            "type": "string"
          },
          "rules": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterAutomation"
            },
            "type": "array"
          },
          "server_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterAutomationMutationResponse": {
        "properties": {
          "automation_id": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "rule": {
            "$ref": "#/components/schemas/modelsv2.RosterAutomation"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterAutomationOptions": {
        "properties": {
          "ping_type": {
            "enum": [
              "signup_reminder",
              "missing"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterAutomationRequest": {
        "properties": {
          "action_type": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "discord_channel_id": {
            "type": "string"
          },
          "group_id": {
            "type": "string"
          },
          "options": {
            "$ref": "#/components/schemas/modelsv2.RosterAutomationOptions"
          },
          "roster_id": {
            "type": "string"
          },
          "scheduled_at": {
            "type": "string"
          },
          "trigger_type": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterCloneRequest": {
        "properties": {
          "copy_members": {
            "type": "boolean"
          },
          "group_id": {
            "type": "string"
          },
          "new_alias": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterCloneResponse": {
        "properties": {
          "members_copied": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "new_alias": {
            "type": "string"
          },
          "new_roster_id": {
            "type": "string"
          },
          "source_server_id": {
            "type": "string"
          },
          "target_server_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterGroup": {
        "properties": {
          "alias": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "group_id": {
            "type": "string"
          },
          "max_accounts_per_user": {
            "type": "integer"
          },
          "min_signups": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "rosters": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.Roster"
            },
            "type": "array"
          },
          "server_id": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterGroupDeleteResponse": {
        "properties": {
          "affected_rosters": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterGroupListResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterGroup"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterGroupMutationResponse": {
        "properties": {
          "group": {
            "$ref": "#/components/schemas/modelsv2.RosterGroup"
          },
          "group_id": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterGroupRequest": {
        "properties": {
          "alias": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "max_accounts_per_user": {
            "type": "integer"
          },
          "min_signups": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterGroupResponse": {
        "properties": {
          "group": {
            "$ref": "#/components/schemas/modelsv2.RosterGroup"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterListResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "rosters": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.Roster"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterMember": {
        "properties": {
          "answers": {
            "additionalProperties": {},
            "type": "object"
          },
          "current_clan": {
            "type": "string"
          },
          "current_clan_tag": {
            "type": "string"
          },
          "discord": {
            "type": "string"
          },
          "discord_avatar_url": {
            "type": "string"
          },
          "discord_username": {
            "type": "string"
          },
          "hero_level_sum": {
            "type": "integer"
          },
          "last_online": {
            "type": "string"
          },
          "league_id": {
            "type": "integer"
          },
          "league_name": {
            "type": "string"
          },
          "max_percent": {
            "type": "number"
          },
          "name": {
            "type": "string"
          },
          "refreshed_at": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "townhall": {
            "type": "integer"
          },
          "trophies": {
            "type": "integer"
          },
          "war_pref": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterMemberResponse": {
        "properties": {
          "member": {
            "$ref": "#/components/schemas/modelsv2.RosterMember"
          },
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterMemberUpdateRequest": {
        "properties": {
          "answers": {
            "additionalProperties": {},
            "type": "object"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterMembersRequest": {
        "properties": {
          "add": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterMember"
            },
            "type": "array"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterMember"
            },
            "type": "array"
          },
          "operation": {
            "enum": [
              "add",
              "remove",
              "update"
            ],
            "type": "string"
          },
          "player_tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterMembershipApplyRequest": {
        "properties": {
          "changes": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterMembershipChange"
            },
            "type": "array"
          },
          "expectedRevisions": {
            "additionalProperties": {
              "format": "int64",
              "type": "integer"
            },
            "type": "object"
          },
          "serverId": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterMembershipChange": {
        "properties": {
          "action": {
            "enum": [
              "add",
              "remove",
              "move"
            ],
            "type": "string"
          },
          "fromRosterId": {
            "type": "string"
          },
          "playerTag": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "toRosterId": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterMetric": {
        "properties": {
          "cacheTtlSeconds": {
            "type": "integer"
          },
          "dependsOn": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "snapshot",
              "historical",
              "derived",
              "presentation"
            ],
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "valueType": {
            "enum": [
              "string",
              "number",
              "boolean",
              "json",
              "time"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterMetricQueryRequest": {
        "properties": {
          "force": {
            "type": "boolean"
          },
          "metricId": {
            "type": "string"
          },
          "parameters": {
            "additionalProperties": {},
            "type": "object"
          },
          "rosterIds": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterMutationResponse": {
        "properties": {
          "message": {
            "type": "string"
          },
          "roster": {
            "$ref": "#/components/schemas/modelsv2.Roster"
          },
          "roster_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterQuestion": {
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "options": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "order": {
            "type": "integer"
          },
          "required": {
            "type": "boolean"
          },
          "type": {
            "enum": [
              "text",
              "boolean",
              "single_select"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterQuestionnaire": {
        "properties": {
          "accountSelector": {
            "$ref": "#/components/schemas/modelsv2.RosterAccountSelector"
          },
          "questions": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterQuestion"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterQuestionnaireMutationResponse": {
        "properties": {
          "affectedMemberCount": {
            "type": "integer"
          },
          "questionnaire": {
            "$ref": "#/components/schemas/modelsv2.RosterQuestionnaire"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterQuestionnaireWrite": {
        "properties": {
          "questions": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterQuestion"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterRefreshRequest": {
        "properties": {
          "scope": {
            "enum": [
              "data",
              "role"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterRefreshResponse": {
        "properties": {
          "message": {
            "type": "string"
          },
          "refreshed_rosters": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.Roster"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterRefreshResponseV2": {
        "properties": {
          "failedPlayers": {
            "type": "integer"
          },
          "refreshId": {
            "type": "string"
          },
          "refreshedAt": {
            "type": "string"
          },
          "refreshedPlayers": {
            "type": "integer"
          },
          "reused": {
            "type": "boolean"
          },
          "roleId": {
            "type": "string"
          },
          "roleMemberUserIds": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "scope": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterResponse": {
        "properties": {
          "roster": {
            "$ref": "#/components/schemas/modelsv2.Roster"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterSignupSubmission": {
        "properties": {
          "answers": {
            "additionalProperties": {},
            "type": "object"
          },
          "createdAt": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "playerTag": {
            "type": "string"
          },
          "rosterId": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterSignupSubmissionRequest": {
        "properties": {
          "answers": {
            "additionalProperties": {},
            "type": "object"
          },
          "discordAvatarUrl": {
            "type": "string"
          },
          "discordUserId": {
            "type": "string"
          },
          "discordUsername": {
            "type": "string"
          },
          "playerTag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterView": {
        "properties": {
          "createdAt": {
            "type": "string"
          },
          "createdBy": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "serverId": {
            "type": "string"
          },
          "shareId": {
            "type": "string"
          },
          "sourceCode": {
            "type": "string"
          },
          "sourceVersion": {
            "type": "integer"
          },
          "spec": {
            "$ref": "#/components/schemas/modelsv2.RosterViewSpec"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterViewColumn": {
        "properties": {
          "description": {
            "type": "string"
          },
          "format": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "metricId": {
            "type": "string"
          },
          "parameters": {
            "additionalProperties": {},
            "type": "object"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterViewFilter": {
        "properties": {
          "columnId": {
            "type": "string"
          },
          "operator": {
            "enum": [
              "eq",
              "neq",
              "gt",
              "gte",
              "lt",
              "lte",
              "in",
              "contains"
            ],
            "type": "string"
          },
          "value": {}
        },
        "type": "object"
      },
      "modelsv2.RosterViewHighlight": {
        "properties": {
          "columnId": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "target": {
            "enum": [
              "row",
              "column",
              "cell"
            ],
            "type": "string"
          },
          "tone": {
            "enum": [
              "red",
              "amber",
              "green",
              "blue",
              "purple",
              "gray"
            ],
            "type": "string"
          },
          "when": {
            "$ref": "#/components/schemas/modelsv2.RosterViewHighlightCondition"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterViewHighlightCondition": {
        "properties": {
          "columnId": {
            "type": "string"
          },
          "operator": {
            "enum": [
              "eq",
              "neq",
              "gt",
              "gte",
              "lt",
              "lte",
              "in",
              "contains"
            ],
            "type": "string"
          },
          "value": {}
        },
        "type": "object"
      },
      "modelsv2.RosterViewSort": {
        "properties": {
          "columnId": {
            "type": "string"
          },
          "direction": {
            "enum": [
              "asc",
              "desc"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterViewSpec": {
        "properties": {
          "columns": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterViewColumn"
            },
            "type": "array"
          },
          "filters": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterViewFilter"
            },
            "type": "array"
          },
          "highlights": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterViewHighlight"
            },
            "type": "array"
          },
          "limit": {
            "type": "integer"
          },
          "schemaVersion": {
            "enum": [
              1
            ],
            "type": "integer"
          },
          "sort": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterViewSort"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterViewUpdate": {
        "properties": {
          "name": {
            "type": "string"
          },
          "sourceCode": {
            "type": "string"
          },
          "sourceVersion": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.RosterViewWrite": {
        "properties": {
          "name": {
            "type": "string"
          },
          "sourceCode": {
            "type": "string"
          },
          "sourceVersion": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchBookmarkItem": {
        "properties": {
          "clan_tag": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "order_index": {
            "type": "integer"
          },
          "player_tag": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "type": {
            "enum": [
              "player",
              "clan"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchBookmarkListResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.SearchBookmarkItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchBookmarkOrderRequest": {
        "properties": {
          "ordered_tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "type": {
            "enum": [
              "player",
              "clan"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchBookmarkRequest": {
        "properties": {
          "clan_tag": {
            "type": "string"
          },
          "player_tag": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "type": {
            "enum": [
              "player",
              "clan"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchClanFilters": {
        "properties": {
          "clan_level": {
            "$ref": "#/components/schemas/modelsv2.SearchIntegerRange"
          },
          "cwl_league_ids": {
            "items": {
              "type": "integer"
            },
            "maxItems": 5,
            "type": "array"
          },
          "location_ids": {
            "items": {
              "type": "integer"
            },
            "maxItems": 5,
            "type": "array"
          },
          "members": {
            "$ref": "#/components/schemas/modelsv2.SearchIntegerRange"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchClanQuery": {
        "properties": {
          "cursor": {
            "type": "string"
          },
          "filters": {
            "$ref": "#/components/schemas/modelsv2.SearchClanFilters"
          },
          "limit": {
            "default": 25,
            "maximum": 200,
            "minimum": 1,
            "type": "integer"
          },
          "query": {
            "maxLength": 100,
            "minLength": 2,
            "type": "string"
          }
        },
        "required": [
          "query"
        ],
        "type": "object"
      },
      "modelsv2.SearchClanResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.SearchClanResult"
            },
            "type": "array"
          },
          "pagination": {
            "$ref": "#/components/schemas/modelsv2.SearchCursorPage"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchClanResult": {
        "properties": {
          "badge": {
            "type": "string"
          },
          "clanLevel": {
            "type": "integer"
          },
          "location": {
            "$ref": "#/components/schemas/modelsv2.SearchLocation"
          },
          "members": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "warLeague": {
            "$ref": "#/components/schemas/modelsv2.SearchLeagueReference"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchCursorPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "limit": {
            "type": "integer"
          },
          "next_cursor": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchIntegerRange": {
        "properties": {
          "max": {
            "minimum": 0,
            "type": "integer"
          },
          "min": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchLeagueReference": {
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchLocation": {
        "properties": {
          "countryCode": {
            "type": "string"
          },
          "id": {
            "type": "integer"
          },
          "isCountry": {
            "type": "boolean"
          },
          "localizedName": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchPlayerClan": {
        "properties": {
          "badge": {
            "type": "string"
          },
          "clanLevel": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchPlayerFilters": {
        "properties": {
          "clan_tags": {
            "items": {
              "type": "string"
            },
            "maxItems": 100,
            "type": "array"
          },
          "league_ids": {
            "items": {
              "type": "integer"
            },
            "maxItems": 5,
            "type": "array"
          },
          "townhall_levels": {
            "items": {
              "type": "integer"
            },
            "maxItems": 100,
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchPlayerQuery": {
        "properties": {
          "cursor": {
            "type": "string"
          },
          "filters": {
            "$ref": "#/components/schemas/modelsv2.SearchPlayerFilters"
          },
          "limit": {
            "default": 25,
            "maximum": 200,
            "minimum": 1,
            "type": "integer"
          },
          "query": {
            "maxLength": 100,
            "minLength": 2,
            "type": "string"
          }
        },
        "required": [
          "query"
        ],
        "type": "object"
      },
      "modelsv2.SearchPlayerReference": {
        "properties": {
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchPlayerReferenceResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.SearchPlayerReference"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchPlayerResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.SearchPlayerResult"
            },
            "type": "array"
          },
          "pagination": {
            "$ref": "#/components/schemas/modelsv2.SearchCursorPage"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchPlayerResult": {
        "properties": {
          "clan": {
            "$ref": "#/components/schemas/modelsv2.SearchPlayerClan"
          },
          "leagueTier": {
            "$ref": "#/components/schemas/modelsv2.SearchLeagueReference"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "townHallLevel": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchRecentBadgeURLs": {
        "properties": {
          "large": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchRecentClan": {
        "properties": {
          "badgeUrls": {
            "$ref": "#/components/schemas/modelsv2.SearchRecentBadgeURLs"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchRecentClanItem": {
        "properties": {
          "badgeUrls": {
            "$ref": "#/components/schemas/modelsv2.SearchRecentBadgeURLs"
          },
          "created_at": {
            "type": "string"
          },
          "members": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchRecentGroupedResponse": {
        "properties": {
          "clans": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.SearchRecentClanItem"
            },
            "type": "array"
          },
          "players": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.SearchRecentPlayerItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchRecentLeague": {
        "properties": {
          "iconUrls": {
            "$ref": "#/components/schemas/modelsv2.SearchRecentLeagueIconURLs"
          },
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchRecentLeagueIconURLs": {
        "properties": {
          "medium": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.SearchRecentPlayerItem": {
        "properties": {
          "clan": {
            "$ref": "#/components/schemas/modelsv2.SearchRecentClan"
          },
          "created_at": {
            "type": "string"
          },
          "league": {
            "$ref": "#/components/schemas/modelsv2.SearchRecentLeague"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "townHallLevel": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.SeasonBoundsResponse": {
        "properties": {
          "season_end": {
            "type": "string"
          },
          "season_start": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerAutoBoardsResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.AutoBoardConfig"
            },
            "type": "array"
          },
          "limit": {
            "type": "integer"
          },
          "refreshCount": {
            "type": "integer"
          },
          "sendCount": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerClanGamesLeaderboardItem": {
        "properties": {
          "clan_games": {
            "type": "integer"
          },
          "clan_name": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "player_name": {
            "type": "string"
          },
          "player_tag": {
            "type": "string"
          },
          "rank": {
            "type": "integer"
          },
          "score": {
            "type": "integer"
          },
          "townhall_level": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerClanGamesLeaderboardResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ServerClanGamesLeaderboardItem"
            },
            "type": "array"
          },
          "season": {
            "type": "string"
          },
          "server_id": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "type": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerClanMember": {
        "properties": {
          "clan_name": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "townhall": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerClanMembersResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ServerClanMember"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerClanRanking": {
        "properties": {
          "capital_points": {
            "type": "integer"
          },
          "clan_level": {
            "type": "integer"
          },
          "clan_name": {
            "type": "string"
          },
          "clan_points": {
            "type": "integer"
          },
          "clan_tag": {
            "type": "string"
          },
          "country_code": {
            "type": "string"
          },
          "country_name": {
            "type": "string"
          },
          "global_rank": {
            "type": "integer"
          },
          "local_rank": {
            "type": "integer"
          },
          "member_count": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerCountdownsResponse": {
        "properties": {
          "countdowns": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.CountdownStatus"
            },
            "type": "array"
          },
          "server_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerDonationsLeaderboardItem": {
        "properties": {
          "clan_name": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "donated": {
            "type": "integer"
          },
          "player_name": {
            "type": "string"
          },
          "player_tag": {
            "type": "string"
          },
          "rank": {
            "type": "integer"
          },
          "received": {
            "type": "integer"
          },
          "score": {
            "type": "integer"
          },
          "townhall_level": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerDonationsLeaderboardResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ServerDonationsLeaderboardItem"
            },
            "type": "array"
          },
          "season": {
            "type": "string"
          },
          "server_id": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "type": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerEmbed": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/modelsv2.DiscordEmbed"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerEmbedsResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ServerEmbed"
            },
            "type": "array"
          },
          "total": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerGiveawaysResponse": {
        "properties": {
          "ended": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.GiveawayConfig"
            },
            "type": "array"
          },
          "ongoing": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.GiveawayConfig"
            },
            "type": "array"
          },
          "total": {
            "type": "integer"
          },
          "upcoming": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.GiveawayConfig"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerLeaderboardsResponse": {
        "properties": {
          "clans": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ServerClanRanking"
            },
            "type": "array"
          },
          "players": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ServerPlayerRanking"
            },
            "type": "array"
          },
          "server_id": {
            "type": "integer"
          },
          "total_clans": {
            "type": "integer"
          },
          "total_players": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerLegendsLeaderboardItem": {
        "properties": {
          "clan_name": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "player_name": {
            "type": "string"
          },
          "player_tag": {
            "type": "string"
          },
          "townhall_level": {
            "type": "integer"
          },
          "trophies": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerLegendsLeaderboardResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ServerLegendsLeaderboardItem"
            },
            "type": "array"
          },
          "server_id": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerLinkCreateRequest": {
        "properties": {
          "playerTag": {
            "type": "string"
          },
          "userID": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerLinkMutationResponse": {
        "properties": {
          "message": {
            "type": "string"
          },
          "player_tag": {
            "type": "string"
          },
          "user_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerLinkRole": {
        "properties": {
          "color": {
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerLinkedAccount": {
        "properties": {
          "added_at": {
            "type": "string"
          },
          "is_verified": {
            "type": "boolean"
          },
          "player_name": {
            "type": "string"
          },
          "player_tag": {
            "type": "string"
          },
          "town_hall": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerLinkedMember": {
        "properties": {
          "account_count": {
            "type": "integer"
          },
          "avatar_url": {
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "linked_accounts": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ServerLinkedAccount"
            },
            "type": "array"
          },
          "user_id": {
            "type": "string"
          },
          "username": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerLinksResponse": {
        "properties": {
          "filtered_members": {
            "type": "integer"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ServerLinkedMember"
            },
            "type": "array"
          },
          "members_with_links": {
            "type": "integer"
          },
          "roles": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ServerLinkRole"
            },
            "type": "array"
          },
          "total_linked_accounts": {
            "type": "integer"
          },
          "total_members": {
            "type": "integer"
          },
          "verified_accounts": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerLog": {
        "properties": {
          "channel_id": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "disabled": {
            "type": "boolean"
          },
          "thread_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "type": "string"
          },
          "webhook_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerLogsOperationResponse": {
        "properties": {
          "clan_tag": {
            "type": "string"
          },
          "deleted_log_types": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "logs": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ServerLog"
            },
            "type": "array"
          },
          "message": {
            "type": "string"
          },
          "server_id": {
            "type": "integer"
          },
          "updated_log_types": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerLogsResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "logs": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ServerLog"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerPanelBody": {
        "properties": {
          "button_color": {
            "type": "string"
          },
          "buttons": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "embed_name": {
            "type": "string"
          },
          "welcome_channel": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerPanelResponse": {
        "properties": {
          "button_color": {
            "type": "string"
          },
          "buttons": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "embed_name": {
            "type": "string"
          },
          "welcome_channel": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerPlayerRanking": {
        "properties": {
          "clan_name": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "country_code": {
            "type": "string"
          },
          "country_name": {
            "type": "string"
          },
          "global_rank": {
            "type": "integer"
          },
          "legend_trophies": {
            "type": "integer"
          },
          "local_rank": {
            "type": "integer"
          },
          "location_id": {
            "type": "string"
          },
          "player_name": {
            "type": "string"
          },
          "player_tag": {
            "type": "string"
          },
          "townhall_level": {
            "type": "integer"
          },
          "trophies": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerRemindersResponse": {
        "properties": {
          "capital_reminders": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ReminderConfig"
            },
            "type": "array"
          },
          "clan_games_reminders": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ReminderConfig"
            },
            "type": "array"
          },
          "inactivity_reminders": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ReminderConfig"
            },
            "type": "array"
          },
          "roster_reminders": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ReminderConfig"
            },
            "type": "array"
          },
          "war_reminders": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ReminderConfig"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerRole": {
        "properties": {
          "clan_tag": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "mode": {
            "type": "string"
          },
          "option": {
            "type": "string"
          },
          "role_id": {
            "type": "string"
          },
          "server_id": {
            "type": "integer"
          },
          "type": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerRoleResponse": {
        "properties": {
          "message": {
            "type": "string"
          },
          "role": {
            "$ref": "#/components/schemas/modelsv2.ServerRole"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerRolesResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "roles": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ServerRole"
            },
            "type": "array"
          },
          "server_id": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerSettingsDocument": {
        "properties": {
          "auto_eval_nickname": {
            "type": "boolean"
          },
          "autoboard_limit": {
            "type": "integer"
          },
          "autoeval": {
            "type": "boolean"
          },
          "autoeval_log": {
            "type": "string"
          },
          "autoeval_triggers": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "change_nickname": {
            "type": "boolean"
          },
          "clans": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ClanSettingsDetail"
            },
            "type": "array"
          },
          "countdowns": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          "embed_color": {
            "type": "string"
          },
          "family_label": {
            "type": "string"
          },
          "flair_non_family": {
            "type": "boolean"
          },
          "full_whitelist_role": {
            "type": "string"
          },
          "link_parse": {
            "$ref": "#/components/schemas/modelsv2.LinkParseSettings"
          },
          "name": {
            "type": "string"
          },
          "nickname_rule": {
            "type": "string"
          },
          "non_family_nickname_rule": {
            "type": "string"
          },
          "server": {
            "type": "integer"
          },
          "server_id": {
            "type": "string"
          },
          "server_roles": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ServerRole"
            },
            "type": "array"
          },
          "tied": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerSettingsResponse": {
        "properties": {
          "message": {
            "type": "string"
          },
          "server_id": {
            "type": "integer"
          },
          "updated_fields": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerSettingsUpdate": {
        "properties": {
          "auto_eval_nickname": {
            "type": "boolean"
          },
          "autoboard_limit": {
            "type": "integer"
          },
          "autoeval": {
            "type": "boolean"
          },
          "autoeval_log": {
            "type": "string"
          },
          "autoeval_triggers": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "change_nickname": {
            "type": "boolean"
          },
          "embed_color": {
            "type": "integer"
          },
          "family_label": {
            "type": "string"
          },
          "flair_non_family": {
            "type": "boolean"
          },
          "full_whitelist_role": {
            "type": "string"
          },
          "link_parse": {
            "$ref": "#/components/schemas/modelsv2.LinkParseSettings"
          },
          "nickname_rule": {
            "type": "string"
          },
          "non_family_nickname_rule": {
            "type": "string"
          },
          "tied": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerWarLeaderboardItem": {
        "properties": {
          "average_destruction": {
            "type": "number"
          },
          "average_stars": {
            "type": "number"
          },
          "clan_name": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "destruction_percentage": {
            "type": "number"
          },
          "player_name": {
            "type": "string"
          },
          "player_tag": {
            "type": "string"
          },
          "rank": {
            "type": "integer"
          },
          "three_star_attacks": {
            "type": "integer"
          },
          "three_star_rate": {
            "type": "number"
          },
          "total_attacks": {
            "type": "integer"
          },
          "total_stars": {
            "type": "integer"
          },
          "townhall_level": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.ServerWarLeaderboardResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ServerWarLeaderboardItem"
            },
            "type": "array"
          },
          "server_id": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsArmiesQuery": {
        "properties": {
          "dates": {
            "$ref": "#/components/schemas/modelsv2.StatsDateFilter"
          },
          "equal_townhalls": {
            "type": "boolean"
          },
          "exclude_items": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "include_items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.StatsItemQuantityFilter"
            },
            "type": "array"
          },
          "limit": {
            "default": 25,
            "maximum": 100,
            "minimum": 1,
            "type": "integer"
          },
          "minimum_sample_size": {
            "default": 100,
            "minimum": 1,
            "type": "integer"
          },
          "opponent_townhall_level": {
            "minimum": 1,
            "type": "integer"
          },
          "ranked_league_tier_id": {
            "minimum": 1,
            "type": "integer"
          },
          "sort_by": {
            "default": "usage_rate",
            "enum": [
              "usage_rate",
              "three_star_rate",
              "average_stars",
              "average_destruction"
            ],
            "type": "string"
          },
          "townhall_level": {
            "minimum": 1,
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsArmiesResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "date_range": {
            "$ref": "#/components/schemas/modelsv2.StatsDateRange"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.StatsArmyItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsArmyItem": {
        "properties": {
          "army_counts": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object"
          },
          "army_items": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "army_share_code": {
            "type": "string"
          },
          "available": {
            "type": "boolean"
          },
          "average_destruction": {
            "type": "number"
          },
          "average_stars": {
            "type": "number"
          },
          "daily": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.StatsDailyPoint"
            },
            "type": "array"
          },
          "one_star_rate": {
            "type": "number"
          },
          "sample_size": {
            "type": "integer"
          },
          "three_star_rate": {
            "type": "number"
          },
          "two_star_rate": {
            "type": "number"
          },
          "usage_rate": {
            "type": "number"
          },
          "zero_star_rate": {
            "type": "number"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsBreakdown": {
        "properties": {
          "key": {
            "type": "string"
          },
          "metrics": {
            "$ref": "#/components/schemas/modelsv2.StatsMetrics"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsCWLQuery": {
        "properties": {
          "cwl_league_id": {
            "type": "integer"
          },
          "dates": {
            "$ref": "#/components/schemas/modelsv2.StatsDateFilter"
          },
          "equal_townhalls": {
            "default": true,
            "type": "boolean"
          },
          "opponent_townhall_level": {
            "minimum": 1,
            "type": "integer"
          },
          "seasons": {
            "example": [
              "2026-07"
            ],
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "townhall_level": {
            "minimum": 1,
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsDailyPoint": {
        "properties": {
          "average_destruction": {
            "type": "number"
          },
          "average_stars": {
            "type": "number"
          },
          "date": {
            "type": "string"
          },
          "one_star_rate": {
            "type": "number"
          },
          "sample_size": {
            "type": "integer"
          },
          "three_star_rate": {
            "type": "number"
          },
          "two_star_rate": {
            "type": "number"
          },
          "usage_rate": {
            "type": "number"
          },
          "use_count": {
            "type": "integer"
          },
          "zero_star_rate": {
            "type": "number"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsDateFilter": {
        "properties": {
          "end_date": {
            "example": "2026-07-20",
            "type": "string"
          },
          "start_date": {
            "example": "2026-07-01",
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsDateRange": {
        "properties": {
          "end": {
            "type": "string"
          },
          "start": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsItemQuantityFilter": {
        "properties": {
          "item": {
            "example": "u_1",
            "type": "string"
          },
          "max_quantity": {
            "minimum": 1,
            "type": "integer"
          },
          "min_quantity": {
            "minimum": 1,
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsItemResult": {
        "properties": {
          "available": {
            "type": "boolean"
          },
          "average_destruction": {
            "type": "number"
          },
          "average_stars": {
            "type": "number"
          },
          "composition_share": {
            "type": "number"
          },
          "daily": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.StatsDailyPoint"
            },
            "type": "array"
          },
          "hero": {
            "type": "string"
          },
          "hit_rate": {
            "type": "number"
          },
          "item": {
            "type": "string"
          },
          "one_star_rate": {
            "type": "number"
          },
          "sample_size": {
            "type": "integer"
          },
          "three_star_rate": {
            "type": "number"
          },
          "two_star_rate": {
            "type": "number"
          },
          "type": {
            "type": "string"
          },
          "usage_rate": {
            "type": "number"
          },
          "use_count": {
            "type": "integer"
          },
          "zero_star_rate": {
            "type": "number"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsItemSelector": {
        "properties": {
          "hero": {
            "example": "Archer Queen",
            "type": "string"
          },
          "item": {
            "example": "u_1",
            "type": "string"
          },
          "type": {
            "enum": [
              "troop",
              "spell",
              "hero",
              "pet",
              "equipment"
            ],
            "example": "troop",
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsItemsQuery": {
        "properties": {
          "dates": {
            "$ref": "#/components/schemas/modelsv2.StatsDateFilter"
          },
          "equal_townhalls": {
            "type": "boolean"
          },
          "exclude_items": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "include_items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.StatsItemQuantityFilter"
            },
            "type": "array"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.StatsItemSelector"
            },
            "type": "array"
          },
          "minimum_sample_size": {
            "default": 100,
            "minimum": 1,
            "type": "integer"
          },
          "opponent_townhall_level": {
            "minimum": 1,
            "type": "integer"
          },
          "ranked_league_tier_id": {
            "minimum": 1,
            "type": "integer"
          },
          "townhall_level": {
            "minimum": 1,
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsItemsResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "date_range": {
            "$ref": "#/components/schemas/modelsv2.StatsDateRange"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.StatsItemResult"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsMetrics": {
        "properties": {
          "available": {
            "type": "boolean"
          },
          "average_destruction": {
            "type": "number"
          },
          "average_stars": {
            "type": "number"
          },
          "daily": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.StatsDailyPoint"
            },
            "type": "array"
          },
          "one_star_rate": {
            "type": "number"
          },
          "sample_size": {
            "type": "integer"
          },
          "three_star_rate": {
            "type": "number"
          },
          "two_star_rate": {
            "type": "number"
          },
          "usage_rate": {
            "type": "number"
          },
          "zero_star_rate": {
            "type": "number"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsOverviewResponse": {
        "properties": {
          "counts": {
            "$ref": "#/components/schemas/modelsv2.GlobalCountsResponse"
          },
          "cwl": {
            "$ref": "#/components/schemas/modelsv2.StatsMetrics"
          },
          "date_range": {
            "$ref": "#/components/schemas/modelsv2.StatsDateRange"
          },
          "ranked": {
            "$ref": "#/components/schemas/modelsv2.StatsMetrics"
          },
          "war": {
            "$ref": "#/components/schemas/modelsv2.StatsMetrics"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsPerformanceResponse": {
        "properties": {
          "breakdowns": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.StatsBreakdown"
            },
            "type": "array"
          },
          "date_range": {
            "$ref": "#/components/schemas/modelsv2.StatsDateRange"
          },
          "metrics": {
            "$ref": "#/components/schemas/modelsv2.StatsMetrics"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsRankedQuery": {
        "properties": {
          "dates": {
            "$ref": "#/components/schemas/modelsv2.StatsDateFilter"
          },
          "ranked_league_tier_id": {
            "example": 1,
            "minimum": 1,
            "type": "integer"
          },
          "townhall_level": {
            "minimum": 1,
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.StatsWarQuery": {
        "properties": {
          "dates": {
            "$ref": "#/components/schemas/modelsv2.StatsDateFilter"
          },
          "equal_townhalls": {
            "default": true,
            "type": "boolean"
          },
          "opponent_townhall_level": {
            "minimum": 1,
            "type": "integer"
          },
          "townhall_level": {
            "minimum": 1,
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.StrikeItem": {
        "properties": {
          "added_by": {
            "type": "string"
          },
          "added_by_avatar_url": {
            "type": "string"
          },
          "added_by_username": {
            "type": "string"
          },
          "clan_name": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "current_role": {
            "type": "string"
          },
          "date_created": {
            "type": "string"
          },
          "image": {
            "type": "string"
          },
          "player_name": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "rollover_date": {
            "type": "integer"
          },
          "server": {
            "type": "integer"
          },
          "strike_id": {
            "type": "string"
          },
          "strike_weight": {
            "type": "integer"
          },
          "tag": {
            "type": "string"
          },
          "town_hall": {
            "type": "integer"
          },
          "trophies": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.StrikeListResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.StrikeItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.StrikeMutationResponse": {
        "properties": {
          "player_name": {
            "type": "string"
          },
          "player_tag": {
            "type": "string"
          },
          "server_id": {
            "type": "integer"
          },
          "status": {
            "type": "string"
          },
          "strike_id": {
            "type": "string"
          },
          "total_strikes": {
            "type": "integer"
          },
          "total_weight": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.StrikeRequest": {
        "properties": {
          "added_by": {
            "type": "string"
          },
          "image": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "rollover_days": {
            "type": "integer"
          },
          "strike_weight": {
            "default": 1,
            "maximum": 2147483647,
            "minimum": 1,
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.StrikeSummaryResponse": {
        "properties": {
          "player_tag": {
            "type": "string"
          },
          "server_id": {
            "type": "integer"
          },
          "strikes": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.StrikeItem"
            },
            "type": "array"
          },
          "total_strikes": {
            "type": "integer"
          },
          "total_weight": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.TicketButton": {
        "properties": {
          "custom_id": {
            "type": "string"
          },
          "emoji": {
            "$ref": "#/components/schemas/modelsv2.DiscordEmoji"
          },
          "label": {
            "type": "string"
          },
          "style": {
            "type": "integer"
          },
          "type": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.TicketButtonSettings": {
        "properties": {
          "account_apply": {
            "type": "boolean"
          },
          "apply_clans": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "mod_role": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "naming": {
            "type": "string"
          },
          "new_message": {
            "type": "string"
          },
          "no_ping_mod_role": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "num_apply": {
            "type": "integer"
          },
          "player_info": {
            "type": "boolean"
          },
          "private_thread": {
            "type": "boolean"
          },
          "questions": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "roles_to_add": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "roles_to_remove": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "th_min": {
            "type": "integer"
          },
          "townhall_requirements": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object"
          }
        },
        "type": "object"
      },
      "modelsv2.TicketPanel": {
        "properties": {
          "approve_messages": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.ApproveMessage"
            },
            "type": "array"
          },
          "button_settings": {
            "additionalProperties": {
              "$ref": "#/components/schemas/modelsv2.TicketButtonSettings"
            },
            "type": "object"
          },
          "closed_category": {
            "type": "string"
          },
          "components": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.TicketButton"
            },
            "type": "array"
          },
          "embed_name": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "open_category": {
            "type": "string"
          },
          "server_id": {
            "type": "integer"
          },
          "sleep_category": {
            "type": "string"
          },
          "status_change_log": {
            "type": "string"
          },
          "ticket_button_click_log": {
            "type": "string"
          },
          "ticket_close_log": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.TicketPanelsResponse": {
        "properties": {
          "available_embeds": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.TicketPanel"
            },
            "type": "array"
          },
          "total": {
            "type": "integer"
          },
          "townhall_requirement_fields": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.TimeRange": {
        "properties": {
          "end": {
            "type": "integer"
          },
          "start": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.TrophyBucket": {
        "properties": {
          "bucket": {
            "type": "integer"
          },
          "players": {
            "type": "integer"
          },
          "trophies": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.TrophyBucketsResponse": {
        "properties": {
          "count": {
            "type": "integer"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.TrophyBucket"
            },
            "type": "array"
          },
          "league_tier_id": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.UpdateReminderRequest": {
        "properties": {
          "attack_threshold": {
            "type": "integer"
          },
          "channel_id": {
            "type": "string"
          },
          "custom_text": {
            "type": "string"
          },
          "ping_type": {
            "type": "string"
          },
          "point_threshold": {
            "type": "integer"
          },
          "roles": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "thread_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "time": {
            "type": "string"
          },
          "townhall_filter": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "war_types": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.UpdateRosterRequest": {
        "properties": {
          "alias": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "columns": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": {
            "type": "string"
          },
          "event_start_time": {
            "type": "integer"
          },
          "group_id": {
            "type": "string"
          },
          "max_accounts_per_user": {
            "type": "integer"
          },
          "max_th": {
            "type": "integer"
          },
          "message_id": {
            "type": "string"
          },
          "min_signups": {
            "type": "integer"
          },
          "min_th": {
            "type": "integer"
          },
          "recurrence_day_of_month": {
            "type": "integer"
          },
          "recurrence_days": {
            "type": "integer"
          },
          "roster_type": {
            "enum": [
              "clan",
              "family"
            ],
            "type": "string"
          },
          "signup_scope": {
            "enum": [
              "clan-only",
              "family-wide"
            ],
            "type": "string"
          },
          "sort": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.RosterViewSort"
            },
            "type": "array"
          },
          "webhook_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.UpdateServerLogsDisabledRequest": {
        "properties": {
          "clan_tag": {
            "type": "string"
          },
          "disabled": {
            "type": "boolean"
          },
          "log_types": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.UpdateServerLogsRequest": {
        "properties": {
          "channel_id": {
            "type": "string"
          },
          "clan_tag": {
            "type": "string"
          },
          "log_types": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "thread_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "modelsv2.UpsertEmbedRequest": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/modelsv2.DiscordEmbed"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.UserAccountSummary": {
        "properties": {
          "follower_count": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.WarAttack": {
        "properties": {
          "attackerTag": {
            "type": "string"
          },
          "defenderTag": {
            "type": "string"
          },
          "destructionPercentage": {
            "type": "integer"
          },
          "duration": {
            "type": "integer"
          },
          "order": {
            "type": "integer"
          },
          "stars": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.WarBadgeURLs": {
        "properties": {
          "large": {
            "type": "string"
          },
          "medium": {
            "type": "string"
          },
          "small": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.WarClan": {
        "properties": {
          "attacks": {
            "type": "integer"
          },
          "badgeUrls": {
            "$ref": "#/components/schemas/modelsv2.WarBadgeURLs"
          },
          "clanLevel": {
            "type": "integer"
          },
          "destructionPercentage": {
            "type": "number"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.WarMember"
            },
            "type": "array"
          },
          "name": {
            "type": "string"
          },
          "stars": {
            "type": "integer"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.WarClanTagsBody": {
        "properties": {
          "clan_tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.WarCompletedDailyItem": {
        "properties": {
          "day": {
            "type": "string"
          },
          "warType": {
            "type": "string"
          },
          "warsCompleted": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.WarCompletedDailyResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.WarCompletedDailyItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.WarHitBucket": {
        "properties": {
          "byEnemyTownhall": {
            "additionalProperties": {
              "$ref": "#/components/schemas/modelsv2.WarMatchupStats"
            },
            "type": "object"
          },
          "byEnemyTownhallDef": {
            "additionalProperties": {
              "$ref": "#/components/schemas/modelsv2.WarMatchupStats"
            },
            "type": "object"
          },
          "missedAttacks": {
            "type": "integer"
          },
          "missedDefenses": {
            "type": "integer"
          },
          "starsCount": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object"
          },
          "starsCountDef": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object"
          },
          "totalAttacks": {
            "type": "integer"
          },
          "totalDefenses": {
            "type": "integer"
          },
          "warsCounts": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.WarHitStats": {
        "properties": {
          "all": {
            "$ref": "#/components/schemas/modelsv2.WarHitBucket"
          },
          "cwl": {
            "$ref": "#/components/schemas/modelsv2.WarHitBucket"
          },
          "friendly": {
            "$ref": "#/components/schemas/modelsv2.WarHitBucket"
          },
          "random": {
            "$ref": "#/components/schemas/modelsv2.WarHitBucket"
          }
        },
        "type": "object"
      },
      "modelsv2.WarHitWar": {
        "properties": {
          "members": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.WarMember"
            },
            "type": "array"
          },
          "missedAttacks": {
            "type": "integer"
          },
          "missedDefenses": {
            "type": "integer"
          },
          "war_data": {
            "$ref": "#/components/schemas/modelsv2.WarResponse"
          }
        },
        "type": "object"
      },
      "modelsv2.WarListResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.WarResponse"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.WarMatchupStats": {
        "properties": {
          "averageDestruction": {
            "type": "number"
          },
          "averageStars": {
            "type": "number"
          },
          "count": {
            "type": "integer"
          },
          "starsCount": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object"
          }
        },
        "type": "object"
      },
      "modelsv2.WarMember": {
        "properties": {
          "attacks": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.WarAttack"
            },
            "type": "array"
          },
          "bestOpponentAttack": {
            "$ref": "#/components/schemas/modelsv2.WarAttack"
          },
          "mapPosition": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "opponentAttacks": {
            "type": "integer"
          },
          "tag": {
            "type": "string"
          },
          "townhallLevel": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.WarPlayersBody": {
        "properties": {
          "players": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.WarResponse": {
        "properties": {
          "attacksPerMember": {
            "type": "integer"
          },
          "battleModifier": {
            "type": "string"
          },
          "clan": {
            "$ref": "#/components/schemas/modelsv2.WarClan"
          },
          "endTime": {
            "type": "string"
          },
          "opponent": {
            "$ref": "#/components/schemas/modelsv2.WarClan"
          },
          "preparationStartTime": {
            "type": "string"
          },
          "startTime": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "teamSize": {
            "type": "integer"
          },
          "warStartTime": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.WarStatsItem": {
        "properties": {
          "clan_tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "war_count": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "modelsv2.WarStatsResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.WarStatsItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.WarSummaryInfo": {
        "properties": {
          "bypass": {
            "type": "boolean"
          },
          "currentWarInfo": {
            "$ref": "#/components/schemas/modelsv2.WarResponse"
          },
          "state": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.WarSummaryListResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.WarSummaryResponse"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.WarSummaryResponse": {
        "properties": {
          "clan_tag": {
            "type": "string"
          },
          "isInCwl": {
            "type": "boolean"
          },
          "isInWar": {
            "type": "boolean"
          },
          "league_info": {
            "$ref": "#/components/schemas/modelsv2.CWLGroupResponse"
          },
          "war_info": {
            "$ref": "#/components/schemas/modelsv2.WarSummaryInfo"
          },
          "war_league_infos": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.WarResponse"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "modelsv2.WarWeeklyHitrateItem": {
        "properties": {
          "attacks": {
            "type": "integer"
          },
          "averageDestruction": {
            "type": "number"
          },
          "averageStars": {
            "type": "number"
          },
          "hitrate": {
            "type": "number"
          },
          "townhallLevel": {
            "type": "integer"
          },
          "triples": {
            "type": "integer"
          },
          "warType": {
            "type": "string"
          },
          "week": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "modelsv2.WarWeeklyHitrateResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/modelsv2.WarWeeklyHitrateItem"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "routes.clanWarLogClanSide": {
        "properties": {
          "attacks": {
            "type": "integer"
          },
          "badgeUrls": {
            "$ref": "#/components/schemas/routes.officialBadgeURLs"
          },
          "clanLevel": {
            "type": "integer"
          },
          "destructionPercentage": {
            "type": "number"
          },
          "name": {
            "type": "string"
          },
          "stars": {
            "type": "integer"
          },
          "tag": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "routes.clanWarLogItem": {
        "properties": {
          "attacksPerMember": {
            "type": "integer"
          },
          "clan": {
            "$ref": "#/components/schemas/routes.clanWarLogClanSide"
          },
          "endTime": {
            "type": "string"
          },
          "opponent": {
            "$ref": "#/components/schemas/routes.clanWarLogClanSide"
          },
          "result": {
            "type": "string"
          },
          "teamSize": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "routes.clanWarLogResponse": {
        "properties": {
          "isPrivate": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/routes.clanWarLogItem"
            },
            "type": "array"
          },
          "reconstructed": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "routes.officialBadgeURLs": {
        "properties": {
          "large": {
            "type": "string"
          },
          "medium": {
            "type": "string"
          },
          "small": {
            "type": "string"
          }
        },
        "type": "object"
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "description": "Enter `Bearer \u003caccess_token\u003e`.",
        "in": "header",
        "name": "Authorization",
        "type": "apiKey"
      }
    }
  },
  "info": {
    "contact": {},
    "description": "ClashKing Go API documentation. This API is still under active construction, so use it with caution because endpoints and payloads may still change.",
    "title": "ClashKing API",
    "version": "1.0"
  },
  "openapi": "3.2.0",
  "paths": {
    "/builderbaseleagues": {
      "get": {
        "description": "Returns legacy builder base league metadata.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BuilderBaseLeaguesResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "summary": "Get builder base leagues",
        "tags": [
          "Other"
        ]
      }
    },
    "/cwl/{clanTag}/group": {
      "get": {
        "description": "Returns the current season CWL group for a clan.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clanTag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.CWLGroupResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Get current CWL group",
        "tags": [
          "War"
        ]
      }
    },
    "/cwl/{clanTag}/{season}": {
      "get": {
        "description": "Returns the CWL group for a clan and season.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clanTag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Season YYYY-MM",
            "in": "path",
            "name": "season",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.CWLGroupResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get CWL group by season",
        "tags": [
          "War"
        ]
      }
    },
    "/global/counts": {
      "get": {
        "description": "Returns global tracking counts used by legacy clients.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.GlobalCountsResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Get global ClashKing counts",
        "tags": [
          "Global"
        ]
      }
    },
    "/list/seasons": {
      "get": {
        "description": "Returns recent season identifiers in YYYY-MM format.",
        "parameters": [
          {
            "description": "Number of previous months to include",
            "in": "query",
            "name": "last",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "List recent seasons",
        "tags": [
          "Lists"
        ]
      }
    },
    "/list/townhalls": {
      "get": {
        "description": "Returns distinct current town hall levels from tracked players.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "type": "integer"
                  },
                  "type": "array"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "List tracked town halls",
        "tags": [
          "Lists"
        ]
      }
    },
    "/v2/achievements/check": {
      "post": {
        "description": "Checks verified linked players for achievements that can currently be evaluated, awards new matches, and returns the full catalog.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AchievementsResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Check achievements",
        "tags": [
          "Achievements"
        ]
      }
    },
    "/v2/activity/guild-summary": {
      "get": {
        "description": "Returns clan and member activity totals for a Discord guild.",
        "parameters": [
          {
            "description": "Discord guild ID",
            "in": "query",
            "name": "guild_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Days without login to be considered inactive (default 7)",
            "in": "query",
            "name": "inactive_threshold_days",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.GuildSummaryResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get guild activity summary",
        "tags": [
          "Activity \u0026 Inactivity"
        ]
      }
    },
    "/v2/app/announcements": {
      "get": {
        "description": "Returns mobile app announcements.",
        "parameters": [
          {
            "description": "draft, scheduled, published, or archived",
            "in": "query",
            "name": "status",
            "schema": {
              "enum": [
                "draft",
                "scheduled",
                "published",
                "archived"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AnnouncementListResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "List app announcements",
        "tags": [
          "Mobile App"
        ]
      },
      "post": {
        "description": "Creates a mobile app announcement.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AnnouncementRequest"
              }
            }
          },
          "description": "Announcement payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.Announcement"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Create app announcement",
        "tags": [
          "Mobile App"
        ]
      }
    },
    "/v2/app/announcements/active": {
      "get": {
        "description": "Returns the currently active mobile app announcement, if one exists.",
        "parameters": [
          {
            "description": "all, ios, or android",
            "in": "query",
            "name": "target",
            "schema": {
              "enum": [
                "all",
                "ios",
                "android"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ActiveAnnouncementResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          }
        },
        "summary": "Get active app announcement",
        "tags": [
          "Mobile App"
        ]
      }
    },
    "/v2/app/announcements/{id}": {
      "delete": {
        "description": "Archives a mobile app announcement.",
        "parameters": [
          {
            "description": "Announcement ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.Announcement"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Archive app announcement",
        "tags": [
          "Mobile App"
        ]
      },
      "get": {
        "description": "Returns one mobile app announcement.",
        "parameters": [
          {
            "description": "Announcement ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.Announcement"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "summary": "Get app announcement",
        "tags": [
          "Mobile App"
        ]
      },
      "put": {
        "description": "Updates a mobile app announcement.",
        "parameters": [
          {
            "description": "Announcement ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AnnouncementRequest"
              }
            }
          },
          "description": "Announcement payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.Announcement"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update app announcement",
        "tags": [
          "Mobile App"
        ]
      }
    },
    "/v2/app/discohook-resolve": {
      "get": {
        "parameters": [
          {
            "description": "Discohook share URL",
            "in": "query",
            "name": "url",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.DiscohookResolveResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unprocessable Entity"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Resolve a Discohook share URL",
        "tags": [
          "Dashboard"
        ]
      }
    },
    "/v2/auth/discord": {
      "post": {
        "description": "Exchanges Discord OAuth credentials for a ClashKing session.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthDiscordOAuthRequest"
              }
            }
          },
          "description": "Discord OAuth payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Authenticate with Discord",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/auth/email": {
      "post": {
        "description": "Validates email/password credentials and returns access and refresh tokens.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthEmailAuthRequest"
              }
            }
          },
          "description": "Login payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          }
        },
        "summary": "Authenticate with email",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/auth/forgot-password": {
      "post": {
        "description": "Issues a password reset code for the matching email account.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthForgotPasswordRequest"
              }
            }
          },
          "description": "Forgot password payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthForgotPasswordResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "summary": "Request password reset",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/auth/me": {
      "get": {
        "description": "Returns the authenticated user's current profile information.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.CurrentUserInfo"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get current user information",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/auth/refresh": {
      "post": {
        "description": "Validates a refresh token and returns a new access token for the same user.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthRefreshTokenRequest"
              }
            }
          },
          "description": "Refresh token payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthRefreshTokenResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "summary": "Refresh the access token",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/auth/register": {
      "post": {
        "description": "Creates a pending email registration and issues a verification code.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthEmailRegisterRequest"
              }
            }
          },
          "description": "Registration payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthVerificationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Register with email",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/auth/resend-verification": {
      "post": {
        "description": "Resends the verification code for a pending email registration.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthForgotPasswordRequest"
              }
            }
          },
          "description": "Email payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthVerificationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "410": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Gone"
          }
        },
        "summary": "Resend verification email",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/auth/reset-password": {
      "post": {
        "description": "Validates a password reset token and updates the account password.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthResetPasswordRequest"
              }
            }
          },
          "description": "Reset password payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "summary": "Reset password with token",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/auth/verify-email-code": {
      "post": {
        "description": "Confirms a pending email registration by checking the verification code and creates the account session.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthEmailCodeRequest"
              }
            }
          },
          "description": "Verification payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Verify email address with 6-digit code",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/auth/web/discord": {
      "post": {
        "description": "Returns a short-lived access token and sets a rotating HttpOnly refresh cookie.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthDiscordOAuthRequest"
              }
            }
          },
          "description": "Discord OAuth payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthWebResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          }
        },
        "summary": "Authenticate a browser with Discord",
        "tags": [
          "Web Authentication"
        ]
      }
    },
    "/v2/auth/web/email": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthEmailAuthRequest"
              }
            }
          },
          "description": "Login payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthWebResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Authenticate a browser with email",
        "tags": [
          "Web Authentication"
        ]
      }
    },
    "/v2/auth/web/logout": {
      "post": {
        "responses": {
          "204": {
            "description": "No Content"
          }
        },
        "summary": "Log out a browser session",
        "tags": [
          "Web Authentication"
        ]
      }
    },
    "/v2/auth/web/refresh": {
      "post": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthWebRefreshResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Refresh a browser session",
        "tags": [
          "Web Authentication"
        ]
      }
    },
    "/v2/auth/web/reset-password": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthResetPasswordRequest"
              }
            }
          },
          "description": "Reset payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthWebResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Reset a browser account password",
        "tags": [
          "Web Authentication"
        ]
      }
    },
    "/v2/auth/web/verify-email-code": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthEmailCodeRequest"
              }
            }
          },
          "description": "Verification payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthWebResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Verify browser email registration",
        "tags": [
          "Web Authentication"
        ]
      }
    },
    "/v2/bases/{base_id}/downloaders/{user_id}": {
      "post": {
        "description": "Adds one Discord user ID to unique download history. Repeated downloads by the same user are a no-op. This endpoint accepts only the configured bot credential.",
        "parameters": [
          {
            "description": "Base ID",
            "in": "path",
            "name": "base_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Discord user ID",
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BaseDownloadResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Record a trusted bot base download",
        "tags": [
          "Bases Bot Integration"
        ]
      }
    },
    "/v2/bases/{base_id}/votes/{voter_id}": {
      "delete": {
        "description": "Atomically and idempotently removes one Discord voter from both base voter arrays. This endpoint accepts only the configured bot credential.",
        "parameters": [
          {
            "description": "Base ID",
            "in": "path",
            "name": "base_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Discord voter ID",
            "in": "path",
            "name": "voter_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Remove a trusted bot base vote",
        "tags": [
          "Bases Bot Integration"
        ]
      },
      "put": {
        "description": "Atomically records or changes one vote in the base voter arrays. This endpoint accepts only the configured bot credential.",
        "parameters": [
          {
            "description": "Base ID",
            "in": "path",
            "name": "base_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Discord voter ID",
            "in": "path",
            "name": "voter_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.BaseVoteRequest"
              }
            }
          },
          "description": "Vote direction",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BaseVoteResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Record a trusted bot base vote",
        "tags": [
          "Bases Bot Integration"
        ]
      }
    },
    "/v2/billing/stripe/checkout": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.BillingCheckoutRequest"
              }
            }
          },
          "description": "Initial server assignment",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BillingSessionResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Create Stripe Checkout session",
        "tags": [
          "Billing"
        ]
      }
    },
    "/v2/billing/stripe/portal": {
      "post": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BillingSessionResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Create Stripe customer portal session",
        "tags": [
          "Billing"
        ]
      }
    },
    "/v2/billing/stripe/webhook": {
      "post": {
        "parameters": [
          {
            "description": "Stripe webhook signature",
            "in": "header",
            "name": "Stripe-Signature",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "summary": "Receive Stripe subscription events",
        "tags": [
          "Billing"
        ]
      }
    },
    "/v2/billing/subscription": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BillingSubscriptionResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get subscription entitlement",
        "tags": [
          "Billing"
        ]
      }
    },
    "/v2/billing/subscription/assignment": {
      "put": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.BillingAssignmentRequest"
              }
            }
          },
          "description": "Server assignment",
          "required": true
        },
        "responses": {
          "204": {
            "description": "No Content"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Assign subscription roster assistant credit",
        "tags": [
          "Billing"
        ]
      }
    },
    "/v2/billing/usage": {
      "get": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "serverId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BillingUsageResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get monthly roster assistant usage",
        "tags": [
          "Billing"
        ]
      }
    },
    "/v2/cdn/upload": {
      "post": {
        "description": "Uploads an arbitrary file and returns its public CDN URL. Requires authentication.",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "properties": {
                  "file": {
                    "description": "File to upload (max 25 MB)",
                    "format": "binary",
                    "type": "string"
                  }
                },
                "required": [
                  "file"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.CDNUploadResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Request Entity Too Large"
          },
          "415": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unsupported Media Type"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Upload a file to the ClashKing CDN",
        "tags": [
          "Other"
        ]
      }
    },
    "/v2/clan/{clan_tag}/badge": {
      "get": {
        "description": "Returns the clan badge image as a PNG.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "image/png": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "image/png": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "image/png": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get clan badge image",
        "tags": [
          "Clan"
        ]
      }
    },
    "/v2/clan/{clan_tag}/basic": {
      "get": {
        "description": "Returns tracked basic clan data for a clan tag.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ClanBasicResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get basic clan data",
        "tags": [
          "Clan"
        ]
      }
    },
    "/v2/clan/{clan_tag}/changes": {
      "get": {
        "description": "Returns stored clan changes such as description changes, clan level upgrades, and war league history.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Result limit, max 500",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Change type",
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ClanChangesResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get clan changes",
        "tags": [
          "Clan"
        ]
      }
    },
    "/v2/clan/{clan_tag}/join-leave": {
      "get": {
        "description": "Returns join and leave history for a single clan tag. available and uniquePlayers are all-time totals; date filters only affect returned items. Date filters use ISO-8601 values such as 2026-05-01T00:00:00Z.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Maximum events to return; 0 returns full matching history",
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer"
            }
          },
          {
            "description": "Only include events at or after this ISO-8601 time",
            "in": "query",
            "name": "time[after]",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Only include events at or before this ISO-8601 time",
            "in": "query",
            "name": "time[before]",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.JoinLeaveResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get clan join-leave history",
        "tags": [
          "Clan"
        ]
      }
    },
    "/v2/clan/{clan_tag}/leaderboard-history/{leaderboard_type}": {
      "get": {
        "description": "Returns typed dated placements for clan Home Village, Builder Base, or Capital leaderboards.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Canonical clan leaderboard type",
            "in": "path",
            "name": "leaderboard_type",
            "required": true,
            "schema": {
              "enum": [
                "clan_home_points",
                "clan_builder_base_points",
                "clan_capital_points"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ClanLeaderboardHistoryResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Get a clan's leaderboard history",
        "tags": [
          "Leaderboard"
        ]
      }
    },
    "/v2/clan/{clan_tag}/legend-history": {
      "get": {
        "description": "Returns normalized historical Legend finishers for one clan, ordered by best rank and then newest season.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Result limit",
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 200,
              "maximum": 1000,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ClanLegendHistoryResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Get a clan's final Legend finishers",
        "tags": [
          "Leaderboard"
        ]
      }
    },
    "/v2/clan/{clan_tag}/rankings": {
      "get": {
        "description": "Returns Home Village, Builder Base, and Clan Capital current points with every stored global/location placement.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ClanRankingsResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get rankings of a clan",
        "tags": [
          "Clan"
        ]
      }
    },
    "/v2/clan/{clan_tag}/war-log": {
      "get": {
        "description": "Returns the official war log when public. Private logs are reconstructed from stored wars with the same item shape and are marked with isPrivate and reconstructed.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Maximum wars to return",
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/routes.clanWarLogResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get a clan war log",
        "tags": [
          "Clan"
        ]
      }
    },
    "/v2/clan/{clan_tag}/wars": {
      "get": {
        "description": "Returns previous wars for a clan rebuilt from SQL war rows, attacks, and missed attacks.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Start Unix timestamp. Defaults to all history.",
            "in": "query",
            "name": "timestamp_start",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "End Unix timestamp",
            "in": "query",
            "name": "timestamp_end",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Maximum number of wars. Max 250.",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "War type filter. Repeatable. Values: random, friendly, cwl, all.",
            "in": "query",
            "name": "war_type",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Comma-separated war type filter. Values: random,friendly,cwl.",
            "in": "query",
            "name": "war_types",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.WarListResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get stored clan wars",
        "tags": [
          "Clan"
        ]
      }
    },
    "/v2/config/public": {
      "get": {
        "description": "Returns client-safe configuration values.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PublicConfigResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Get public configuration",
        "tags": [
          "Configuration"
        ]
      }
    },
    "/v2/counts": {
      "get": {
        "description": "Returns the current materialized global count summary. The legacy /global/counts caller remains supported separately.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.GlobalCountsResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get global ClashKing counts",
        "tags": [
          "Counts"
        ]
      }
    },
    "/v2/counts/clans/capital-leagues": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.GroupedCountsResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get clan capital league counts",
        "tags": [
          "Counts"
        ]
      }
    },
    "/v2/counts/clans/cwl-leagues": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.GroupedCountsResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get clan CWL league counts",
        "tags": [
          "Counts"
        ]
      }
    },
    "/v2/counts/clans/locations": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.GroupedCountsResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get clan location counts",
        "tags": [
          "Counts"
        ]
      }
    },
    "/v2/counts/players/builder-halls": {
      "get": {
        "description": "Builder Hall counts are not implemented because no durable Builder Hall count source exists yet.",
        "responses": {
          "501": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Implemented"
          }
        },
        "summary": "Get player builder hall counts",
        "tags": [
          "Counts"
        ]
      }
    },
    "/v2/counts/players/league-tiers": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.GroupedCountsResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get player league tier counts",
        "tags": [
          "Counts"
        ]
      }
    },
    "/v2/counts/players/town-halls": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.GroupedCountsResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get player town hall counts",
        "tags": [
          "Counts"
        ]
      }
    },
    "/v2/cwl/league-thresholds": {
      "get": {
        "description": "Returns the static CWL promotion and demotion thresholds list.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.CWLThresholdResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Promo and demotion thresholds for CWL leagues",
        "tags": [
          "War"
        ]
      }
    },
    "/v2/cwl/leagues/{league_id}/rankings": {
      "get": {
        "description": "Returns only persisted standings for one season, league, and war size. Empty standings are a successful empty result until Tracking has computed them.",
        "parameters": [
          {
            "description": "CWL league ID",
            "in": "path",
            "name": "league_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "CWL season (YYYY-MM)",
            "in": "query",
            "name": "season",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "CWL war size",
            "in": "query",
            "name": "war_size",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.CWLLeagueRankingsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Persisted CWL league rankings",
        "tags": [
          "War"
        ]
      }
    },
    "/v2/cwl/{clan_tag}": {
      "get": {
        "description": "Returns the requested season, or the most recent stored season when season is omitted.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "CWL season (YYYY-MM or YYYY-MM-DD)",
            "in": "query",
            "name": "season",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.CWLResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "summary": "Get a stored CWL group",
        "tags": [
          "CWL"
        ]
      }
    },
    "/v2/cwl/{clan_tag}/ranking-history": {
      "get": {
        "description": "Returns typed CWL group snapshots for a clan. A group without persisted standings returns its roster and lifecycle data with no synthetic ranking.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.CWLClanHistoryResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "CWL group history for a clan",
        "tags": [
          "War"
        ]
      }
    },
    "/v2/cwl/{clan_tag}/seasons": {
      "get": {
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.CWLSeasonsResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "List stored CWL seasons for a clan",
        "tags": [
          "CWL"
        ]
      }
    },
    "/v2/dates/current": {
      "get": {
        "description": "Returns current season and event date identifiers.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.CurrentDatesResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Get current dates",
        "tags": [
          "Dates"
        ]
      }
    },
    "/v2/dates/raid-weekends": {
      "get": {
        "description": "Returns the current raid weekend or a list of recent raid weekend dates.",
        "parameters": [
          {
            "description": "Number of raid weekends to return",
            "in": "query",
            "name": "number_of_weeks",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.DateItemsResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Get raid weekend dates",
        "tags": [
          "Dates"
        ]
      }
    },
    "/v2/dates/season-raid-dates": {
      "get": {
        "description": "Returns raid weekend dates for the requested season.",
        "parameters": [
          {
            "description": "Season in YYYY-MM format",
            "in": "query",
            "name": "season",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.DateItemsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          }
        },
        "summary": "Get season raid dates",
        "tags": [
          "Dates"
        ]
      }
    },
    "/v2/dates/season-start-end": {
      "get": {
        "description": "Returns RFC3339 season boundaries for the requested season identifier.",
        "parameters": [
          {
            "description": "Season in YYYY-MM format",
            "in": "query",
            "name": "season",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Use gold pass season boundaries",
            "in": "query",
            "name": "gold_pass_season",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.SeasonBoundsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          }
        },
        "summary": "Get season start/end",
        "tags": [
          "Dates"
        ]
      }
    },
    "/v2/dates/seasons": {
      "get": {
        "description": "Returns the current season or a list of previous seasons.",
        "parameters": [
          {
            "description": "Number of seasons to return",
            "in": "query",
            "name": "number_of_seasons",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Return seasons as text",
            "in": "query",
            "name": "as_text",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.DateItemsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          }
        },
        "summary": "Get season dates",
        "tags": [
          "Dates"
        ]
      }
    },
    "/v2/discord": {
      "post": {
        "description": "Exchanges Discord OAuth credentials for a ClashKing session.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthDiscordOAuthRequest"
              }
            }
          },
          "description": "Discord OAuth payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Authenticate with Discord",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/email": {
      "post": {
        "description": "Validates email/password credentials and returns access and refresh tokens.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthEmailAuthRequest"
              }
            }
          },
          "description": "Login payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          }
        },
        "summary": "Authenticate with email",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/enums": {
      "get": {
        "description": "Returns stable IDs, values, scopes, and descriptions for settings enums.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.EnumCatalogResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Get all API enums",
        "tags": [
          "Enums"
        ]
      }
    },
    "/v2/enums/countdown-types": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.EnumValuesResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Get countdown types",
        "tags": [
          "Enums"
        ]
      }
    },
    "/v2/enums/log-types": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.EnumValuesResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Get log types",
        "tags": [
          "Enums"
        ]
      }
    },
    "/v2/enums/role-modes": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.EnumValuesResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Get role modes",
        "tags": [
          "Enums"
        ]
      }
    },
    "/v2/enums/role-types": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.EnumValuesResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Get role types",
        "tags": [
          "Enums"
        ]
      }
    },
    "/v2/exports/war/cwl-summary": {
      "get": {
        "parameters": [
          {
            "description": "Clan tag",
            "in": "query",
            "name": "tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "summary": "Export CWL summary to Excel",
        "tags": [
          "Other"
        ]
      }
    },
    "/v2/exports/war/player-stats": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.PlayerWarStatsExportRequest"
              }
            }
          },
          "description": "Player tag and filters",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "summary": "Export player war statistics to Excel",
        "tags": [
          "Other"
        ]
      }
    },
    "/v2/forgot-password": {
      "post": {
        "description": "Issues a password reset code for the matching email account.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthForgotPasswordRequest"
              }
            }
          },
          "description": "Forgot password payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthForgotPasswordResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "summary": "Request password reset",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/guild-summary": {
      "get": {
        "description": "Returns clan and member activity totals for a Discord guild.",
        "parameters": [
          {
            "description": "Discord guild ID",
            "in": "query",
            "name": "guild_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Days without login to be considered inactive (default 7)",
            "in": "query",
            "name": "inactive_threshold_days",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.GuildSummaryResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get guild activity summary",
        "tags": [
          "Activity \u0026 Inactivity"
        ]
      }
    },
    "/v2/guild/{server_id}": {
      "get": {
        "description": "Returns guild metadata for the requested server. The authenticated user must be a member of the guild.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.GuildDetails"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get guild details by ID",
        "tags": [
          "Other"
        ]
      }
    },
    "/v2/guilds": {
      "get": {
        "description": "Returns the authenticated user's guilds and whether the bot is present. Only guilds where the user has MANAGE_GUILD permission or is owner are returned.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/modelsv2.GuildInfo"
                  },
                  "type": "array"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get user guilds with bot status",
        "tags": [
          "Other"
        ]
      }
    },
    "/v2/home/activity": {
      "query": {
        "description": "Uses RFC QUERY with a JSON body to return the newest clan membership activity.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.HomeActivityRequest"
              }
            }
          },
          "description": "Home activity selection",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.HomeActivityResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get Home activity",
        "tags": [
          "Activity \u0026 Inactivity"
        ]
      }
    },
    "/v2/initialization": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.MobilePlayerTagsRequest"
              }
            }
          },
          "description": "Initialization payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Initialize all account data for mobile app",
        "tags": [
          "Mobile App"
        ]
      }
    },
    "/v2/leaderboard/clan/win-streak": {
      "get": {
        "description": "Returns top clan win streaks.",
        "parameters": [
          {
            "description": "Result limit, max 500",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PublicClanLeaderboardResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get clan win streak leaderboard",
        "tags": [
          "Leaderboard"
        ]
      }
    },
    "/v2/leaderboard/history/{leaderboard_type}/{location_id}/{date}": {
      "get": {
        "description": "Reconstructs one typed official leaderboard response from its canonical history table, ordered by rank.",
        "parameters": [
          {
            "description": "Canonical leaderboard type",
            "in": "path",
            "name": "leaderboard_type",
            "required": true,
            "schema": {
              "enum": [
                "player_home_trophies",
                "player_builder_base_trophies",
                "clan_home_points",
                "clan_builder_base_points",
                "clan_capital_points"
              ],
              "type": "string"
            }
          },
          {
            "description": "Global or official numeric location ID",
            "in": "path",
            "name": "location_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Snapshot date YYYY-MM-DD",
            "in": "path",
            "name": "date",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.LeaderboardSnapshotHistoryResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Get a historical leaderboard snapshot",
        "tags": [
          "Leaderboard"
        ]
      }
    },
    "/v2/leaderboard/league/{league_tier_id}": {
      "get": {
        "description": "Returns the current top tracked players for a ranked league tier from the Valkey leaderboard snapshot.",
        "parameters": [
          {
            "description": "League tier ID",
            "in": "path",
            "name": "league_tier_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Result limit, max 500",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerLeaderboardResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Get league leaderboard",
        "tags": [
          "Leaderboard"
        ]
      }
    },
    "/v2/leaderboard/townhalls/{townhall_level}": {
      "get": {
        "description": "Returns the current top tracked players for a townhall level from the Valkey leaderboard snapshot.",
        "parameters": [
          {
            "description": "Townhall level",
            "in": "path",
            "name": "townhall_level",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Result limit, max 500",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerLeaderboardResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get townhall leaderboard",
        "tags": [
          "Leaderboard"
        ]
      }
    },
    "/v2/leaderboard/{league_tier_id}/trophy-buckets": {
      "get": {
        "description": "Returns current trophy and player totals grouped into trophy buckets for one league tier.",
        "parameters": [
          {
            "description": "League tier ID",
            "in": "path",
            "name": "league_tier_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.TrophyBucketsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get current trophy buckets",
        "tags": [
          "Leaderboard"
        ]
      }
    },
    "/v2/leaderboard/{location_id}/clan/donations": {
      "get": {
        "description": "Returns top donation clans for a location.",
        "parameters": [
          {
            "description": "Location ID",
            "in": "path",
            "name": "location_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Result limit, max 500",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PublicClanLeaderboardResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get clan donation leaderboard",
        "tags": [
          "Leaderboard"
        ]
      }
    },
    "/v2/leaderboard/{location_id}/clan/war-wins": {
      "get": {
        "description": "Returns top war wins clans for a location.",
        "parameters": [
          {
            "description": "Location ID",
            "in": "path",
            "name": "location_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Result limit, max 500",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PublicClanLeaderboardResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get clan war wins leaderboard",
        "tags": [
          "Leaderboard"
        ]
      }
    },
    "/v2/legends/history/{season}": {
      "get": {
        "description": "Returns the normalized final official Legend leaderboard for one season, ordered by rank.",
        "parameters": [
          {
            "description": "Authoritative official Legend season ID",
            "in": "path",
            "name": "season",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Result limit",
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "maximum": 200,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.LegendSeasonHistoryResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Get a final Legend season leaderboard",
        "tags": [
          "Leaderboard"
        ]
      }
    },
    "/v2/link/server/{server_id}/clan/list": {
      "get": {
        "description": "Returns a basic list of clans (tag+name) for a server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/modelsv2.ClanReference"
                  },
                  "type": "array"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "List server clans (basic)",
        "tags": [
          "Server Clans"
        ]
      }
    },
    "/v2/links/server/{server_id}": {
      "delete": {
        "description": "Deletes a link only after the Clash API confirms the player no longer exists.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Player tag",
            "in": "query",
            "name": "playerTag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerLinkMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete a stale server member link",
        "tags": [
          "Links"
        ]
      },
      "get": {
        "description": "Fetches up to 5,000 Discord members (cached for 15 minutes), excludes bots, joins visible links with basic_player, and supports member, player-tag, role-mention, and account filters. Multiple Discord role mentions are combined as a union.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Max members returned (default 100, maximum 5000)",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Pagination offset",
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Player tag, member username/display name, or one or more leading Discord role mentions",
            "in": "query",
            "name": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Member account filter; none means no visible links",
            "in": "query",
            "name": "account_filter",
            "schema": {
              "enum": [
                "none"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerLinksResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get links for Discord server members",
        "tags": [
          "Links"
        ]
      },
      "post": {
        "description": "Adds an unverified player link to a current Discord member. An existing unverified link is reassigned; a verified link owned by another user is never moved.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.ServerLinkCreateRequest"
              }
            }
          },
          "description": "Link payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerLinkMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Add or reassign a server member link",
        "tags": [
          "Links"
        ]
      }
    },
    "/v2/links/{id}": {
      "get": {
        "description": "Returns linked Clash of Clans accounts in order. last_login is the previous server timestamp recorded before the client updates it after Home loads.",
        "parameters": [
          {
            "description": "user id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AccountsListResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get all Clash of Clans accounts linked to a user",
        "tags": [
          "Links"
        ]
      },
      "post": {
        "description": "Links a Clash of Clans account.",
        "parameters": [
          {
            "description": "user id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AccountsCOCAccountRequest"
              }
            }
          },
          "description": "Account payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AccountsLinkResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AccountConflictErrorResponse"
                }
              }
            },
            "description": "Conflict"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Link a Clash of Clans account",
        "tags": [
          "Links"
        ]
      }
    },
    "/v2/links/{id}/bookmarks": {
      "get": {
        "description": "Returns saved search items.",
        "parameters": [
          {
            "description": "user id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "player or clan",
            "in": "query",
            "name": "type",
            "required": true,
            "schema": {
              "enum": [
                "player",
                "clan"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.SearchBookmarkListResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "List bookmarks",
        "tags": [
          "Links"
        ]
      },
      "post": {
        "description": "Saves a search item.",
        "parameters": [
          {
            "description": "user id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.SearchBookmarkRequest"
              }
            }
          },
          "description": "Bookmark payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.SearchBookmarkItem"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Save bookmark",
        "tags": [
          "Links"
        ]
      }
    },
    "/v2/links/{id}/bookmarks/order": {
      "put": {
        "description": "Reorders saved search items.",
        "parameters": [
          {
            "description": "user id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.SearchBookmarkOrderRequest"
              }
            }
          },
          "description": "Bookmark order",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AccountsMessageResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Reorder bookmarks",
        "tags": [
          "Links"
        ]
      }
    },
    "/v2/links/{id}/bookmarks/{type}/{tag}": {
      "delete": {
        "description": "Deletes a saved search item.",
        "parameters": [
          {
            "description": "user id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "player or clan",
            "in": "path",
            "name": "type",
            "required": true,
            "schema": {
              "enum": [
                "player",
                "clan"
              ],
              "type": "string"
            }
          },
          {
            "description": "Tag",
            "in": "path",
            "name": "tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AccountsMessageResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete bookmark",
        "tags": [
          "Links"
        ]
      }
    },
    "/v2/links/{id}/last-login": {
      "patch": {
        "description": "Records one server-generated login timestamp for every verified player linked to the account.",
        "parameters": [
          {
            "description": "user id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AccountsLastLoginResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Record a Home login",
        "tags": [
          "Links"
        ]
      }
    },
    "/v2/links/{id}/order": {
      "put": {
        "description": "Reorders linked Clash of Clans accounts.",
        "parameters": [
          {
            "description": "user id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AccountsReorderAccountsRequest"
              }
            }
          },
          "description": "Reorder payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AccountsMessageResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Reorder linked Clash of Clans accounts",
        "tags": [
          "Links"
        ]
      }
    },
    "/v2/links/{id}/searches": {
      "get": {
        "description": "Returns recent search items.",
        "parameters": [
          {
            "description": "user id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.SearchRecentGroupedResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "List recent searches",
        "tags": [
          "Links"
        ]
      }
    },
    "/v2/links/{id}/{playerTag}": {
      "delete": {
        "description": "Unlinks a Clash of Clans account.",
        "parameters": [
          {
            "description": "user id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Player tag",
            "in": "path",
            "name": "playerTag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AccountsMessageResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Remove a linked Clash of Clans account",
        "tags": [
          "Links"
        ]
      },
      "patch": {
        "description": "Sets hidden for a verified account owned by the requested link subject. Unverified accounts cannot be hidden.",
        "parameters": [
          {
            "description": "user id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Player tag",
            "in": "path",
            "name": "playerTag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AccountsLinkVisibilityRequest"
              }
            }
          },
          "description": "Visibility payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AccountsLinkedAccount"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Set linked account visibility",
        "tags": [
          "Links"
        ]
      }
    },
    "/v2/links/{id}/{playerTag}/upgrade-preferences": {
      "get": {
        "description": "Returns the preference object for a verified player linked to the account.",
        "parameters": [
          {
            "description": "user id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Player tag",
            "in": "path",
            "name": "playerTag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerUpgradePreferencesResponse"
                }
              }
            },
            "description": "OK"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get player upgrade preferences",
        "tags": [
          "Links"
        ]
      },
      "patch": {
        "description": "Shallow-merges preference keys for a verified player linked to the account and timestamps the change on the server.",
        "parameters": [
          {
            "description": "user id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Player tag",
            "in": "path",
            "name": "playerTag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.PlayerUpgradePreferencesPatchRequest"
              }
            }
          },
          "description": "Preference keys to merge",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerUpgradePreferencesResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Patch player upgrade preferences",
        "tags": [
          "Links"
        ]
      }
    },
    "/v2/links/{id}/{playerTag}/upgrades": {
      "get": {
        "description": "Returns the whole upgrade-data object for a verified player linked to the account.",
        "parameters": [
          {
            "description": "user id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Player tag",
            "in": "path",
            "name": "playerTag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerUpgradesResponse"
                }
              }
            },
            "description": "OK"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get player upgrades",
        "tags": [
          "Links"
        ]
      },
      "put": {
        "description": "Replaces the whole upgrade-data object for a verified player linked to the account and timestamps it on the server.",
        "parameters": [
          {
            "description": "user id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Player tag",
            "in": "path",
            "name": "playerTag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.PlayerUpgradesReplaceRequest"
              }
            }
          },
          "description": "Whole upgrade-data object",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerUpgradesResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Replace player upgrades",
        "tags": [
          "Links"
        ]
      }
    },
    "/v2/me": {
      "get": {
        "description": "Returns the authenticated user's current profile information.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.CurrentUserInfo"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get current user information",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/notifications/accounts/{player_tag}": {
      "put": {
        "parameters": [
          {
            "description": "Player tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.NotificationAccountPreferenceRequest"
              }
            }
          },
          "description": "Account notification preference",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.NotificationAccount"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Set player notification preference",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v2/notifications/devices": {
      "delete": {
        "parameters": [
          {
            "description": "Device id when the access token has no device claim",
            "in": "query",
            "name": "device_id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.NotificationMessageResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Unregister notification device",
        "tags": [
          "Notifications"
        ]
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.NotificationDeviceRequest"
              }
            }
          },
          "description": "Push device",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.NotificationDeviceResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Register notification device",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v2/notifications/preferences": {
      "get": {
        "parameters": [
          {
            "description": "Device id when the access token has no device claim",
            "in": "query",
            "name": "device_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Push environment",
            "in": "query",
            "name": "environment",
            "schema": {
              "enum": [
                "sandbox",
                "production"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.NotificationPreferencesResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get notification preferences",
        "tags": [
          "Notifications"
        ]
      },
      "put": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.NotificationPreferencesRequest"
              }
            }
          },
          "description": "Notification preferences",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.NotificationPreferencesResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Save notification preferences",
        "tags": [
          "Notifications"
        ]
      }
    },
    "/v2/player/{player_tag}/battlelog/history": {
      "get": {
        "description": "Returns historical returned battlelogs for a player, including farming hits when present.",
        "parameters": [
          {
            "description": "Player tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Result limit, max 500",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Days of history, max 365",
            "in": "query",
            "name": "days",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Battle type",
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter attacks or defenses",
            "in": "query",
            "name": "attack",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerBattlelogHistoryResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get player battlelog history",
        "tags": [
          "Player"
        ]
      }
    },
    "/v2/player/{player_tag}/changes": {
      "get": {
        "description": "Returns stored player profile changes such as upgrades.",
        "parameters": [
          {
            "description": "Player tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Result limit, max 500",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Change type",
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerChangesResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get player changes",
        "tags": [
          "Player"
        ]
      }
    },
    "/v2/player/{player_tag}/cwl/history": {
      "get": {
        "description": "Returns player-centric CWL seasons from normalized roster, completed war lineup, and attack facts. Clan totals and placements are returned only when persisted standings or complete war facts support them.",
        "parameters": [
          {
            "description": "Player tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.CWLPlayerHistoryResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "CWL group history for a player",
        "tags": [
          "War"
        ]
      }
    },
    "/v2/player/{player_tag}/join-leave": {
      "get": {
        "description": "Returns join and leave history for a single player tag. available is the all-time event total; date filters only affect returned items. Date filters use ISO-8601 values such as 2026-05-01T00:00:00Z.",
        "parameters": [
          {
            "description": "Player tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Maximum events to return; 0 returns full matching history",
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer"
            }
          },
          {
            "description": "Only include events at or after this ISO-8601 time",
            "in": "query",
            "name": "time[after]",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Only include events at or before this ISO-8601 time",
            "in": "query",
            "name": "time[before]",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.JoinLeaveResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get player join-leave history",
        "tags": [
          "Player"
        ]
      }
    },
    "/v2/player/{player_tag}/join-leave/shared": {
      "get": {
        "description": "Returns clans two players shared, total shared minutes per clan, and each shared time range.",
        "parameters": [
          {
            "description": "Player tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Other player tag",
            "in": "query",
            "name": "tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.JoinLeaveSharedResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get shared player join-leave clan totals",
        "tags": [
          "Player"
        ]
      }
    },
    "/v2/player/{player_tag}/join-leave/totals": {
      "get": {
        "description": "Returns total minutes and join visit counts for each clan a player spent time in across all stored join-leave history.",
        "parameters": [
          {
            "description": "Player tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.JoinLeaveTotalsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get player join-leave clan totals",
        "tags": [
          "Player"
        ]
      }
    },
    "/v2/player/{player_tag}/leaderboard-history/{leaderboard_type}": {
      "get": {
        "description": "Returns typed dated placements for player Home Village or Builder Base leaderboards.",
        "parameters": [
          {
            "description": "Player tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Canonical player leaderboard type",
            "in": "path",
            "name": "leaderboard_type",
            "required": true,
            "schema": {
              "enum": [
                "player_home_trophies",
                "player_builder_base_trophies"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerLeaderboardHistoryResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Get a player's leaderboard history",
        "tags": [
          "Leaderboard"
        ]
      }
    },
    "/v2/player/{player_tag}/legend-history": {
      "get": {
        "description": "Returns every normalized final Legend season placement for one player in descending season order.",
        "parameters": [
          {
            "description": "Player tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerLegendHistoryResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Get a player's final Legend history",
        "tags": [
          "Leaderboard"
        ]
      }
    },
    "/v2/player/{player_tag}/ranked/{season}/battlelog": {
      "get": {
        "description": "Returns player ranked season placement plus recent ranked battlelog rows.",
        "parameters": [
          {
            "description": "Player tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Ranked season ID",
            "in": "path",
            "name": "season",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Battlelog row limit, max 200",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerRankedBattlelogResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get player ranked battlelog",
        "tags": [
          "Player"
        ]
      }
    },
    "/v2/player/{player_tag}/ranked/{season}/group": {
      "get": {
        "description": "Returns ranked group data for the group containing the requested player.",
        "parameters": [
          {
            "description": "Player tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Ranked season ID",
            "in": "path",
            "name": "season",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerRankedGroupResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get player ranked group",
        "tags": [
          "Player"
        ]
      }
    },
    "/v2/player/{player_tag}/rankings": {
      "get": {
        "description": "Returns current Home Village and Builder Base points plus global and official-location placements. A retained location can have a null local rank when the player is no longer ranked there.",
        "parameters": [
          {
            "description": "Player tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerRankingsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get current player rankings",
        "tags": [
          "Player"
        ]
      }
    },
    "/v2/player/{player_tag}/stat-history": {
      "get": {
        "description": "Returns stored typed positive stat changes for a player over a half-open Unix timestamp range, newest first.",
        "parameters": [
          {
            "description": "Player tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Inclusive start Unix timestamp. Defaults to all history.",
            "in": "query",
            "name": "timestamp_start",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Exclusive end Unix timestamp.",
            "in": "query",
            "name": "timestamp_end",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Typed stat filter.",
            "in": "query",
            "name": "stat_type",
            "schema": {
              "enum": [
                "donated",
                "received",
                "clan_games",
                "capital_gold_donated"
              ],
              "type": "string"
            }
          },
          {
            "description": "Maximum number of changes. Default and max 500.",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerStatHistoryResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Get player stat changes",
        "tags": [
          "Player"
        ]
      }
    },
    "/v2/player/{player_tag}/war/attacks": {
      "get": {
        "description": "Returns stored attacks and defenses involving a player, most recent first.",
        "parameters": [
          {
            "description": "Player tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Start Unix timestamp",
            "in": "query",
            "name": "timestamp_start",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "End Unix timestamp",
            "in": "query",
            "name": "timestamp_end",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Maximum number of rows. Max 500.",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerWarAttacksResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get player war attacks",
        "tags": [
          "Player"
        ]
      }
    },
    "/v2/player/{player_tag}/war/stats": {
      "get": {
        "description": "Returns player war performance stats for all, random, friendly, and CWL wars in a time range.",
        "parameters": [
          {
            "description": "Player tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Start Unix timestamp. Defaults to 90 days ago.",
            "in": "query",
            "name": "timestamp_start",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "End Unix timestamp",
            "in": "query",
            "name": "timestamp_end",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerWarStatsResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get player war stats",
        "tags": [
          "Player"
        ]
      }
    },
    "/v2/public": {
      "get": {
        "description": "Returns client-safe configuration values.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PublicConfigResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Get public configuration",
        "tags": [
          "Configuration"
        ]
      }
    },
    "/v2/public-config": {
      "get": {
        "description": "Returns client-safe configuration values for the mobile app.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MobilePublicConfigResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Get public app configuration",
        "tags": [
          "Mobile App"
        ]
      }
    },
    "/v2/public/rosters/{publicShareId}": {
      "get": {
        "description": "Returns a restricted snapshot without answers, refresh errors, raw Discord IDs, or webhook fields.",
        "parameters": [
          {
            "description": "Public share ID",
            "in": "path",
            "name": "publicShareId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PublicRosterViewerResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "summary": "View a public roster",
        "tags": [
          "Public Rosters"
        ]
      }
    },
    "/v2/refresh": {
      "post": {
        "description": "Validates a refresh token and returns a new access token for the same user.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthRefreshTokenRequest"
              }
            }
          },
          "description": "Refresh token payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthRefreshTokenResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "summary": "Refresh the access token",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/register": {
      "post": {
        "description": "Creates a pending email registration and issues a verification code.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthEmailRegisterRequest"
              }
            }
          },
          "description": "Registration payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthVerificationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Register with email",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/resend-verification": {
      "post": {
        "description": "Resends the verification code for a pending email registration.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthForgotPasswordRequest"
              }
            }
          },
          "description": "Email payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthVerificationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "410": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Gone"
          }
        },
        "summary": "Resend verification email",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/reset-password": {
      "post": {
        "description": "Validates a password reset token and updates the account password.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthResetPasswordRequest"
              }
            }
          },
          "description": "Reset password payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "summary": "Reset password with token",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/roster": {
      "post": {
        "description": "Creates a new roster for a Discord server.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.CreateRosterRequest"
              }
            }
          },
          "description": "Roster",
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterMutationResponse"
                }
              }
            },
            "description": "Created"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Create roster",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/roster-automation": {
      "post": {
        "description": "Creates a new automation rule for rosters.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RosterAutomationRequest"
              }
            }
          },
          "description": "Automation rule",
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterAutomationMutationResponse"
                }
              }
            },
            "description": "Created"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Create roster automation",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/roster-automation/list": {
      "get": {
        "description": "Returns all automation rules for a server.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterAutomationListResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "List roster automation",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/roster-automation/{automation_id}": {
      "delete": {
        "description": "Deletes an automation rule.",
        "parameters": [
          {
            "description": "Automation ID",
            "in": "path",
            "name": "automation_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MessageResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete roster automation",
        "tags": [
          "Rosters"
        ]
      },
      "patch": {
        "description": "Updates an automation rule.",
        "parameters": [
          {
            "description": "Automation ID",
            "in": "path",
            "name": "automation_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RosterAutomationRequest"
              }
            }
          },
          "description": "Automation fields",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterAutomationMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update roster automation",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/roster-group": {
      "post": {
        "description": "Creates a new roster group.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RosterGroupRequest"
              }
            }
          },
          "description": "Roster group",
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterGroupMutationResponse"
                }
              }
            },
            "description": "Created"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Create roster group",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/roster-group/list": {
      "get": {
        "description": "Returns roster groups for a server.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterGroupListResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "List roster groups",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/roster-group/{group_id}": {
      "delete": {
        "description": "Deletes a roster group.",
        "parameters": [
          {
            "description": "Group ID",
            "in": "path",
            "name": "group_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterGroupDeleteResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete roster group",
        "tags": [
          "Rosters"
        ]
      },
      "get": {
        "description": "Returns a specific roster group.",
        "parameters": [
          {
            "description": "Group ID",
            "in": "path",
            "name": "group_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterGroupResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "summary": "Get roster group",
        "tags": [
          "Rosters"
        ]
      },
      "patch": {
        "description": "Updates a roster group.",
        "parameters": [
          {
            "description": "Group ID",
            "in": "path",
            "name": "group_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RosterGroupRequest"
              }
            }
          },
          "description": "Roster group fields",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterGroupMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update roster group",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/roster/ai/context": {
      "post": {
        "description": "Authenticates and meters an AI request, then returns trusted roster context to the Assistant Worker.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RosterAIRequest"
              }
            }
          },
          "description": "Conversation and roster attachments",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Prepare trusted AI roster context",
        "tags": [
          "Roster Builder"
        ]
      }
    },
    "/v2/roster/membership-changes": {
      "post": {
        "description": "Atomically applies exact membership changes when every affected roster still has the expected revision.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RosterMembershipApplyRequest"
              }
            }
          },
          "description": "Exact changes and expected roster revisions",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "OK"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Apply an approved transient roster proposal",
        "tags": [
          "Roster Builder"
        ]
      }
    },
    "/v2/roster/metrics": {
      "get": {
        "description": "Returns stable metric IDs available to saved roster views and the AI builder.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "items": {
                      "$ref": "#/components/schemas/modelsv2.RosterMetric"
                    },
                    "type": "array"
                  },
                  "type": "object"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "List roster metrics",
        "tags": [
          "Roster Builder"
        ]
      }
    },
    "/v2/roster/metrics/query": {
      "post": {
        "description": "Executes one allowlisted snapshot, historical, or derived metric with replayable parameters without creating a saved view.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RosterMetricQueryRequest"
              }
            }
          },
          "description": "Metric recipe",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Query one roster metric recipe",
        "tags": [
          "Roster Builder"
        ]
      }
    },
    "/v2/roster/missing-members": {
      "get": {
        "description": "Identifies clan members not yet registered in a roster.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Roster ID",
            "in": "query",
            "name": "roster_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Group ID",
            "in": "query",
            "name": "group_id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MissingRosterMembersResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "summary": "Get missing members",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/roster/questionnaire": {
      "put": {
        "description": "The fixed account selector is always first; incompatible edits transactionally remove matching member answers.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Roster ID",
            "in": "query",
            "name": "roster_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RosterQuestionnaireWrite"
              }
            }
          },
          "description": "Up to four questions",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterQuestionnaireMutationResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Replace a roster questionnaire",
        "tags": [
          "Roster Builder"
        ]
      }
    },
    "/v2/roster/refresh": {
      "post": {
        "description": "Refreshes member data from CoC API for one or more rosters.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Group ID",
            "in": "query",
            "name": "group_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Roster ID",
            "in": "query",
            "name": "roster_id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterRefreshResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Refresh rosters",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/roster/refresh-data": {
      "post": {
        "description": "Enforces the configured data cooldown, deduplicates player tags, and invalidates only base view caches.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Roster ID",
            "in": "query",
            "name": "roster_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RosterRefreshRequest"
              }
            }
          },
          "description": "Refresh scope",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterRefreshResponseV2"
                }
              }
            },
            "description": "OK"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Too Many Requests"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Refresh roster snapshot data",
        "tags": [
          "Roster Builder"
        ]
      }
    },
    "/v2/roster/server/{server_id}/members": {
      "get": {
        "description": "Returns all clan members for all clans linked to a server.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerClanMembersResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Get server clan members",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/roster/views": {
      "get": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/modelsv2.RosterView"
                  },
                  "type": "array"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "List saved roster views",
        "tags": [
          "Roster Builder"
        ]
      },
      "post": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RosterViewWrite"
              }
            }
          },
          "description": "Typed saved view",
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterView"
                }
              }
            },
            "description": "Created"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Create a saved roster view",
        "tags": [
          "Roster Builder"
        ]
      }
    },
    "/v2/roster/views/shared/{shareId}": {
      "get": {
        "description": "Resolves the server for a compact saved-view link after enforcing normal dashboard roster authorization.",
        "parameters": [
          {
            "description": "Compact share ID",
            "in": "path",
            "name": "shareId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterView"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Resolve an authenticated saved-view share link",
        "tags": [
          "Roster Builder"
        ]
      }
    },
    "/v2/roster/views/{viewId}": {
      "delete": {
        "parameters": [
          {
            "description": "View ID",
            "in": "path",
            "name": "viewId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete a saved roster view",
        "tags": [
          "Roster Builder"
        ]
      },
      "get": {
        "parameters": [
          {
            "description": "View ID",
            "in": "path",
            "name": "viewId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterView"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get a saved roster view",
        "tags": [
          "Roster Builder"
        ]
      },
      "patch": {
        "parameters": [
          {
            "description": "View ID",
            "in": "path",
            "name": "viewId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RosterViewUpdate"
              }
            }
          },
          "description": "Typed view",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterView"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update a saved roster view",
        "tags": [
          "Roster Builder"
        ]
      }
    },
    "/v2/roster/{roster_id}": {
      "delete": {
        "description": "Permanently deletes a roster.",
        "parameters": [
          {
            "description": "Roster ID",
            "in": "path",
            "name": "roster_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MessageResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete roster",
        "tags": [
          "Rosters"
        ]
      },
      "get": {
        "description": "Returns a specific roster by ID.",
        "parameters": [
          {
            "description": "Roster ID",
            "in": "path",
            "name": "roster_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "summary": "Get roster",
        "tags": [
          "Rosters"
        ]
      },
      "patch": {
        "description": "Updates roster settings.",
        "parameters": [
          {
            "description": "Roster ID",
            "in": "path",
            "name": "roster_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.UpdateRosterRequest"
              }
            }
          },
          "description": "Roster fields",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update roster",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/roster/{roster_id}/clone": {
      "post": {
        "description": "Creates a copy of an existing roster.",
        "parameters": [
          {
            "description": "Source roster ID",
            "in": "path",
            "name": "roster_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Target Discord server ID",
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RosterCloneRequest"
              }
            }
          },
          "description": "Clone options",
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterCloneResponse"
                }
              }
            },
            "description": "Created"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Clone roster",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/roster/{roster_id}/members": {
      "post": {
        "description": "Adds or updates members in a roster.",
        "parameters": [
          {
            "description": "Roster ID",
            "in": "path",
            "name": "roster_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RosterMembersRequest"
              }
            }
          },
          "description": "Roster member operation",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MessageResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Manage roster members",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/roster/{roster_id}/members/{member_tag}": {
      "patch": {
        "description": "Updates a single member's data in a roster.",
        "parameters": [
          {
            "description": "Roster ID",
            "in": "path",
            "name": "roster_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Player tag",
            "in": "path",
            "name": "member_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RosterMemberUpdateRequest"
              }
            }
          },
          "description": "Roster member fields",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MessageResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update roster member",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/roster/{roster_id}/members/{member_tag}/refresh": {
      "post": {
        "description": "Refreshes a single member's data from the CoC API.",
        "parameters": [
          {
            "description": "Roster ID",
            "in": "path",
            "name": "roster_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Player tag",
            "in": "path",
            "name": "member_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterMemberResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Refresh roster member",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/roster/{roster_id}/members/{player_tag}": {
      "delete": {
        "description": "Removes a player from a roster.",
        "parameters": [
          {
            "description": "Roster ID",
            "in": "path",
            "name": "roster_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Player tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MessageResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Remove roster member",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/roster/{server_id}/list": {
      "get": {
        "description": "Returns all rosters for a Discord server.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Filter by group",
            "in": "query",
            "name": "group_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by clan",
            "in": "query",
            "name": "clan_tag",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterListResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "List rosters",
        "tags": [
          "Rosters"
        ]
      }
    },
    "/v2/search/clan": {
      "query": {
        "description": "Searches the clan Elasticsearch alias by name or exact tag with optional filters and cursor pagination.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.SearchClanQuery"
              }
            }
          },
          "description": "Clan search query",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.SearchClanResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "415": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unsupported Media Type"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Search clans",
        "tags": [
          "Search"
        ]
      }
    },
    "/v2/search/player": {
      "query": {
        "description": "Searches the player Elasticsearch alias by name or exact tag with optional filters and cursor pagination.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.SearchPlayerQuery"
              }
            }
          },
          "description": "Player search query",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.SearchPlayerResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "415": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unsupported Media Type"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Search players",
        "tags": [
          "Search"
        ]
      }
    },
    "/v2/search/{guild_id}/banned-players": {
      "get": {
        "description": "Returns banned players matching the query in the given guild.",
        "parameters": [
          {
            "description": "Discord guild ID",
            "in": "path",
            "name": "guild_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Player name search query",
            "in": "query",
            "name": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.SearchPlayerReferenceResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Search for banned players in a guild",
        "tags": [
          "Search"
        ]
      }
    },
    "/v2/server/{server_id}/autoboards": {
      "get": {
        "description": "Returns typed autoboards and resolves each stored webhook back to its Discord parent channel.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerAutoBoardsResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get server autoboards",
        "tags": [
          "Server Autoboards"
        ]
      },
      "post": {
        "description": "Creates a typed autoboard after validating its registry capability, target scope, delivery schedule, and Discord destination.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.CreateAutoBoardRequest"
              }
            }
          },
          "description": "Autoboard",
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AutoBoardItemResponse"
                }
              }
            },
            "description": "Created"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Create an autoboard",
        "tags": [
          "Server Autoboards"
        ]
      }
    },
    "/v2/server/{server_id}/autoboards/capabilities": {
      "get": {
        "description": "Returns the code-owned board-type registry used by Dashboard. No board type is inferred from stored rows.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AutoBoardCapabilitiesResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get autoboard capabilities",
        "tags": [
          "Server Autoboards"
        ]
      }
    },
    "/v2/server/{server_id}/autoboards/{autoboard_id}": {
      "delete": {
        "description": "Deletes a server-scoped autoboard and its normalized targets.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Autoboard ID",
            "in": "path",
            "name": "autoboard_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AutoBoardDeleteResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete an autoboard",
        "tags": [
          "Server Autoboards"
        ]
      },
      "put": {
        "description": "Fully replaces an autoboard. This endpoint is not a partial patch.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Autoboard ID",
            "in": "path",
            "name": "autoboard_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.ReplaceAutoBoardRequest"
              }
            }
          },
          "description": "Complete replacement",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AutoBoardItemResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Replace an autoboard",
        "tags": [
          "Server Autoboards"
        ]
      }
    },
    "/v2/server/{server_id}/bans": {
      "get": {
        "description": "Returns all banned players for a server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BanListResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get server bans",
        "tags": [
          "Server Bans"
        ]
      }
    },
    "/v2/server/{server_id}/bans/{player_tag}": {
      "delete": {
        "description": "Removes a player ban from the server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Player Tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BanMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Remove a ban",
        "tags": [
          "Server Bans"
        ]
      },
      "post": {
        "description": "Bans a player on the server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Player Tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.BanRequest"
              }
            }
          },
          "description": "Ban details",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BanMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Add or update a ban",
        "tags": [
          "Server Bans"
        ]
      }
    },
    "/v2/server/{server_id}/bases": {
      "get": {
        "description": "Lists only bases with explicit ownership for the authorized server. Downloader IDs are returned without eager Discord profile resolution.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Maximum results (default 50, maximum 100)",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Pagination offset",
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BasesResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "List a server's bases",
        "tags": [
          "Bases"
        ]
      },
      "post": {
        "description": "Creates a Discord message in the selected server channel, then persists an immutable base using the returned message ID. If persistence fails, the API attempts to remove the new Discord message and reports the compensation result.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.CreateBaseRequest"
              }
            }
          },
          "description": "Base",
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.Base"
                }
              }
            },
            "description": "Created"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BaseCreateErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BaseCreateErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BaseCreateErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BaseCreateErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Create an immutable server base",
        "tags": [
          "Bases"
        ]
      }
    },
    "/v2/server/{server_id}/bases/images": {
      "post": {
        "description": "Uploads one base image through the current Bunny CDN storage path for later use in immutable base creation.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "properties": {
                  "file": {
                    "description": "Image (max 25 MB)",
                    "format": "binary",
                    "type": "string"
                  }
                },
                "required": [
                  "file"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.CDNUploadResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Request Entity Too Large"
          },
          "415": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unsupported Media Type"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Upload a base image",
        "tags": [
          "Bases"
        ]
      }
    },
    "/v2/server/{server_id}/bases/{base_id}": {
      "delete": {
        "description": "Deletes the associated Discord message first, then deletes the server-owned database row. A missing Discord message is treated as already cleaned up; other Discord failures retain the database row for retry.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Base ID",
            "in": "path",
            "name": "base_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BaseDeleteResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BaseDeleteErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BaseDeleteErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BaseDeleteErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BaseDeleteErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete an immutable server base",
        "tags": [
          "Bases"
        ]
      },
      "get": {
        "description": "Returns one base only when it belongs to the authorized server and has explicit server/channel ownership.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Base ID",
            "in": "path",
            "name": "base_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.Base"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get a server base",
        "tags": [
          "Bases"
        ]
      }
    },
    "/v2/server/{server_id}/bases/{base_id}/downloaders/{user_id}": {
      "get": {
        "description": "Resolves a safe current Discord display name and avatar only after proving the user appears in this server-owned base's downloader history.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Base ID",
            "in": "path",
            "name": "base_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Discord user ID",
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BaseDownloaderProfile"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Resolve one base downloader",
        "tags": [
          "Bases"
        ]
      }
    },
    "/v2/server/{server_id}/bot-profile": {
      "get": {
        "description": "Returns the bot name, avatar, banner, and bio configured for this Discord server.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BotGuildProfile"
                }
              }
            },
            "description": "OK"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get bot server profile",
        "tags": [
          "Bot Profile"
        ]
      },
      "patch": {
        "description": "Updates the bot name, avatar, banner, and bio for this Discord server. Images must be data URIs.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.BotGuildProfileUpdate"
              }
            }
          },
          "description": "Profile fields",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.BotGuildProfile"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update bot server profile",
        "tags": [
          "Bot Profile"
        ]
      }
    },
    "/v2/server/{server_id}/channels": {
      "get": {
        "description": "Returns category, text, announcement, and forum channels for the Discord server, sorted by category.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/modelsv2.DiscordChannel"
                  },
                  "type": "array"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get Discord channels",
        "tags": [
          "Server Discord"
        ]
      }
    },
    "/v2/server/{server_id}/clan-categories": {
      "get": {
        "description": "Lists the authorized server's clan categories with current assigned-clan counts.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ClanCategoriesResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "List clan categories",
        "tags": [
          "Clan Categories"
        ]
      },
      "post": {
        "description": "Creates one normalized, exact-name-unique category for the authorized server.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.CreateClanCategoryRequest"
              }
            }
          },
          "description": "Category name",
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ClanCategoryCreateResponse"
                }
              }
            },
            "description": "Created"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Create a clan category",
        "tags": [
          "Clan Categories"
        ]
      }
    },
    "/v2/server/{server_id}/clan-categories/order": {
      "put": {
        "description": "Replaces the authorized server's complete clan-category order.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.ReorderClanCategoriesRequest"
              }
            }
          },
          "description": "Complete ordered category ID list",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ClanCategoriesResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Reorder clan categories",
        "tags": [
          "Clan Categories"
        ]
      }
    },
    "/v2/server/{server_id}/clan-categories/{category_id}": {
      "delete": {
        "description": "Deletes one server-owned category. The database foreign key atomically clears categoryId on affected server clans.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Category UUID",
            "in": "path",
            "name": "category_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ClanCategoryDeleteResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete a clan category",
        "tags": [
          "Clan Categories"
        ]
      },
      "patch": {
        "description": "Renames one category only when it belongs to the authorized server.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Category UUID",
            "in": "path",
            "name": "category_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RenameClanCategoryRequest"
              }
            }
          },
          "description": "Replacement category name",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ClanCategoryRenameResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Rename a clan category",
        "tags": [
          "Clan Categories"
        ]
      }
    },
    "/v2/server/{server_id}/clan-categories/{category_id}/delete-preview": {
      "get": {
        "description": "Returns the current number of this server's clans that will become uncategorized if the manager confirms deletion.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Category UUID",
            "in": "path",
            "name": "category_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ClanCategoryDeletePreviewResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Preview clan category deletion",
        "tags": [
          "Clan Categories"
        ]
      }
    },
    "/v2/server/{server_id}/clan/{clan_tag}": {
      "delete": {
        "description": "Removes a clan from the Discord server tracking list.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Clan Tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RemoveClanResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Remove a clan from the server",
        "tags": [
          "Server Clans"
        ]
      }
    },
    "/v2/server/{server_id}/clan/{clan_tag}/countdowns": {
      "get": {
        "description": "Returns all clan countdown types and their channel state.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Clan Tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ClanCountdownsResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get clan countdowns",
        "tags": [
          "Server Countdowns"
        ]
      }
    },
    "/v2/server/{server_id}/clan/{clan_tag}/settings": {
      "get": {
        "description": "Returns detailed settings for a specific clan on a server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Clan Tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.ClanSettingsUpdate"
              }
            }
          },
          "description": "Retained clan settings",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ClanSettingsDetail"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get clan settings",
        "tags": [
          "Server Clans"
        ]
      },
      "patch": {
        "description": "Partially updates the settings for a specific clan on a server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Clan Tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ClanSettingsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update clan settings",
        "tags": [
          "Server Clans"
        ]
      }
    },
    "/v2/server/{server_id}/clans": {
      "get": {
        "description": "Returns the full clan list for a server from Timescale basic_clan data.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/modelsv2.ClanListItem"
                  },
                  "type": "array"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "List server clans (full)",
        "tags": [
          "Server Clans"
        ]
      },
      "post": {
        "description": "Adds a CoC clan to the Discord server tracking list.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AddClanResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Add a clan to the server",
        "tags": [
          "Server Clans"
        ]
      }
    },
    "/v2/server/{server_id}/clans-basic": {
      "get": {
        "description": "Returns a basic list of clans (tag+name) for a server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/modelsv2.ClanReference"
                  },
                  "type": "array"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "List server clans (basic)",
        "tags": [
          "Server Clans"
        ]
      }
    },
    "/v2/server/{server_id}/clans/{clan_tag}": {
      "delete": {
        "description": "Removes a clan from the Discord server tracking list.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Clan Tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RemoveClanResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Remove a clan from the server",
        "tags": [
          "Server Clans"
        ]
      }
    },
    "/v2/server/{server_id}/countdowns": {
      "delete": {
        "description": "Deletes the Discord channel and its countdown rule.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.DisableCountdownRequest"
              }
            }
          },
          "description": "Countdown",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.DisableCountdownResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Disable a countdown",
        "tags": [
          "Server Countdowns"
        ]
      },
      "get": {
        "description": "Returns all server countdown types and their channel state.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerCountdownsResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get server countdowns",
        "tags": [
          "Server Countdowns"
        ]
      },
      "post": {
        "description": "Creates a Discord channel and stores one countdown rule.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.EnableCountdownRequest"
              }
            }
          },
          "description": "Countdown",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.EnableCountdownResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Enable a countdown",
        "tags": [
          "Server Countdowns"
        ]
      }
    },
    "/v2/server/{server_id}/cwl/{clan_tag}/bonus-recipients": {
      "get": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "CWL season (YYYY-MM or YYYY-MM-DD)",
            "in": "query",
            "name": "season",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.CWLBonusRecipientsResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get stored CWL bonus recipients",
        "tags": [
          "CWL"
        ]
      },
      "put": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "CWL season (YYYY-MM or YYYY-MM-DD)",
            "in": "query",
            "name": "season",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.ReplaceCWLBonusRecipientsRequest"
              }
            }
          },
          "description": "Recipients",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.CWLBonusRecipientsResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Replace stored CWL bonus recipients",
        "tags": [
          "CWL"
        ]
      }
    },
    "/v2/server/{server_id}/dashboard-access": {
      "get": {
        "description": "Returns assignable Discord roles and role grants. Requires Manage Guild permission.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.DashboardAccessConfig"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get dashboard role access",
        "tags": [
          "Dashboard Access"
        ]
      },
      "put": {
        "description": "Replaces all dashboard role grants. Managed roles and @everyone are rejected. Requires Manage Guild permission.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.DashboardAccessUpdate"
              }
            }
          },
          "description": "Role grants",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.DashboardAccessConfig"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Replace dashboard role access",
        "tags": [
          "Dashboard Access"
        ]
      }
    },
    "/v2/server/{server_id}/dashboard-capabilities": {
      "get": {
        "description": "Returns the current user's effective view/manage access by dashboard section.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.DashboardCapabilities"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get effective dashboard capabilities",
        "tags": [
          "Dashboard Access"
        ]
      }
    },
    "/v2/server/{server_id}/discord-channels": {
      "get": {
        "description": "Returns category, text, announcement, and forum channels for the Discord server, sorted by category.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/modelsv2.DiscordChannel"
                  },
                  "type": "array"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get Discord channels",
        "tags": [
          "Server Discord"
        ]
      }
    },
    "/v2/server/{server_id}/discord-roles": {
      "get": {
        "description": "Returns assignable roles for the Discord server sorted by position. Excludes @everyone and Discord-managed roles, including bot roles.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.DiscordRolesResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get Discord roles",
        "tags": [
          "Server Discord"
        ]
      }
    },
    "/v2/server/{server_id}/discord-test": {
      "get": {
        "description": "Tests whether the bot has access to the Discord server via the API.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.DiscordStatusResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Test Discord API access",
        "tags": [
          "Server Discord"
        ]
      }
    },
    "/v2/server/{server_id}/embed-color/{hex_code}": {
      "put": {
        "description": "Sets the embed color (decimal integer) for a Discord server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Embed color as decimal integer",
            "in": "path",
            "name": "hex_code",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.EmbedColorResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Set embed color",
        "tags": [
          "Server Settings"
        ]
      }
    },
    "/v2/server/{server_id}/embeds": {
      "get": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerEmbedsResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get server embeds",
        "tags": [
          "Server Tickets"
        ]
      },
      "post": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.UpsertEmbedRequest"
              }
            }
          },
          "description": "Embed name and data",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MessageResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Create a server embed",
        "tags": [
          "Server Tickets"
        ]
      }
    },
    "/v2/server/{server_id}/embeds/{embed_name}": {
      "delete": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Embed name",
            "in": "path",
            "name": "embed_name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MessageResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete a server embed",
        "tags": [
          "Server Tickets"
        ]
      },
      "put": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Embed name",
            "in": "path",
            "name": "embed_name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MessageResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update a server embed",
        "tags": [
          "Server Tickets"
        ]
      }
    },
    "/v2/server/{server_id}/giveaways": {
      "get": {
        "description": "Returns all giveaways for a server split by status (ongoing, scheduled, ended).",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerGiveawaysResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get server giveaways",
        "tags": [
          "Server Giveaways"
        ]
      },
      "post": {
        "description": "Creates a new giveaway. Accepts multipart/form-data with optional image upload.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "properties": {
                  "channel_id": {
                    "description": "Discord channel ID",
                    "type": "string"
                  },
                  "end_time": {
                    "description": "End time (ISO 8601)",
                    "type": "string"
                  },
                  "image": {
                    "description": "Giveaway banner image",
                    "format": "binary",
                    "type": "string"
                  },
                  "now": {
                    "description": "Start immediately (true/false)",
                    "type": "string"
                  },
                  "prize": {
                    "description": "Prize description",
                    "type": "string"
                  },
                  "start_time": {
                    "description": "Start time (ISO 8601)",
                    "type": "string"
                  },
                  "winners": {
                    "description": "Number of winners",
                    "type": "integer"
                  }
                },
                "required": [
                  "channel_id",
                  "end_time",
                  "prize",
                  "winners"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.GiveawayMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Create a server giveaway",
        "tags": [
          "Server Giveaways"
        ]
      }
    },
    "/v2/server/{server_id}/giveaways/{giveaway_id}": {
      "delete": {
        "description": "Deletes a giveaway and its image from the CDN if applicable.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Giveaway ID",
            "in": "path",
            "name": "giveaway_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.GiveawayMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete a server giveaway",
        "tags": [
          "Server Giveaways"
        ]
      },
      "get": {
        "description": "Returns a single giveaway by ID for a server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Giveaway ID",
            "in": "path",
            "name": "giveaway_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.GiveawayConfig"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get a specific server giveaway",
        "tags": [
          "Server Giveaways"
        ]
      },
      "put": {
        "description": "Updates an existing giveaway. Accepts multipart/form-data with optional image upload.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Giveaway ID",
            "in": "path",
            "name": "giveaway_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.GiveawayMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update a server giveaway",
        "tags": [
          "Server Giveaways"
        ]
      }
    },
    "/v2/server/{server_id}/giveaways/{giveaway_id}/entries": {
      "get": {
        "description": "Returns the list of users who entered a giveaway, with their entry count and win chance percentage.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Giveaway ID",
            "in": "path",
            "name": "giveaway_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.GiveawayEntriesResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get giveaway entrants",
        "tags": [
          "Server Giveaways"
        ]
      }
    },
    "/v2/server/{server_id}/giveaways/{giveaway_id}/reroll": {
      "post": {
        "description": "Replaces selected winners of an ended giveaway with new ones drawn at random.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Giveaway ID",
            "in": "path",
            "name": "giveaway_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.GiveawayRerollRequest"
              }
            }
          },
          "description": "Users to replace",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.GiveawayRerollResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Reroll giveaway winners",
        "tags": [
          "Server Giveaways"
        ]
      }
    },
    "/v2/server/{server_id}/leaderboards": {
      "get": {
        "description": "Returns player and clan ranking leaderboards for a server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Maximum number of players",
            "in": "query",
            "name": "limit_players",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Maximum number of clans",
            "in": "query",
            "name": "limit_clans",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Player sort key",
            "in": "query",
            "name": "sort_by",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerLeaderboardsResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get server leaderboards",
        "tags": [
          "Server Leaderboards"
        ]
      }
    },
    "/v2/server/{server_id}/leaderboards/clan-games": {
      "get": {
        "description": "Returns players ranked by season clan games points for a server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Season YYYY-MM",
            "in": "query",
            "name": "season",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Maximum number of rows",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerClanGamesLeaderboardResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get server clan games leaderboard",
        "tags": [
          "Server Leaderboards"
        ]
      }
    },
    "/v2/server/{server_id}/leaderboards/donations": {
      "get": {
        "description": "Returns players ranked by season donations for a server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Season YYYY-MM",
            "in": "query",
            "name": "season",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Maximum number of rows",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerDonationsLeaderboardResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get server donations leaderboard",
        "tags": [
          "Server Leaderboards"
        ]
      }
    },
    "/v2/server/{server_id}/leaderboards/legends": {
      "get": {
        "description": "Returns tracked legend players ranked by trophies for a server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Maximum number of rows",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerLegendsLeaderboardResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get server legends leaderboard",
        "tags": [
          "Server Leaderboards"
        ]
      }
    },
    "/v2/server/{server_id}/leaderboards/war-performance": {
      "get": {
        "description": "Returns players ranked by war attack performance for a server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Maximum number of rows",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerWarLeaderboardResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get server war performance leaderboard",
        "tags": [
          "Server Leaderboards"
        ]
      }
    },
    "/v2/server/{server_id}/logs": {
      "delete": {
        "description": "Removes independent log configurations from one server or clan scope. A webhook is deleted only when no remaining log uses it.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Clan tag",
            "in": "query",
            "name": "clan_tag",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Comma-separated log types",
            "in": "query",
            "name": "log_types",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerLogsOperationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete server logs",
        "tags": [
          "Server Logs"
        ]
      },
      "get": {
        "description": "Returns each log configuration as an independent server, clan, and type row. Channel IDs are resolved from Discord and are not stored.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerLogsResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get server logs",
        "tags": [
          "Server Logs"
        ]
      },
      "patch": {
        "description": "Changes the disabled state without deleting the saved webhook or thread setup.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.UpdateServerLogsDisabledRequest"
              }
            }
          },
          "description": "Disabled state",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerLogsOperationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Enable or disable server logs",
        "tags": [
          "Server Logs"
        ]
      },
      "put": {
        "description": "Assigns a Discord destination to independent log types in one optional clan scope. Text and announcement channels may be used directly or with a child thread. Forum channels require a child post. The API reuses a bot-owned webhook in the parent channel or creates one with the bot profile.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.UpdateServerLogsRequest"
              }
            }
          },
          "description": "Log settings",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerLogsOperationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Set server logs",
        "tags": [
          "Server Logs"
        ]
      }
    },
    "/v2/server/{server_id}/panel": {
      "get": {
        "description": "Returns the welcome panel configuration for a server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerPanelResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get server welcome panel",
        "tags": [
          "Server Panels"
        ]
      },
      "put": {
        "description": "Updates the welcome panel configuration for a server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.ServerPanelBody"
              }
            }
          },
          "description": "Panel configuration",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerPanelResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update server welcome panel",
        "tags": [
          "Server Panels"
        ]
      }
    },
    "/v2/server/{server_id}/reactivate": {
      "post": {
        "description": "Treats an authenticated Dashboard reactivation as server activity and restarts the 90-day tracking clock.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.NotificationMessageResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Re-enable server tracking",
        "tags": [
          "Other"
        ]
      }
    },
    "/v2/server/{server_id}/reminders": {
      "get": {
        "description": "Returns all reminders for a server grouped by type.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerRemindersResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get server reminders",
        "tags": [
          "Server Reminders"
        ]
      },
      "post": {
        "description": "Creates a new reminder (war, capital, clan games, inactivity, or roster). Text and announcement channels may be used directly or with a child thread. Forum channels require a child post.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.CreateReminderRequest"
              }
            }
          },
          "description": "Reminder settings",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ReminderOperationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Create a reminder",
        "tags": [
          "Server Reminders"
        ]
      }
    },
    "/v2/server/{server_id}/reminders/{reminder_id}": {
      "delete": {
        "description": "Deletes a reminder by ID.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Reminder ID",
            "in": "path",
            "name": "reminder_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ReminderOperationResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete a reminder",
        "tags": [
          "Server Reminders"
        ]
      },
      "put": {
        "description": "Updates an existing reminder by ID. Updating a destination accepts a parent channel plus an optional child thread; forum parents require a child post.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Reminder ID",
            "in": "path",
            "name": "reminder_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.UpdateReminderRequest"
              }
            }
          },
          "description": "Reminder settings",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ReminderOperationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update a reminder",
        "tags": [
          "Server Reminders"
        ]
      }
    },
    "/v2/server/{server_id}/role-settings": {
      "get": {
        "description": "Returns retained role automation settings for one server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RoleSettingsResponse"
                }
              }
            },
            "description": "OK"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get role automation settings",
        "tags": [
          "Server Roles"
        ]
      },
      "patch": {
        "description": "Updates retained role automation settings for one server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RoleSettingsUpdate"
              }
            }
          },
          "description": "Role automation settings",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update role automation settings",
        "tags": [
          "Server Roles"
        ]
      }
    },
    "/v2/server/{server_id}/rosters": {
      "get": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "List roster-builder rosters",
        "tags": [
          "Roster Builder"
        ]
      }
    },
    "/v2/server/{server_id}/rosters/{roster_id}": {
      "get": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Roster ID",
            "in": "path",
            "name": "roster_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get a roster-builder roster",
        "tags": [
          "Roster Builder"
        ]
      }
    },
    "/v2/server/{server_id}/rosters/{roster_id}/missing-members": {
      "get": {
        "description": "Returns roster output data; the bot resolves guild membership and sends reminders.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Roster ID",
            "in": "path",
            "name": "roster_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "List clan members missing from a roster",
        "tags": [
          "Roster Builder"
        ]
      }
    },
    "/v2/server/{server_id}/rosters/{roster_id}/refresh": {
      "post": {
        "description": "Data refreshes are synchronous and reuse a snapshot inside the configured cooldown. Role refresh returns the configured role and cache-ready Discord user IDs.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Roster ID",
            "in": "path",
            "name": "roster_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RosterRefreshRequest"
              }
            }
          },
          "description": "Refresh scope",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterRefreshResponseV2"
                }
              }
            },
            "description": "OK"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Conflict"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Refresh roster data or prepare role reconciliation",
        "tags": [
          "Roster Builder"
        ]
      }
    },
    "/v2/server/{server_id}/rosters/{roster_id}/signup-form": {
      "get": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Roster ID",
            "in": "path",
            "name": "roster_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.RosterQuestionnaire"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get a roster signup form",
        "tags": [
          "Roster Builder"
        ]
      }
    },
    "/v2/server/{server_id}/rosters/{roster_id}/submissions": {
      "post": {
        "description": "The account selector is represented by playerTag and must belong to the authenticated user.",
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Roster ID",
            "in": "path",
            "name": "roster_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.RosterSignupSubmissionRequest"
              }
            }
          },
          "description": "Signup",
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "$ref": "#/components/schemas/modelsv2.RosterSignupSubmission"
                  },
                  "type": "object"
                }
              }
            },
            "description": "Created"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Submit a roster signup",
        "tags": [
          "Roster Builder"
        ]
      }
    },
    "/v2/server/{server_id}/server-roles": {
      "get": {
        "description": "Returns configured roles for a server. Use type and clan_tag to filter the list.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Role type",
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Clan tag",
            "in": "query",
            "name": "clan_tag",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerRolesResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "List server roles",
        "tags": [
          "Server Roles"
        ]
      },
      "post": {
        "description": "Creates one server-level or clan-level role configuration.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerRoleResponse"
                }
              }
            },
            "description": "Created"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Create a server role",
        "tags": [
          "Server Roles"
        ]
      }
    },
    "/v2/server/{server_id}/server-roles/{role_id}": {
      "delete": {
        "description": "Deletes one server role configuration.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Server role ID",
            "in": "path",
            "name": "role_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerRoleResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete a server role",
        "tags": [
          "Server Roles"
        ]
      },
      "patch": {
        "description": "Updates one server role configuration.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Server role ID",
            "in": "path",
            "name": "role_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerRoleResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update a server role",
        "tags": [
          "Server Roles"
        ]
      }
    },
    "/v2/server/{server_id}/settings": {
      "get": {
        "description": "Returns the full settings document for a Discord server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Include clan settings",
            "in": "query",
            "name": "clan_settings",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.ServerSettingsUpdate"
              }
            }
          },
          "description": "Server settings",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerSettingsDocument"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get server settings",
        "tags": [
          "Server Settings"
        ]
      },
      "patch": {
        "description": "Partially updates server-level settings (nickname rules, eval config, etc.).",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ServerSettingsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update server settings",
        "tags": [
          "Server Settings"
        ]
      }
    },
    "/v2/server/{server_id}/strikes": {
      "get": {
        "description": "Returns all strikes for a server, optionally filtered by player tag or including expired.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Filter by player tag",
            "in": "query",
            "name": "player_tag",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Include expired strikes (default false)",
            "in": "query",
            "name": "view_expired",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.StrikeListResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get server strikes",
        "tags": [
          "Server Strikes"
        ]
      }
    },
    "/v2/server/{server_id}/strikes/player/{player_tag}/summary": {
      "get": {
        "description": "Returns all strikes and total weight for a player on the server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Player Tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.StrikeSummaryResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get player strike summary",
        "tags": [
          "Server Strikes"
        ]
      }
    },
    "/v2/server/{server_id}/strikes/{player_tag}": {
      "post": {
        "description": "Adds a strike to a player on the server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Player Tag",
            "in": "path",
            "name": "player_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.StrikeRequest"
              }
            }
          },
          "description": "Strike details",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.StrikeMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Add a strike",
        "tags": [
          "Server Strikes"
        ]
      }
    },
    "/v2/server/{server_id}/strikes/{strike_id}": {
      "delete": {
        "description": "Deletes a strike by its ID.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Strike ID",
            "in": "path",
            "name": "strike_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.StrikeMutationResponse"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete a strike",
        "tags": [
          "Server Strikes"
        ]
      }
    },
    "/v2/server/{server_id}/threads": {
      "get": {
        "description": "Returns all active threads for the Discord server.",
        "parameters": [
          {
            "description": "Server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/modelsv2.DiscordThread"
                  },
                  "type": "array"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Gateway"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get Discord threads",
        "tags": [
          "Server Discord"
        ]
      }
    },
    "/v2/server/{server_id}/tickets": {
      "get": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.TicketPanelsResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Get ticket panels for a server",
        "tags": [
          "Server Tickets"
        ]
      },
      "post": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.CreatePanelRequest"
              }
            }
          },
          "description": "Panel name",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MessageResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Create a ticket panel",
        "tags": [
          "Server Tickets"
        ]
      }
    },
    "/v2/server/{server_id}/tickets/{panel_name}": {
      "delete": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Panel name",
            "in": "path",
            "name": "panel_name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MessageResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete a ticket panel",
        "tags": [
          "Server Tickets"
        ]
      },
      "put": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Panel name",
            "in": "path",
            "name": "panel_name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MessageResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update ticket panel settings",
        "tags": [
          "Server Tickets"
        ]
      }
    },
    "/v2/server/{server_id}/tickets/{panel_name}/approve-messages": {
      "put": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Panel name",
            "in": "path",
            "name": "panel_name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MessageResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update approve messages for a ticket panel",
        "tags": [
          "Server Tickets"
        ]
      }
    },
    "/v2/server/{server_id}/tickets/{panel_name}/buttons": {
      "post": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Panel name",
            "in": "path",
            "name": "panel_name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MessageResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Add a button to a ticket panel",
        "tags": [
          "Server Tickets"
        ]
      }
    },
    "/v2/server/{server_id}/tickets/{panel_name}/buttons/{custom_id}": {
      "delete": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Panel name",
            "in": "path",
            "name": "panel_name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Button custom ID",
            "in": "path",
            "name": "custom_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MessageResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Delete a button from a ticket panel",
        "tags": [
          "Server Tickets"
        ]
      },
      "patch": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Panel name",
            "in": "path",
            "name": "panel_name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Button custom ID",
            "in": "path",
            "name": "custom_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MessageResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update ticket button appearance",
        "tags": [
          "Server Tickets"
        ]
      },
      "put": {
        "parameters": [
          {
            "description": "Discord server ID",
            "in": "path",
            "name": "server_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Panel name",
            "in": "path",
            "name": "panel_name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Button custom ID",
            "in": "path",
            "name": "custom_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.MessageResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "summary": "Update ticket button settings",
        "tags": [
          "Server Tickets"
        ]
      }
    },
    "/v2/static/{category}/names": {
      "get": {
        "description": "Returns the names of static items for a category, with optional filters applied.",
        "parameters": [
          {
            "description": "Category name",
            "in": "path",
            "name": "category",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Locale code",
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Substring to filter item names",
            "in": "query",
            "name": "name",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Village filter",
            "in": "query",
            "name": "village",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Type filter",
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Category filter",
            "in": "query",
            "name": "category",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "summary": "Get category names"
      }
    },
    "/v2/static/{category}/{item_id_or_name}/max-level": {
      "get": {
        "description": "Returns the highest level defined for a static item.",
        "parameters": [
          {
            "description": "Category name",
            "in": "path",
            "name": "category",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Item ID or name",
            "in": "path",
            "name": "item_id_or_name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "summary": "Get item max level"
      }
    },
    "/v2/stats/armies": {
      "query": {
        "description": "Uses exact army_share_code + army_items + army_counts identity.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.StatsArmiesQuery"
              }
            }
          },
          "description": "Army filters",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.StatsArmiesResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Query ranked army intelligence",
        "tags": [
          "Stats"
        ]
      }
    },
    "/v2/stats/cwl": {
      "query": {
        "description": "CWL is separate from regular war, defaults to equal-town-hall attacks, and returns season aggregation. League attribution uses the CWL group containing either war clan for the matching YYYY-MM season.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.StatsCWLQuery"
              }
            }
          },
          "description": "CWL filters",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.StatsPerformanceResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Query CWL performance",
        "tags": [
          "Stats"
        ]
      }
    },
    "/v2/stats/items": {
      "query": {
        "description": "Item analysis is available for ranked battlelogs. War/CWL attack rows do not store army items, so those dimensions are intentionally absent.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.StatsItemsQuery"
              }
            }
          },
          "description": "Item filters",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.StatsItemsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Query ranked item intelligence",
        "tags": [
          "Stats"
        ]
      }
    },
    "/v2/stats/overview": {
      "get": {
        "description": "Returns global counts plus ranked, regular-war, and CWL KPIs. A source with no rows has available=false, sample_size=0, zero rates, and an empty daily series.",
        "parameters": [
          {
            "description": "Inclusive start date YYYY-MM-DD",
            "in": "query",
            "name": "start_date",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Inclusive end date YYYY-MM-DD",
            "in": "query",
            "name": "end_date",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.StatsOverviewResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get battle intelligence overview",
        "tags": [
          "Stats"
        ]
      }
    },
    "/v2/stats/ranked": {
      "query": {
        "description": "Requires one town hall and exactly one ranked tier. Each battle date is joined to the same YYYYMM season_id in ranked_league_group_members; basic_player.league_id is never used.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.StatsRankedQuery"
              }
            }
          },
          "description": "Ranked filters",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.StatsPerformanceResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Query ranked performance",
        "tags": [
          "Stats"
        ]
      }
    },
    "/v2/stats/war": {
      "query": {
        "description": "Includes random wars only, excluding friendly and CWL wars. Equal-town-hall attacks are the default.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.StatsWarQuery"
              }
            }
          },
          "description": "War filters",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.StatsPerformanceResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Query regular-war performance",
        "tags": [
          "Stats"
        ]
      }
    },
    "/v2/verify-email-code": {
      "post": {
        "description": "Confirms a pending email registration by checking the verification code and creates the account session.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.AuthEmailCodeRequest"
              }
            }
          },
          "description": "Verification payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.AuthResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Verify email address with 6-digit code",
        "tags": [
          "App Authentication"
        ]
      }
    },
    "/v2/war/clan/stats": {
      "get": {
        "description": "Returns the number of wars for the requested clan tags.",
        "parameters": [
          {
            "description": "Clan tags",
            "explode": false,
            "in": "query",
            "name": "clan_tags",
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "style": "form"
          },
          {
            "description": "Single clan tag",
            "in": "query",
            "name": "clan_tag",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.WarStatsResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Clan war stats",
        "tags": [
          "War"
        ]
      }
    },
    "/v2/war/clans/warhits": {
      "post": {
        "description": "Returns war hit rows for the requested clan tags.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.WarClanTagsBody"
              }
            }
          },
          "description": "Clan tags",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ClanWarHitsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Clan warhits stats",
        "tags": [
          "War"
        ]
      }
    },
    "/v2/war/players/warhits": {
      "post": {
        "description": "Returns war hit rows for the requested player tags.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.WarPlayersBody"
              }
            }
          },
          "description": "Player tags",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.PlayerWarHitsResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Player warhits stats",
        "tags": [
          "War"
        ]
      }
    },
    "/v2/war/stats": {
      "get": {
        "description": "Returns the number of wars for the requested clan tags.",
        "parameters": [
          {
            "description": "Clan tags",
            "explode": false,
            "in": "query",
            "name": "clan_tags",
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "style": "form"
          },
          {
            "description": "Single clan tag",
            "in": "query",
            "name": "clan_tag",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.WarStatsResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Clan war stats",
        "tags": [
          "War"
        ]
      }
    },
    "/v2/war/war-summary": {
      "post": {
        "description": "Returns current war summary data for multiple clan tags.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/modelsv2.WarClanTagsBody"
              }
            }
          },
          "description": "Clan tags",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.WarSummaryListResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get full war summary for multiple clans",
        "tags": [
          "War"
        ]
      }
    },
    "/v2/war/{clan_tag}/previous": {
      "get": {
        "description": "Returns previous wars for a clan tag, optionally filtered to CWL.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Start timestamp",
            "in": "query",
            "name": "timestamp_start",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "End timestamp",
            "in": "query",
            "name": "timestamp_end",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Include CWL wars",
            "in": "query",
            "name": "include_cwl",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "description": "Maximum number of results",
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.WarListResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Previous wars for a clan",
        "tags": [
          "War"
        ]
      }
    },
    "/v2/war/{clan_tag}/war-summary": {
      "get": {
        "description": "Returns current war summary data for a single clan tag.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clan_tag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.WarSummaryResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get war summary for a clan",
        "tags": [
          "War"
        ]
      }
    },
    "/war/{clanTag}/basic": {
      "get": {
        "description": "Returns the current or most recent non-CWL war for a clan.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clanTag",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.WarResponse"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Get current or recent war",
        "tags": [
          "War"
        ]
      }
    },
    "/war/{clanTag}/previous": {
      "get": {
        "description": "Returns the stored previous war near the supplied Clash API end time.",
        "parameters": [
          {
            "description": "Clan tag",
            "in": "path",
            "name": "clanTag",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "War end time in Clash format",
            "in": "query",
            "name": "endTime",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.WarResponse"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Bad Request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/modelsv2.ErrorResponse"
                }
              }
            },
            "description": "Not Found"
          }
        },
        "summary": "Get previous war by end time",
        "tags": [
          "War"
        ]
      }
    }
  },
  "tags": [
    {
      "name": "Counts"
    },
    {
      "name": "Stats"
    },
    {
      "name": "Player"
    },
    {
      "name": "Clan"
    },
    {
      "name": "War"
    },
    {
      "name": "Battlelogs"
    },
    {
      "name": "Leaderboard"
    },
    {
      "name": "Rankings"
    },
    {
      "name": "Global"
    },
    {
      "name": "Search"
    },
    {
      "name": "Links"
    },
    {
      "name": "Tracking"
    },
    {
      "name": "Dates"
    },
    {
      "name": "Lists"
    },
    {
      "name": "Achievements"
    },
    {
      "name": "Activity \u0026 Inactivity"
    },
    {
      "name": "App Authentication"
    },
    {
      "name": "Bases"
    },
    {
      "name": "Bases Bot Integration"
    },
    {
      "name": "Billing"
    },
    {
      "name": "Bot Profile"
    },
    {
      "name": "CWL"
    },
    {
      "name": "Clan Categories"
    },
    {
      "name": "Configuration"
    },
    {
      "name": "Dashboard"
    },
    {
      "name": "Dashboard Access"
    },
    {
      "name": "Enums"
    },
    {
      "name": "Mobile App"
    },
    {
      "name": "Notifications"
    },
    {
      "name": "Public Rosters"
    },
    {
      "name": "Roster Builder"
    },
    {
      "name": "Rosters"
    },
    {
      "name": "Server Autoboards"
    },
    {
      "name": "Server Bans"
    },
    {
      "name": "Server Clans"
    },
    {
      "name": "Server Countdowns"
    },
    {
      "name": "Server Discord"
    },
    {
      "name": "Server Giveaways"
    },
    {
      "name": "Server Leaderboards"
    },
    {
      "name": "Server Logs"
    },
    {
      "name": "Server Panels"
    },
    {
      "name": "Server Reminders"
    },
    {
      "name": "Server Roles"
    },
    {
      "name": "Server Settings"
    },
    {
      "name": "Server Strikes"
    },
    {
      "name": "Server Tickets"
    },
    {
      "name": "Web Authentication"
    },
    {
      "name": "Other"
    }
  ]
}
