from typing import TYPE_CHECKING

# noinspection PyPackageRequirements
from discord.ext.commands import Cog

if TYPE_CHECKING:
    # noinspection PyPackageRequirements
    from discord import (
        Activity,
        CustomActivity,
        Game,
        Interaction,
        Member,
        Spotify,
        Streaming,
        User,
        app_commands,
    )

    # noinspection PyPackageRequirements
    from discord.ext.commands import Bot

    from minqlx import Player
    from minqlx.database import Redis

DISCORD_MAP_SUBSCRIPTION_KEY: str
DISCORD_PLAYER_SUBSCRIPTION_KEY: str
DISCORD_MEMBER_SUBSCRIPTION_KEY: str
LONG_MAP_NAMES_KEY: str
LAST_USED_NAME_KEY: str

class SubscriberCog(Cog):
    subscribe_group: app_commands.Group
    unsubscribe_group: app_commands.Group
    bot: Bot
    db: Redis
    long_map_names_lookup: dict[str, str]
    installed_maps: list[str]
    formatted_installed_maps: dict[str, str]
    known_players: dict[int, str]
    last_notified_map: str | None
    notified_steam_ids: list[int]
    def __init__(self, bot: Bot, db: Redis) -> None: ...
    def gather_known_players(self) -> dict[int, str]: ...
    async def subscribe_map(self, interaction: Interaction, mapname: str) -> None: ...
    async def _subscribe_map(self, interaction: Interaction, mapname: str) -> None: ...
    def subscribed_maps_of(self, user_id: int) -> list[str]: ...
    def format_mapname(self, mapname: str) -> str: ...
    async def subscribe_map_autocomplete(
        self, interaction: Interaction, current: str
    ) -> list[app_commands.Choice[str]]: ...
    async def subscribe_player(self, interaction: Interaction, player: str) -> None: ...
    async def _subscribe_player(
        self, interaction: Interaction, player: str
    ) -> None: ...
    def find_matching_players(self, player: str) -> list[int]: ...
    def formatted_last_used_name(self, steam_id: int) -> str: ...
    def subscribed_players_of(self, user_id: int) -> list[int]: ...
    async def subscribe_player_autocomplete(
        self, interaction: Interaction, current: str
    ) -> list[app_commands.Choice[str]]: ...
    async def subscribe_member(
        self, interaction: Interaction, member: Member
    ) -> None: ...
    async def _subscribe_member(
        self, interaction: Interaction, member: Member
    ) -> None: ...
    def subscribed_users_of(self, user_id: int) -> list[User]: ...
    async def unsubscribe_map(self, interaction: Interaction, mapname: str) -> None: ...
    async def _unsubscribe_map(
        self, interaction: Interaction, mapname: str
    ) -> None: ...
    async def unsubscribe_map_autocomplete(
        self, interaction: Interaction, current: str
    ) -> list[app_commands.Choice[str]]: ...
    async def unsubscribe_player(
        self, interaction: Interaction, player: str
    ) -> None: ...
    async def _unsubscribe_player(
        self, interaction: Interaction, player: str
    ) -> None: ...
    async def unsubscribe_player_autocomplete(
        self, interaction: Interaction, current: str
    ) -> list[app_commands.Choice[str]]: ...
    async def unsubscribe_member(
        self, interaction: Interaction, member: Member
    ) -> None: ...
    async def _unsubscribe_member(
        self, interaction: Interaction, member: Member
    ) -> None: ...
    async def notify_map_change(self, mapname: str) -> None: ...
    async def notify_player_connected(self, player: Player) -> None: ...
    async def check_subscriptions(self) -> None: ...
    def find_relevant_activity(
        self, member: Member
    ) -> Activity | Game | CustomActivity | Streaming | Spotify | None: ...
    async def on_presence_update(self, before: Member, after: Member) -> None: ...

def check_subscriptions(cog: SubscriberCog) -> None: ...
async def setup(bot: Bot) -> None: ...
def run_schedule() -> None: ...
