components:
    schemas:
        legacy.BadgeURLs:
            properties:
                large:
                    type: string
                medium:
                    type: string
                small:
                    type: string
            type: object
        legacy.CWLClan:
            properties:
                badgeUrls:
                    $ref: '#/components/schemas/legacy.BadgeURLs'
                clanLevel:
                    type: integer
                members:
                    items:
                        $ref: '#/components/schemas/legacy.CWLMember'
                    type: array
                name:
                    type: string
                tag:
                    type: string
            type: object
        legacy.CWLGroup:
            properties:
                clans:
                    items:
                        $ref: '#/components/schemas/legacy.CWLClan'
                    type: array
                rounds:
                    items:
                        $ref: '#/components/schemas/legacy.CWLRound'
                    type: array
                season:
                    type: string
                state:
                    type: string
            type: object
        legacy.CWLGroupEnvelope:
            properties:
                data:
                    $ref: '#/components/schemas/legacy.CWLGroup'
            type: object
        legacy.CWLMember:
            properties:
                name:
                    type: string
                tag:
                    type: string
                townHallLevel:
                    type: integer
            type: object
        legacy.CWLRound:
            properties:
                warTags:
                    items:
                        type: object
                    type: array
            type: object
        legacy.JoinLeaveEvent:
            properties:
                clan:
                    type: string
                clan_name:
                    type: string
                name:
                    type: string
                tag:
                    type: string
                th:
                    type: integer
                time:
                    type: string
                type:
                    type: string
            type: object
        legacy.JoinLeaveResponse:
            properties:
                items:
                    items:
                        $ref: '#/components/schemas/legacy.JoinLeaveEvent'
                    type: array
            type: object
        legacy.PlayerWarHit:
            properties:
                attacks:
                    items:
                        $ref: '#/components/schemas/legacy.WarHitAttack'
                    type: array
                defenses:
                    items:
                        $ref: '#/components/schemas/legacy.WarHitAttack'
                    type: array
                member_data:
                    $ref: '#/components/schemas/legacy.WarMember'
                war_data:
                    $ref: '#/components/schemas/legacy.War'
            type: object
        legacy.PlayerWarHitsResponse:
            properties:
                items:
                    items:
                        $ref: '#/components/schemas/legacy.PlayerWarHit'
                    type: array
            type: object
        legacy.War:
            properties:
                attacksPerMember:
                    type: integer
                battleModifier:
                    type: string
                clan:
                    $ref: '#/components/schemas/legacy.WarClan'
                endTime:
                    type: string
                opponent:
                    $ref: '#/components/schemas/legacy.WarClan'
                preparationStartTime:
                    type: string
                season:
                    type: string
                startTime:
                    type: string
                state:
                    type: string
                tag:
                    type: string
                teamSize:
                    type: integer
                type:
                    type: string
                warStartTime:
                    type: string
            type: object
        legacy.WarAttack:
            properties:
                attackerTag:
                    type: string
                defenderTag:
                    type: string
                destructionPercentage:
                    type: integer
                duration:
                    type: integer
                order:
                    type: integer
                stars:
                    type: integer
            type: object
        legacy.WarClan:
            properties:
                attacks:
                    type: integer
                badgeUrls:
                    $ref: '#/components/schemas/legacy.BadgeURLs'
                clanLevel:
                    type: integer
                destructionPercentage:
                    type: number
                members:
                    items:
                        $ref: '#/components/schemas/legacy.WarMember'
                    type: array
                name:
                    type: string
                stars:
                    type: integer
                tag:
                    type: string
            type: object
        legacy.WarHitAttack:
            properties:
                attack_order:
                    type: integer
                attacker:
                    $ref: '#/components/schemas/legacy.WarMember'
                attackerTag:
                    type: string
                defender:
                    $ref: '#/components/schemas/legacy.WarMember'
                defenderTag:
                    type: string
                destructionPercentage:
                    type: integer
                duration:
                    type: integer
                fresh:
                    type: boolean
                order:
                    type: integer
                stars:
                    type: integer
            type: object
        legacy.WarListResponse:
            properties:
                items:
                    items:
                        $ref: '#/components/schemas/legacy.War'
                    type: array
            type: object
        legacy.WarMember:
            properties:
                attacks:
                    items:
                        $ref: '#/components/schemas/legacy.WarAttack'
                    type: array
                bestOpponentAttack:
                    $ref: '#/components/schemas/legacy.WarAttack'
                mapPosition:
                    type: integer
                name:
                    type: string
                opponentAttacks:
                    type: integer
                tag:
                    type: string
                townhallLevel:
                    type: integer
            type: object
        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.BasicWarClan:
            properties:
                publicWarLog:
                    type:
                        - boolean
                        - "null"
                tag:
                    type: string
            type: object
        modelsv2.BasicWarResponse:
            properties:
                clan:
                    $ref: '#/components/schemas/modelsv2.BasicWarClan'
                endTime:
                    type: string
                opponent:
                    $ref: '#/components/schemas/modelsv2.BasicWarClan'
                preparationStartTime:
                    type: string
                type:
                    type: string
                warTag:
                    type: string
            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.CWLClanHistoryResponse:
            properties:
                clanTag:
                    type: string
                items:
                    items:
                        $ref: '#/components/schemas/modelsv2.CWLHistoryItem'
                    type: array
            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.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.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"
                warLeague:
                    allOf:
                        - $ref: '#/components/schemas/modelsv2.LeagueReference'
                    type:
                        - object
                        - "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'
                missedAttacks:
                    type: integer
                placement:
                    allOf:
                        - $ref: '#/components/schemas/modelsv2.CWLPlayerAttackPlacement'
                    type:
                        - object
                        - "null"
                season:
                    type: string
                teamSize:
                    type:
                        - integer
                        - "null"
                townHallLevel:
                    type: integer
            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.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.ClanCachedMember:
            properties:
                name:
                    type: string
                tag:
                    type: string
                townHallLevel:
                    type: integer
            type: object
        modelsv2.ClanCachedResponse:
            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.SearchLocation'
                memberCount:
                    type: integer
                members:
                    items:
                        $ref: '#/components/schemas/modelsv2.ClanCachedMember'
                    type: array
                name:
                    type: string
                publicWarLog:
                    type: boolean
                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:
                    type: object
                previous:
                    type: object
                time:
                    type: string
                type:
                    type: string
            type: object
        modelsv2.ClanChangesResponse:
            properties:
                items:
                    items:
                        $ref: '#/components/schemas/modelsv2.ClanChangeRecord'
                    type: array
            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.ClanLeaderboardHistoryItem:
            properties:
                builderBasePoints:
                    type: integer
                capitalPoints:
                    type: integer
                clanPoints:
                    type: integer
                date:
                    type: string
                location:
                    $ref: '#/components/schemas/modelsv2.LeaderboardHistoryLocationReference'
                members:
                    type: integer
                rank:
                    type: integer
            type: object
        modelsv2.ClanLeaderboardHistoryResponse:
            properties:
                items:
                    items:
                        $ref: '#/components/schemas/modelsv2.ClanLeaderboardHistoryItem'
                    type: array
            type: object
        modelsv2.ClanLeaderboardHistorySummaryResponse:
            properties:
                seasons:
                    items:
                        $ref: '#/components/schemas/modelsv2.ClanLeaderboardSeasonSummary'
                    type: array
            type: object
        modelsv2.ClanLeaderboardSeasonSummary:
            properties:
                after:
                    type: string
                before:
                    type: string
                bestRank:
                    type: integer
                daysInTop200:
                    type: integer
                peakPoints:
                    type: integer
                season:
                    type: string
            type: object
        modelsv2.ClanLeagueRef:
            properties:
                id:
                    type: integer
                name:
                    type: string
            type: object
        modelsv2.ClanLegendHistoryItem:
            properties:
                attackWins:
                    type: integer
                defenseWins:
                    type: integer
                name:
                    type: string
                rank:
                    type: integer
                season:
                    type: string
                tag:
                    type: string
                trophies:
                    type: integer
            type: object
        modelsv2.ClanLegendHistoryResponse:
            properties:
                items:
                    items:
                        $ref: '#/components/schemas/modelsv2.ClanLegendHistoryItem'
                    type: array
            type: object
        modelsv2.ClanLegendHistorySummaryResponse:
            properties:
                seasons:
                    items:
                        $ref: '#/components/schemas/modelsv2.ClanLegendSeasonSummary'
                    type: array
                topFinishes:
                    items:
                        $ref: '#/components/schemas/modelsv2.ClanLegendTopFinish'
                    type: array
            type: object
        modelsv2.ClanLegendSeasonSummary:
            properties:
                after:
                    type: string
                before:
                    type: string
                playerCount:
                    type: integer
                season:
                    type: string
            type: object
        modelsv2.ClanLegendTopFinish:
            properties:
                attackWins:
                    type: integer
                defenseWins:
                    type: integer
                name:
                    type: string
                rank:
                    type: integer
                season:
                    type: string
                tag:
                    type: string
                trophies:
                    type: integer
            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.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.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:
                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:
                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.PlayerChangeItem:
            properties:
                id:
                    type: integer
                name:
                    type: string
            type: object
        modelsv2.PlayerChangeRecord:
            properties:
                current: {}
                item:
                    $ref: '#/components/schemas/modelsv2.PlayerChangeItem'
                previous: {}
                time:
                    type: string
                townhall_level:
                    type:
                        - integer
                        - "null"
                type:
                    enum:
                        - troop_level
                        - super_troop_boost
                        - hero_level
                        - spell_level
                        - pet_level
                        - equipment_level
                        - townhall_level
                        - best_trophies
                        - best_builder_base_trophies
                        - exp_level
                        - war_preference
                        - name
                    type: string
            type: object
        modelsv2.PlayerChangesResponse:
            properties:
                items:
                    items:
                        $ref: '#/components/schemas/modelsv2.PlayerChangeRecord'
                    type: array
            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:
                globalRank:
                    type: integer
                localRank:
                    type: integer
                trophies:
                    type: integer
            type: object
        modelsv2.PlayerRankingsResponse:
            properties:
                builderBase:
                    $ref: '#/components/schemas/modelsv2.PlayerRankingCategory'
                homeVillage:
                    $ref: '#/components/schemas/modelsv2.PlayerRankingCategory'
                location:
                    $ref: '#/components/schemas/modelsv2.LeaderboardHistoryLocationReference'
                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.PlayerTimer:
            properties:
                clans:
                    items:
                        type: string
                    type: array
                expiresAt:
                    type: string
                type:
                    allOf:
                        - $ref: '#/components/schemas/modelsv2.PlayerTimerType'
                    enum:
                        - war
                        - cwl
                        - capital
                warTag:
                    type: string
            type: object
        modelsv2.PlayerTimerType:
            enum:
                - war
                - cwl
                - capital
            type: string
            x-enum-varnames:
                - PlayerTimerTypeWar
                - PlayerTimerTypeCWL
                - PlayerTimerTypeCapital
        modelsv2.PlayerTimersResponse:
            properties:
                items:
                    items:
                        $ref: '#/components/schemas/modelsv2.PlayerTimer'
                    type: array
            type: object
        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
                war_id:
                    type: string
                warEndTime:
                    type: string
                warSize:
                    type: integer
                warType:
                    type: string
            type: object
        modelsv2.PlayerWarAttacksResponse:
            properties:
                items:
                    items:
                        $ref: '#/components/schemas/modelsv2.PlayerWarAttackItem'
                    type: array
            type: object
        modelsv2.PlayerWarHistoryAttack:
            properties:
                destructionPercentage:
                    type: integer
                duration:
                    type: integer
                fresh:
                    type: boolean
                order:
                    type: integer
                player:
                    $ref: '#/components/schemas/modelsv2.PlayerWarHistoryPlayer'
                stars:
                    type: integer
            type: object
        modelsv2.PlayerWarHistoryClan:
            properties:
                attacks:
                    type: integer
                badgeUrls:
                    $ref: '#/components/schemas/modelsv2.PublicBadgeURLs'
                clanLevel:
                    type: integer
                destructionPercentage:
                    type: number
                name:
                    type: string
                stars:
                    type: integer
                tag:
                    type: string
            type: object
        modelsv2.PlayerWarHistoryItem:
            properties:
                attacks:
                    items:
                        $ref: '#/components/schemas/modelsv2.PlayerWarHistoryAttack'
                    type: array
                attacksPerMember:
                    type: integer
                clan:
                    $ref: '#/components/schemas/modelsv2.PlayerWarHistoryClan'
                defenses:
                    items:
                        $ref: '#/components/schemas/modelsv2.PlayerWarHistoryAttack'
                    type: array
                endTime:
                    type: string
                opponent:
                    $ref: '#/components/schemas/modelsv2.PlayerWarHistoryClan'
                player:
                    $ref: '#/components/schemas/modelsv2.PlayerWarHistoryPlayer'
                preparationStartTime:
                    type: string
                startTime:
                    type: string
                teamSize:
                    type: integer
                type:
                    enum:
                        - cwl
                        - random
                        - friendly
                    type: string
            type: object
        modelsv2.PlayerWarHistoryPlayer:
            properties:
                mapPosition:
                    type: integer
                name:
                    type: string
                tag:
                    type: string
                townhallLevel:
                    type: integer
            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:
                items:
                    items:
                        $ref: '#/components/schemas/modelsv2.PlayerWarHistoryItem'
                    type: array
            type: object
        modelsv2.PublicBadgeURLs:
            properties:
                large:
                    type: string
                medium:
                    type: string
                small:
                    type: string
            type: object
        modelsv2.PublicClanLeaderboardItem:
            properties:
                badge_url:
                    type: string
                badgeUrls:
                    $ref: '#/components/schemas/modelsv2.PublicBadgeURLs'
                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.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:
                hasMore:
                    type: boolean
                limit:
                    type: integer
                nextCursor:
                    type: string
            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.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:
                    additionalProperties: {}
                    type: object
                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: 2.147483647e+09
                    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.TrackingDatabaseMetrics:
            properties:
                average_store_duration_ms:
                    type: number
                batch_count:
                    type: integer
                rows_affected:
                    type: integer
                rows_requested:
                    type: integer
            type: object
        modelsv2.TrackingDomainPoint:
            properties:
                average_processing_duration_ms:
                    type: number
                average_request_latency_ms:
                    type: number
                database:
                    $ref: '#/components/schemas/modelsv2.TrackingDatabaseMetrics'
                error_count:
                    type: integer
                error_rate:
                    type: number
                interval_duration_seconds:
                    type: number
                observed_at:
                    type: string
                processing_count:
                    type: integer
                queue_depth:
                    type: integer
                reported_healthy:
                    type: boolean
                request_count:
                    type: integer
                requests_per_second:
                    type: number
                targets:
                    allOf:
                        - $ref: '#/components/schemas/modelsv2.TrackingTargetProgress'
                    type:
                        - object
                        - "null"
                timestamp:
                    type: string
                write_count:
                    type: integer
                writes_per_second:
                    type: number
            type: object
        modelsv2.TrackingDomainSeries:
            properties:
                domain:
                    type: string
                points:
                    items:
                        $ref: '#/components/schemas/modelsv2.TrackingDomainPoint'
                    type: array
                script:
                    type: string
            type: object
        modelsv2.TrackingDomainState:
            properties:
                average_processing_duration_ms:
                    type: number
                average_request_latency_ms:
                    type: number
                database:
                    $ref: '#/components/schemas/modelsv2.TrackingDatabaseMetrics'
                domain:
                    type: string
                error_count:
                    type: integer
                error_rate:
                    type: number
                health:
                    $ref: '#/components/schemas/modelsv2.TrackingHealth'
                interval_duration_seconds:
                    type: number
                interval_end:
                    type: string
                interval_start:
                    type: string
                last_success:
                    type: string
                latest_error:
                    allOf:
                        - $ref: '#/components/schemas/modelsv2.TrackingLatestError'
                    type:
                        - object
                        - "null"
                processing_count:
                    type: integer
                queue_depth:
                    type: integer
                request_count:
                    type: integer
                requests_per_second:
                    type: number
                run_id:
                    type: integer
                script:
                    type: string
                targets:
                    allOf:
                        - $ref: '#/components/schemas/modelsv2.TrackingTargetProgress'
                    type:
                        - object
                        - "null"
                write_count:
                    type: integer
                writes_per_second:
                    type: number
            type: object
        modelsv2.TrackingHealth:
            properties:
                age_seconds:
                    type: number
                healthy:
                    type: boolean
                observed_at:
                    type: string
                reported_healthy:
                    type: boolean
                stale:
                    type: boolean
                stale_after_seconds:
                    type: integer
            type: object
        modelsv2.TrackingLatestError:
            properties:
                message:
                    type: string
                timestamp:
                    type: string
            type: object
        modelsv2.TrackingOperationsSummaryResponse:
            properties:
                domains:
                    items:
                        $ref: '#/components/schemas/modelsv2.TrackingDomainState'
                    type: array
                generated_at:
                    type: string
                processes:
                    items:
                        $ref: '#/components/schemas/modelsv2.TrackingProcessState'
                    type: array
                stale_after_seconds:
                    type: integer
            type: object
        modelsv2.TrackingOperationsTimeSeriesResponse:
            properties:
                bucket_seconds:
                    type: integer
                domains:
                    items:
                        $ref: '#/components/schemas/modelsv2.TrackingDomainSeries'
                    type: array
                end:
                    type: string
                generated_at:
                    type: string
                max_points_per_series:
                    type: integer
                processes:
                    items:
                        $ref: '#/components/schemas/modelsv2.TrackingProcessSeries'
                    type: array
                start:
                    type: string
                window:
                    type: string
            type: object
        modelsv2.TrackingProcessPoint:
            properties:
                gc_cycles:
                    type: integer
                goroutines:
                    type: number
                heap_objects:
                    type: integer
                observed_at:
                    type: string
                ram_bytes:
                    type: integer
                timestamp:
                    type: string
                uptime_seconds:
                    type: number
            type: object
        modelsv2.TrackingProcessSeries:
            properties:
                points:
                    items:
                        $ref: '#/components/schemas/modelsv2.TrackingProcessPoint'
                    type: array
                script:
                    type: string
            type: object
        modelsv2.TrackingProcessState:
            properties:
                gc_cycles:
                    type: integer
                goroutines:
                    type: integer
                health:
                    $ref: '#/components/schemas/modelsv2.TrackingHealth'
                heap_objects:
                    type: integer
                interval_end:
                    type: string
                interval_start:
                    type: string
                process_started_at:
                    type: string
                ram_bytes:
                    description: Go heap bytes reported by tracking_process_stats.alloc_bytes.
                    type: integer
                run_id:
                    type: integer
                script:
                    type: string
                uptime_seconds:
                    type: number
            type: object
        modelsv2.TrackingTargetProgress:
            properties:
                completion_percentage:
                    type: number
                current_cycle:
                    type: integer
                estimated_loop_completion:
                    type: string
                estimated_seconds_remaining:
                    type: number
                processed_targets:
                    type: integer
                target_count:
                    type: integer
                targets_per_second:
                    type: number
            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:
                    additionalProperties: {}
                    type: object
                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.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.WarListResponse:
            properties:
                items:
                    items:
                        $ref: '#/components/schemas/modelsv2.WarResponse'
                    type: array
            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.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.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:
                    enum:
                        - cwl
                        - random
                        - friendly
                    type: string
            type: object
        routes.clanWarLogResponse:
            properties:
                items:
                    items:
                        $ref: '#/components/schemas/routes.clanWarLogItem'
                    type: array
            type: object
        routes.officialBadgeURLs:
            properties:
                large:
                    type: string
                medium:
                    type: string
                small:
                    type: string
            type: object
    securitySchemes:
        ApiKeyAuth:
            description: Enter `Bearer <access_token>`.
            in: header
            name: Authorization
            type: apiKey
info:
    contact: {}
    description: "### Clash of Clans Based API \U0001F451\n- No Auth Required, Free to Use\n- Please credit if using these stats in your project, Creator Code: ClashKing\n- Ratelimit is largely 30 req/sec, 5 req/sec on post & large requests\n- Largely 300 second cache\n- Not perfect, stats are collected by polling the Official API\n- [ClashKing Discord](https://discord.gg/mCQkUBpUta) | [API Developers](https://discord.gg/clashapi)\n\nThis content is not affiliated with, endorsed, sponsored, or specifically approved by Supercell and Supercell is not responsible for it.\nFor more information see [Supercell's Fan Content Policy](https://supercell.com/fan-content-policy)"
    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
    /clan/{clan_tag}/join-leave:
        get:
            description: Legacy v1-compatible tracked clan membership events.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
                - description: Inclusive Unix timestamp
                  in: query
                  name: timestamp_start
                  schema:
                    default: 0
                    type: integer
                - description: Inclusive Unix timestamp
                  in: query
                  name: time_stamp_end
                  schema:
                    default: 9.999999999e+09
                    type: integer
                - description: Maximum events
                  in: query
                  name: limit
                  schema:
                    default: 250
                    type: integer
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/legacy.JoinLeaveResponse'
                    description: OK
            summary: Clan join and leave history
            tags:
                - Legacy
    /cwl/{clan_tag}/{season}:
        get:
            description: Legacy v1-compatible CWL group with round war tags expanded into stored wars.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
                - description: Season in YYYY-MM or date form
                  in: path
                  name: season
                  required: true
                  schema:
                    type: string
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/legacy.CWLGroup'
                    description: OK
                "404":
                    content:
                        application/json:
                            schema:
                                additionalProperties:
                                    type: string
                                type: object
                    description: Not Found
            summary: CWL information for a clan in a season
            tags:
                - Legacy
    /cwl/{clan_tag}/group:
        get:
            description: Legacy v1-compatible Mongo-style CWL group envelope. Returns null when unavailable.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/legacy.CWLGroupEnvelope'
                    description: OK
            summary: Current-season CWL group for a clan
            tags:
                - Legacy
    /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
    /player/{player_tag}/join-leave:
        get:
            description: Legacy v1-compatible tracked player membership events.
            parameters:
                - description: Player tag
                  in: path
                  name: player_tag
                  required: true
                  schema:
                    type: string
                - description: Inclusive Unix timestamp
                  in: query
                  name: timestamp_start
                  schema:
                    default: 0
                    type: integer
                - description: Inclusive Unix timestamp
                  in: query
                  name: time_stamp_end
                  schema:
                    default: 9.999999999e+09
                    type: integer
                - description: Maximum source events
                  in: query
                  name: limit
                  schema:
                    default: 250
                    type: integer
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/legacy.JoinLeaveResponse'
                    description: OK
            summary: Player join and leave history
            tags:
                - Legacy
    /player/{player_tag}/warhits:
        get:
            description: Legacy v1-compatible war-grouped player history.
            parameters:
                - description: Player tag
                  in: path
                  name: player_tag
                  required: true
                  schema:
                    type: string
                - description: Inclusive preparation-time start
                  in: query
                  name: timestamp_start
                  schema:
                    default: 0
                    type: integer
                - description: Inclusive preparation-time end
                  in: query
                  name: timestamp_end
                  schema:
                    default: 2.527625513e+09
                    type: integer
                - description: Maximum wars
                  in: query
                  name: limit
                  schema:
                    default: 50
                    maximum: 100
                    type: integer
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/legacy.PlayerWarHitsResponse'
                    description: OK
            summary: War attacks and defenses for a player
            tags:
                - Legacy
    /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 & Inactivity
    /v2/admin/tracking/summary:
        get:
            description: Returns the latest API-derived operational state for every tracking script and domain. Requires the admin service token.
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.TrackingOperationsSummaryResponse'
                    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
                "503":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.ErrorResponse'
                    description: Service Unavailable
            security:
                - ApiKeyAuth: []
            summary: Get tracking operations summary
            tags:
                - Admin Tracking
    /v2/admin/tracking/timeseries:
        get:
            description: Returns bucketed, bounded operational chart data. Window is restricted to 15m, 1h, 6h, or 24h; script and domain are optional exact-match filters.
            parameters:
                - description: Chart window
                  in: query
                  name: window
                  schema:
                    default: 1h
                    enum:
                        - 15m
                        - 1h
                        - 6h
                        - 24h
                    type: string
                - description: Exact script name
                  in: query
                  name: script
                  schema:
                    type: string
                - description: Exact domain name
                  in: query
                  name: domain
                  schema:
                    type: string
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.TrackingOperationsTimeSeriesResponse'
                    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
                "503":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.ErrorResponse'
                    description: Service Unavailable
            security:
                - ApiKeyAuth: []
            summary: Get tracking operations time series
            tags:
                - Admin Tracking
    /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/{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/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/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}/cached:
        get:
            description: Returns a stored clan profile when live data is unnecessary. Values may be several hours behind the official API.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.ClanCachedResponse'
                    description: OK
                "500":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.ErrorResponse'
                    description: Internal Server Error
            summary: Read a recently cached clan profile
            tags:
                - Clan
    /v2/clan/{clan_tag}/history/changes:
        get:
            description: Returns stored description or clan-level changes with optional inclusive time bounds. Each value keeps its natural string or integer type.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
                - description: Change type
                  in: query
                  name: type
                  schema:
                    enum:
                        - description
                        - clanLevel
                    type: string
                - description: Only include changes at or after this ISO-8601 time
                  in: query
                  name: time[after]
                  schema:
                    type: string
                - description: Only include changes at or before this ISO-8601 time
                  in: query
                  name: time[before]
                  schema:
                    type: string
                - description: Maximum changes to return
                  in: query
                  name: limit
                  schema:
                    default: 50
                    maximum: 500
                    minimum: 1
                    type: integer
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.ClanChangesResponse'
                    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: Review changes to a clan's profile
            tags:
                - Clan
    /v2/clan/{clan_tag}/history/leaderboards:
        get:
            description: Returns dated clan placements and points for one required leaderboard type, with optional inclusive time bounds.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
                - description: Leaderboard type
                  in: query
                  name: type
                  required: true
                  schema:
                    enum:
                        - clan_home_points
                        - clan_builder_base_points
                        - clan_capital_points
                    type: string
                - description: Only include snapshots at or after this ISO-8601 time
                  in: query
                  name: time[after]
                  schema:
                    type: string
                - description: Only include snapshots at or before this ISO-8601 time
                  in: query
                  name: time[before]
                  schema:
                    type: string
                - description: Maximum snapshots to return
                  in: query
                  name: limit
                  schema:
                    default: 50
                    maximum: 250
                    minimum: 1
                    type: integer
            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: Review a clan's leaderboard history
            tags:
                - Clan
    /v2/clan/{clan_tag}/history/leaderboards/summary:
        get:
            description: Returns selectable Clash seasons with exact history bounds and performance summaries for Home, Builder, or Capital leaderboards.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
                - description: Leaderboard type
                  in: query
                  name: 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.ClanLeaderboardHistorySummaryResponse'
                    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: Summarize a clan's leaderboard history
            tags:
                - Clan
    /v2/clan/{clan_tag}/history/legends:
        get:
            description: Returns players who finished Legend seasons with the clan, ordered by newest season and then final rank.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
                - description: Only include seasons at or after this ISO-8601 time
                  in: query
                  name: time[after]
                  schema:
                    type: string
                - description: Only include seasons at or before this ISO-8601 time
                  in: query
                  name: time[before]
                  schema:
                    type: string
                - description: Maximum finishers to return
                  in: query
                  name: limit
                  schema:
                    default: 50
                    maximum: 250
                    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: Review a clan's final Legend finishers
            tags:
                - Clan
    /v2/clan/{clan_tag}/history/legends/summary:
        get:
            description: Lists every queryable Legend season and the clan's ten best all-time finishes. Players may appear more than once.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
                - description: Number of best finishes to return
                  in: query
                  name: top
                  schema:
                    default: 10
                    maximum: 50
                    minimum: 1
                    type: integer
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.ClanLegendHistorySummaryResponse'
                    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: Summarize a clan's Legend history
            tags:
                - Clan
    /v2/clan/{clan_tag}/join-leave:
        get:
            description: Returns stored joins and leaves for one clan. Time filters affect returned events, while available and uniquePlayers remain all-time totals.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
                - 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
                - description: Maximum events to return
                  in: query
                  name: limit
                  schema:
                    default: 50
                    maximum: 500
                    minimum: 1
                    type: integer
            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: Review a clan's membership changes
            tags:
                - Clan
    /v2/clan/{clan_tag}/rankings:
        get:
            description: Returns current Home Village, Builder Base, and Clan Capital scores with every available global and local leaderboard position.
            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: View a clan's current leaderboard positions
            tags:
                - Clan
    /v2/clan/{clan_tag}/records:
        get:
            description: Returns the clan's highest tracked points and longest war win streak, including when each record was reached.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.ClanBasicRecords'
                    description: OK
                "500":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.ErrorResponse'
                    description: Internal Server Error
            summary: View a clan's tracked records
            tags:
                - Clan
    /v2/clan/{clan_tag}/warlog:
        get:
            description: Returns stored wars in the official clan war-log shape, with optional type and end-time filters for paging historical results.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
                - description: War type
                  in: query
                  name: type
                  schema:
                    enum:
                        - cwl
                        - random
                        - friendly
                    type: string
                - description: Only include wars ending at or after this ISO-8601 time
                  in: query
                  name: time[after]
                  schema:
                    type: string
                - description: Only include wars ending at or before this ISO-8601 time
                  in: query
                  name: time[before]
                  schema:
                    type: string
                - description: Maximum wars to return
                  in: query
                  name: limit
                  schema:
                    default: 50
                    maximum: 500
                    minimum: 1
                    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
                "500":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.ErrorResponse'
                    description: Internal Server Error
            summary: Official API-compatible war log from stored war history
            tags:
                - Clan
    /v2/clan/{clan_tag}/wars:
        get:
            description: Returns complete stored war details, including members and attacks, filtered by war type and inclusive end-time boundaries.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
                - description: War type
                  in: query
                  name: type
                  schema:
                    enum:
                        - cwl
                        - random
                        - friendly
                    type: string
                - description: Only include wars ending at or after this ISO-8601 time
                  in: query
                  name: time[after]
                  schema:
                    type: string
                - description: Only include wars ending at or before this ISO-8601 time
                  in: query
                  name: time[before]
                  schema:
                    type: string
                - description: Maximum wars to return
                  in: query
                  name: limit
                  schema:
                    default: 15
                    maximum: 500
                    minimum: 1
                    type: integer
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.WarListResponse'
                    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: Complete stored wars for a clan
            tags:
                - Clan
    /v2/clan/search:
        get:
            description: Finds clans by name or exact tag with comma-separated filters, range bounds, and cursor pagination.
            parameters:
                - description: Clan name or exact tag
                  in: query
                  name: query
                  required: true
                  schema:
                    maxLength: 100
                    minLength: 2
                    type: string
                - description: Comma-separated location IDs
                  explode: false
                  in: query
                  name: locationIds
                  schema:
                    items:
                        type: integer
                    type: array
                  style: form
                - description: Comma-separated war league IDs
                  explode: false
                  in: query
                  name: warLeagueIds
                  schema:
                    items:
                        type: integer
                    type: array
                  style: form
                - description: Minimum clan level
                  in: query
                  name: clanLevel[min]
                  schema:
                    minimum: 1
                    type: integer
                - description: Maximum clan level
                  in: query
                  name: clanLevel[max]
                  schema:
                    minimum: 1
                    type: integer
                - description: Minimum member count
                  in: query
                  name: members[min]
                  schema:
                    maximum: 50
                    minimum: 0
                    type: integer
                - description: Maximum member count
                  in: query
                  name: members[max]
                  schema:
                    maximum: 50
                    minimum: 0
                    type: integer
                - description: Maximum results to return
                  in: query
                  name: limit
                  schema:
                    default: 25
                    maximum: 200
                    minimum: 1
                    type: integer
                - description: Cursor returned by the previous page
                  in: query
                  name: cursor
                  schema:
                    type: string
            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
                "503":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.ErrorResponse'
                    description: Service Unavailable
            summary: Search clans
            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/{clan_tag}/group:
        get:
            description: Returns the requested CWL group with its roster, rounds, and wars, or the clan's most recent stored season when 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: View a clan's stored CWL group
            tags:
                - War & CWL
    /v2/cwl/{clan_tag}/ranking-history:
        get:
            description: Returns every stored CWL group containing the clan. Rosters and rounds are historical snapshots; rankings appear only when separately saved.
            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: Browse a clan's stored CWL groups
            tags:
                - War & CWL
    /v2/cwl/{clan_tag}/seasons:
        get:
            description: Lists every stored CWL season containing the clan, with its league, team size, state, and available group standing.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
                - description: Maximum seasons to return
                  in: query
                  name: limit
                  schema:
                    default: 12
                    minimum: 1
                    type: integer
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.CWLSeasonsResponse'
                    description: OK
                "400":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.ErrorResponse'
                    description: Bad Request
            summary: List a clan's stored CWL seasons
            tags:
                - War & 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 & 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 & 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/{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/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/cwl/{league_id}:
        get:
            description: Returns the saved leaderboard for one CWL season, league, and team size, ordered by global rank and then group rank.
            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 team size
                  in: query
                  name: team_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: Rank CWL clans within a league
            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/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/{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}/{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/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/{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}/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}/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/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/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 previously observed battle logs for the player, including farming attacks when those results were available during tracking.
            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: Browse a player's saved battle history
            tags:
                - Player
    /v2/player/{player_tag}/cwl/history:
        get:
            description: Returns each season containing the player, with their clan, league, team size, attacks, missed attacks, results, stars, and placements.
            parameters:
                - description: Player tag
                  in: path
                  name: player_tag
                  required: true
                  schema:
                    type: string
                - description: Maximum seasons to return
                  in: query
                  name: limit
                  schema:
                    default: 6
                    minimum: 1
                    type: integer
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.CWLPlayerHistoryResponse'
                    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: Review a player's CWL season history
            tags:
                - Player
    /v2/player/{player_tag}/history/changes:
        get:
            description: Returns stored changes of one required type, such as upgrades or trophies, with optional inclusive time bounds.
            parameters:
                - description: Player tag
                  in: path
                  name: player_tag
                  required: true
                  schema:
                    type: string
                - description: Change type
                  in: query
                  name: type
                  required: true
                  schema:
                    enum:
                        - troop_level
                        - super_troop_boost
                        - hero_level
                        - spell_level
                        - pet_level
                        - equipment_level
                        - townhall_level
                        - best_trophies
                        - best_builder_base_trophies
                        - exp_level
                        - war_preference
                        - name
                    type: string
                - description: Only include changes at or after this ISO-8601 time
                  in: query
                  name: time[after]
                  schema:
                    type: string
                - description: Only include changes at or before this ISO-8601 time
                  in: query
                  name: time[before]
                  schema:
                    type: string
                - description: Maximum changes to return
                  in: query
                  name: limit
                  schema:
                    default: 50
                    maximum: 500
                    minimum: 1
                    type: integer
            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: Review changes to a player's profile
            tags:
                - Player
    /v2/player/{player_tag}/history/stats:
        get:
            description: Returns positive changes for one required activity type over an inclusive time range, newest first and limited to stored observations.
            parameters:
                - description: Player tag
                  in: path
                  name: player_tag
                  required: true
                  schema:
                    type: string
                - description: Stat type
                  in: query
                  name: type
                  required: true
                  schema:
                    enum:
                        - donated
                        - received
                        - clan_games
                        - capital_gold_donated
                    type: string
                - description: Only include changes at or after this ISO-8601 time; defaults to 30 days ago when no time range is provided
                  in: query
                  name: time[after]
                  schema:
                    type: string
                - description: Only include changes at or before this ISO-8601 time
                  in: query
                  name: time[before]
                  schema:
                    type: string
                - description: Maximum changes to return
                  in: query
                  name: limit
                  schema:
                    default: 50
                    maximum: 500
                    minimum: 1
                    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: Track a player's activity gains
            tags:
                - Player
    /v2/player/{player_tag}/join-leave:
        get:
            description: Returns stored clan joins and leaves for one player. Time filters affect returned events, while available remains the all-time total.
            parameters:
                - description: Player tag
                  in: path
                  name: player_tag
                  required: true
                  schema:
                    type: string
                - 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
                - description: Maximum events to return
                  in: query
                  name: limit
                  schema:
                    default: 50
                    maximum: 500
                    minimum: 1
                    type: integer
            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: Review a player's clan movements
            tags:
                - Player
    /v2/player/{player_tag}/join-leave/shared:
        get:
            description: Returns every clan the two players shared, including their total overlap and the exact stored time ranges together.
            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: Find clans shared by two players
            tags:
                - Player
    /v2/player/{player_tag}/join-leave/totals:
        get:
            description: Totals the player's stored time and visits for every clan, making long-term clan membership easy to compare.
            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: Measure a player's time in each clan
            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 the player's placement for one ranked season together with the recent battles saved for that season.
            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: Review a player's ranked season battles
            tags:
                - Player
    /v2/player/{player_tag}/ranked/{season}/group:
        get:
            description: Returns the complete ranked group containing the player for one season, including every stored member and placement.
            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: View a player's ranked season group
            tags:
                - Player
    /v2/player/{player_tag}/rankings:
        get:
            description: Returns current Home Village and Builder Base trophy positions plus the player's official ranking location when it is known.
            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
                "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: View a player's current leaderboard positions
            tags:
                - Player
    /v2/player/{player_tag}/timers:
        get:
            description: Returns active regular-war, CWL, and Capital Raid timers currently stored for the player.
            parameters:
                - description: Player tag
                  in: path
                  name: player_tag
                  required: true
                  schema:
                    type: string
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.PlayerTimersResponse'
                    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: View a player's active timers
            tags:
                - Player
    /v2/player/{player_tag}/war/attacks:
        get:
            description: Returns stored attacks made by or against the player, with optional war type and inclusive time filters, newest first.
            parameters:
                - description: Player tag
                  in: path
                  name: player_tag
                  required: true
                  schema:
                    type: string
                - description: War type
                  in: query
                  name: type
                  schema:
                    enum:
                        - cwl
                        - random
                        - friendly
                    type: string
                - description: Only include attacks at or after this ISO-8601 time
                  in: query
                  name: time[after]
                  schema:
                    type: string
                - description: Only include attacks at or before this ISO-8601 time
                  in: query
                  name: time[before]
                  schema:
                    type: string
                - description: Maximum attacks to return
                  in: query
                  name: limit
                  schema:
                    default: 50
                    maximum: 500
                    minimum: 1
                    type: integer
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.PlayerWarAttacksResponse'
                    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: Browse a player's war attacks and defenses
            tags:
                - Player
    /v2/player/{player_tag}/war/stats:
        get:
            description: Returns wars where the player appeared, including both sides and every attack involving them. Empty attack lists reveal missed opportunities.
            parameters:
                - description: Player tag
                  in: path
                  name: player_tag
                  required: true
                  schema:
                    type: string
                - description: War type
                  in: query
                  name: type
                  schema:
                    enum:
                        - cwl
                        - random
                        - friendly
                    type: string
                - description: Only include wars ending at or after this ISO-8601 time
                  in: query
                  name: time[after]
                  schema:
                    type: string
                - description: Only include wars ending at or before this ISO-8601 time
                  in: query
                  name: time[before]
                  schema:
                    type: string
                - description: Maximum wars to return
                  in: query
                  name: limit
                  schema:
                    default: 15
                    maximum: 500
                    minimum: 1
                    type: integer
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.PlayerWarStatsResponse'
                    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: Review a player's complete war history
            tags:
                - Player
    /v2/player/search:
        get:
            description: Finds players by name or exact tag with comma-separated filters and cursor pagination.
            parameters:
                - description: Player name or exact tag
                  in: query
                  name: query
                  required: true
                  schema:
                    maxLength: 100
                    minLength: 2
                    type: string
                - description: Comma-separated clan tags
                  explode: false
                  in: query
                  name: clanTags
                  schema:
                    items:
                        type: string
                    type: array
                  style: form
                - description: Comma-separated league tier IDs
                  explode: false
                  in: query
                  name: leagueIds
                  schema:
                    items:
                        type: integer
                    type: array
                  style: form
                - description: Comma-separated town hall levels
                  explode: false
                  in: query
                  name: townhallLevels
                  schema:
                    items:
                        type: integer
                    type: array
                  style: form
                - description: Maximum results to return
                  in: query
                  name: limit
                  schema:
                    default: 25
                    maximum: 200
                    minimum: 1
                    type: integer
                - description: Cursor returned by the previous page
                  in: query
                  name: cursor
                  schema:
                    type: string
            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
                "503":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.ErrorResponse'
                    description: Service Unavailable
            summary: Search players
            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/{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-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-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/{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-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/{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/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/{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/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/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/{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}/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}/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/{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}/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}/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/{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-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/{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:
            description: Returns the saved bonus-medal recipients for one server, clan, and CWL season so an existing award plan can be reviewed.
            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: View saved CWL bonus recipients
            tags:
                - Server Clans
        put:
            description: Replaces the saved bonus-medal recipients for one server, clan, and CWL season with the submitted player list.
            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 saved CWL bonus recipients
            tags:
                - Server Clans
    /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_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}/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}/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}/{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/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/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_tag}/basic:
        get:
            description: Returns the stored active war schedule, participants, timing, type, optional CWL tag, and known public-war-log visibility.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/modelsv2.BasicWarResponse'
                    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: View a clan's scheduled war
            tags:
                - War & CWL
    /v2/war/{clan_tag}/previous/{endtime}:
        get:
            description: Returns the stored clan war ending nearest the supplied Clash time, allowing a ten-minute difference in either direction.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
                - description: War end time in Clash format, such as 20260820T120000.000Z
                  in: path
                  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: Find a stored war by end time
            tags:
                - War & CWL
    /war/{clan_tag}/previous:
        get:
            description: Legacy v1-compatible stored full-war history.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
                - description: Inclusive preparation-time start
                  in: query
                  name: timestamp_start
                  schema:
                    default: 0
                    type: integer
                - description: Inclusive preparation-time end
                  in: query
                  name: timestamp_end
                  schema:
                    default: 9.999999999e+09
                    type: integer
                - description: Maximum wars
                  in: query
                  name: limit
                  schema:
                    default: 50
                    type: integer
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/legacy.WarListResponse'
                    description: OK
            summary: Previous wars for a clan
            tags:
                - Legacy
    /war/{clan_tag}/previous/{end_time}:
        get:
            description: Legacy v1-compatible lookup within five minutes of the supplied Clash timestamp.
            parameters:
                - description: Clan tag
                  in: path
                  name: clan_tag
                  required: true
                  schema:
                    type: string
                - description: End time in Clash format
                  in: path
                  name: end_time
                  required: true
                  schema:
                    type: string
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/legacy.War'
                    description: OK
                "404":
                    content:
                        application/json:
                            schema:
                                additionalProperties:
                                    type: string
                                type: object
                    description: Not Found
            summary: Previous war at an end time
            tags:
                - Legacy
tags:
    - name: Player
    - name: Clan
    - name: War & CWL
    - name: Leaderboard
    - name: Counts
    - name: Stats
    - name: Search
    - name: Dates
    - name: Links
    - name: Achievements
    - name: Activity & Inactivity
    - name: Admin Tracking
    - name: App Authentication
    - name: Bases
    - name: Bases Bot Integration
    - name: Billing
    - name: Bot Profile
    - name: Clan Categories
    - name: Configuration
    - name: Dashboard
    - name: Dashboard Access
    - name: Enums
    - name: Global
    - name: Legacy
    - 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
