import typing as t

import attrs

from pokelance.models import BaseModel

__all__: t.Tuple[str, ...] = ("ShowdownSprites",)


PATH: str = "https://play.pokemonshowdown.com/sprites/{path}"


SPRITES: t.Dict[str, t.Dict[str, str]] = {
    "front_default": {
        "nidoran-m": "nidoran",
        "mr-mime": "mrmime",
        "ho-oh": "hooh",
        "deoxys-normal": "deoxys",
        "wormadam-plant": "wormadam",
        "mime-jr": "mimejr",
        "giratina-altered": "giratina",
        "shaymin-land": "shaymin",
        "basculin-red-striped": "basculin",
        "darmanitan-standard": "darmanitan",
        "thundurus-incarnate": "thundurus",
        "tornadus-incarnate": "tornadus",
        "keldeo-ordinary": "keldeo",
        "landorus-incarnate": "landorus",
        "meloetta-aria": "meloetta",
        "meowstic-male": "meowstic",
        "aegislash-shield": "aegislash",
        "pumpkaboo-average": "pumpkaboo",
        "gourgeist-average": "gourgeist",
        "zygarde-50": "zygarde",
        "oricorio-baile": "oricorio",
        "lycanroc-midday": "lycanroc",
        "wishiwashi-solo": "wishiwashi",
        "type-null": "typenull",
        "minior-red-meteor": "minior",
        "mimikyu-disguised": "mimikyu",
        "hakamo-o": "hakamoo",
        "kommo-o": "kommoo",
        "tapu-lele": "tapulele",
        "tapu-koko": "tapukoko",
        "tapu-bulu": "tapubulu",
        "jangmo-o": "jangmoo",
        "tapu-fini": "tapufini",
        "toxtricity-amped": "toxtricity",
        "mr-rime": "mrrime",
        "eiscue-ice": "eiscue",
        "indeedee-male": "indeedee",
        "morpeko-full-belly": "morpeko",
        "urshifu-single-strike": "urshifu",
        "kleavor": "",
        "ursaluna": "",
        "wyrdeer": "",
        "sneasler": "",
        "overqwil": "",
        "enamorus-incarnate": "",
        "basculegion-male": "",
        "basculin-blue-striped": "basculin-bluestriped",
        "meowstic-female": "meowstic-f",
        "charizard-mega-y": "charizard-megay",
        "charizard-mega-x": "charizard-megax",
        "mewtwo-mega-y": "mewtwo-megay",
        "mewtwo-mega-x": "mewtwo-megax",
        "pikachu-rock-star": "pikachu-rockstar",
        "raticate-totem-alola": "raticate-alola-totem",
        "pikachu-original-cap": "pikachu-original",
        "pikachu-sinnoh-cap": "pikachu-sinnoh",
        "pikachu-unova-cap": "pikachu-unova",
        "pikachu-kalos-cap": "pikachu-kalos",
        "pikachu-hoenn-cap": "pikachu-hoenn",
        "pikachu-alola-cap": "pikachu-alola",
        "greninja-battle-bond": "greninja-ash",
        "zygarde-10-power-construct": "zygarde-10",
        "zygarde-50-power-construct": "zygarde",
        "oricorio-pom-pom": "oricorio-pompom",
        "minior-yellow-meteor": "minior-yellow",
        "minior-green-meteor": "minior-green",
        "minior-blue-meteor": "minior-blue",
        "minior-violet-meteor": "minior-violet",
        "minior-orange-meteor": "minior-orange",
        "minior-red": "minior",
        "minior-indigo-meteor": "minior-indigo",
        "mimikyu-totem-busted": "mimikyu-busted-totem",
        "mimikyu-totem-disguised": "mimikyu-totem",
        "pikachu-partner-cap": "pikachu-partner",
        "rockruff-own-tempo": "rockruff",
        "ribombee-totem": "ribombee",
        "necrozma-dawn": "necrozma-dawnwings",
        "necrozma-dusk": "necrozma-duskmane",
        "pikachu-world-cap": "pikachu-starter",
        "mr-mime-galar": "mrmime-galar",
        "darmanitan-galar-standard": "darmanitan-galar",
        "darmanitan-galar-zen": "darmanitan-galarzen",
        "toxtricity-low-key": "toxtricity-lowkey",
        "indeedee-female": "indeedee-f",
        "venusaur-gmax": "",
        "urshifu-rapid-strike": "urshifu-rapidstrike",
        "blastoise-gmax": "",
        "rillaboom-gmax": "",
        "cinderace-gmax": "",
        "toxtricity-amped-gmax": "toxtricity-gmax",
        "urshifu-single-strike-gmax": "",
        "urshifu-rapid-strike-gmax": "",
        "toxtricity-low-key-gmax": "toxtricity-gmax",
        "growlithe-hisui": "",
        "arcanine-hisui": "",
        "voltorb-hisui": "",
        "typhlosion-hisui": "",
        "electrode-hisui": "",
        "qwilfish-hisui": "",
        "sneasel-hisui": "",
        "samurott-hisui": "",
        "lilligant-hisui": "",
        "zoroark-hisui": "",
        "braviary-hisui": "",
        "zorua-hisui": "",
        "sliggoo-hisui": "",
        "goodra-hisui": "",
        "avalugg-hisui": "",
        "decidueye-hisui": "",
        "dialga-origin": "",
        "basculin-white-striped": "",
        "basculegion-female": "",
        "enamorus-therian": "",
        "palkia-origin": "",
    },
    "front_shiny": {
        "nidoran-m": "nidoranm",
        "nidoran-f": "nidoranf",
        "mr-mime": "mrmime",
        "ho-oh": "hooh",
        "deoxys-normal": "deoxys",
        "wormadam-plant": "wormadam",
        "mime-jr": "mimejr",
        "giratina-altered": "giratina",
        "shaymin-land": "shaymin",
        "basculin-red-striped": "basculin",
        "darmanitan-standard": "darmanitan",
        "thundurus-incarnate": "thundurus",
        "tornadus-incarnate": "tornadus",
        "keldeo-ordinary": "keldeo",
        "landorus-incarnate": "landorus",
        "meloetta-aria": "meloetta",
        "meowstic-male": "meowstic",
        "aegislash-shield": "aegislash",
        "pumpkaboo-average": "pumpkaboo",
        "gourgeist-average": "gourgeist",
        "zygarde-50": "zygarde",
        "oricorio-baile": "oricorio",
        "lycanroc-midday": "lycanroc",
        "wishiwashi-solo": "wishiwashi",
        "type-null": "typenull",
        "minior-red-meteor": "minior",
        "mimikyu-disguised": "mimikyu",
        "hakamo-o": "hakamoo",
        "kommo-o": "kommoo",
        "tapu-lele": "tapulele",
        "tapu-koko": "tapukoko",
        "tapu-bulu": "tapubulu",
        "jangmo-o": "jangmoo",
        "tapu-fini": "tapufini",
        "toxtricity-amped": "toxtricity",
        "mr-rime": "mrrime",
        "eiscue-ice": "eiscue",
        "indeedee-male": "indeedee",
        "morpeko-full-belly": "morpeko",
        "urshifu-single-strike": "urshifu",
        "kleavor": "",
        "ursaluna": "",
        "wyrdeer": "",
        "sneasler": "",
        "overqwil": "",
        "enamorus-incarnate": "",
        "basculegion-male": "",
        "basculin-blue-striped": "basculin-bluestriped",
        "meowstic-female": "meowstic-f",
        "charizard-mega-y": "charizard-megay",
        "charizard-mega-x": "charizard-megax",
        "mewtwo-mega-y": "mewtwo-megay",
        "mewtwo-mega-x": "mewtwo-megax",
        "pikachu-rock-star": "pikachu-rockstar",
        "raticate-totem-alola": "raticate-alola-totem",
        "pikachu-original-cap": "pikachu-kantocap",
        "pikachu-sinnoh-cap": "pikachu-sinnohcap",
        "pikachu-unova-cap": "pikachu-unovacap",
        "pikachu-kalos-cap": "pikachu-kaloscap",
        "pikachu-hoenn-cap": "pikachu-hoenncap",
        "pikachu-alola-cap": "pikachu-alolacap",
        "pikachu-starter": "pikachu-kantocap",
        "eevee-starter": "",
        "pikachu-pop-star": "pikachu-popstar",
        "greninja-battle-bond": "greninja-ash",
        "zygarde-10-power-construct": "zygarde-10",
        "zygarde-50-power-construct": "zygarde",
        "oricorio-pom-pom": "oricorio-pompom",
        "minior-yellow-meteor": "minior-yellow",
        "minior-green-meteor": "minior-green",
        "minior-blue-meteor": "minior-blue",
        "minior-violet-meteor": "minior-violet",
        "minior-orange-meteor": "minior-orange",
        "minior-red": "minior",
        "minior-indigo-meteor": "minior-indigo",
        "mimikyu-totem-busted": "mimikyu-busted-totem",
        "mimikyu-totem-disguised": "mimikyu-totem",
        "pikachu-partner-cap": "pikachu-partner",
        "rockruff-own-tempo": "rockruff",
        "ribombee-totem": "ribombee",
        "necrozma-dawn": "necrozma-dawnwings",
        "necrozma-dusk": "necrozma-duskmane",
        "pikachu-world-cap": "pikachu-kantocap",
        "mr-mime-galar": "mrmime-galar",
        "darmanitan-galar-standard": "darmanitan-galar",
        "darmanitan-galar-zen": "darmanitan-galarzen",
        "toxtricity-low-key": "toxtricity-lowkey",
        "indeedee-female": "indeedee-f",
        "venusaur-gmax": "",
        "urshifu-rapid-strike": "urshifu-rapidstrike",
        "blastoise-gmax": "",
        "rillaboom-gmax": "",
        "cinderace-gmax": "",
        "toxtricity-amped-gmax": "toxtricity-gmax",
        "urshifu-single-strike-gmax": "",
        "urshifu-rapid-strike-gmax": "",
        "toxtricity-low-key-gmax": "toxtricity-gmax",
        "growlithe-hisui": "",
        "arcanine-hisui": "",
        "voltorb-hisui": "",
        "typhlosion-hisui": "",
        "electrode-hisui": "",
        "qwilfish-hisui": "",
        "sneasel-hisui": "",
        "samurott-hisui": "",
        "lilligant-hisui": "",
        "zoroark-hisui": "",
        "braviary-hisui": "",
        "zorua-hisui": "",
        "sliggoo-hisui": "",
        "goodra-hisui": "",
        "avalugg-hisui": "",
        "decidueye-hisui": "",
        "dialga-origin": "",
        "basculin-white-striped": "",
        "basculegion-female": "",
        "enamorus-therian": "",
        "palkia-origin": "",
    },
    "back_default": {
        "nidoran-m": "nidoranm",
        "nidoran-f": "nidoranf",
        "porygon-z": "porygonz",
        "mr-mime": "mrmime",
        "ho-oh": "hooh",
        "deoxys-normal": "deoxys",
        "wormadam-plant": "wormadam",
        "mime-jr": "mimejr",
        "giratina-altered": "giratina",
        "shaymin-land": "shaymin",
        "basculin-red-striped": "basculin",
        "darmanitan-standard": "darmanitan",
        "thundurus-incarnate": "thundurus",
        "tornadus-incarnate": "tornadus",
        "keldeo-ordinary": "keldeo",
        "landorus-incarnate": "landorus",
        "meloetta-aria": "meloetta",
        "meowstic-male": "meowstic",
        "aegislash-shield": "aegislash",
        "pumpkaboo-average": "pumpkaboo",
        "gourgeist-average": "gourgeist",
        "zygarde-50": "zygarde",
        "oricorio-baile": "oricorio",
        "lycanroc-midday": "lycanroc",
        "wishiwashi-solo": "wishiwashi",
        "type-null": "typenull",
        "minior-red-meteor": "minior",
        "mimikyu-disguised": "mimikyu",
        "hakamo-o": "hakamoo",
        "kommo-o": "kommoo",
        "tapu-lele": "tapulele",
        "tapu-koko": "tapukoko",
        "tapu-bulu": "tapubulu",
        "jangmo-o": "jangmoo",
        "tapu-fini": "tapufini",
        "toxtricity-amped": "toxtricity",
        "mr-rime": "mrrime",
        "eiscue-ice": "eiscue",
        "indeedee-male": "indeedee",
        "morpeko-full-belly": "morpeko",
        "urshifu-single-strike": "urshifu",
        "kleavor": "",
        "ursaluna": "",
        "wyrdeer": "",
        "sneasler": "",
        "overqwil": "",
        "enamorus-incarnate": "",
        "basculegion-male": "",
        "basculin-blue-striped": "basculin-bluestriped",
        "meowstic-female": "meowstic-f",
        "charizard-mega-y": "charizard-megay",
        "charizard-mega-x": "charizard-megax",
        "mewtwo-mega-y": "mewtwo-megay",
        "mewtwo-mega-x": "mewtwo-megax",
        "pikachu-libre": "",
        "pikachu-pop-star": "pikachu-popstar",
        "pikachu-rock-star": "pikachu-rockstar",
        "raticate-totem-alola": "raticate-alola-totem",
        "pikachu-original-cap": "pikachu-original",
        "pikachu-sinnoh-cap": "pikachu-sinnoh",
        "pikachu-unova-cap": "pikachu-unova",
        "pikachu-kalos-cap": "pikachu-kalos",
        "pikachu-hoenn-cap": "pikachu-hoenn",
        "pikachu-alola-cap": "pikachu-alola",
        "kommo-o-totem": "kommoo-totem",
        "marowak-totem": "marowak-alola-totem",
        "inteleon-gmax": "",
        "greninja-battle-bond": "greninja-ash",
        "zygarde-10-power-construct": "zygarde-10",
        "zygarde-50-power-construct": "zygarde",
        "oricorio-pom-pom": "oricorio-pompom",
        "minior-yellow-meteor": "minior-yellow",
        "minior-green-meteor": "minior-green",
        "minior-blue-meteor": "minior-blue",
        "minior-violet-meteor": "minior-violet",
        "minior-orange-meteor": "minior-orange",
        "minior-red": "minior",
        "minior-indigo-meteor": "minior-indigo",
        "mimikyu-totem-busted": "mimikyu-busted-totem",
        "mimikyu-totem-disguised": "mimikyu-totem",
        "pikachu-partner-cap": "pikachu-partner",
        "rockruff-own-tempo": "rockruff",
        "ribombee-totem": "ribombee",
        "necrozma-dawn": "necrozma-dawnwings",
        "necrozma-dusk": "necrozma-duskmane",
        "pikachu-world-cap": "pikachu-starter",
        "mr-mime-galar": "mrmime-galar",
        "darmanitan-galar-standard": "darmanitan-galar",
        "darmanitan-galar-zen": "darmanitan-galarzen",
        "toxtricity-low-key": "toxtricity-lowkey",
        "indeedee-female": "indeedee-f",
        "venusaur-gmax": "",
        "urshifu-rapid-strike": "urshifu-rapidstrike",
        "blastoise-gmax": "",
        "rillaboom-gmax": "",
        "cinderace-gmax": "",
        "toxtricity-amped-gmax": "toxtricity-gmax",
        "urshifu-single-strike-gmax": "",
        "urshifu-rapid-strike-gmax": "",
        "toxtricity-low-key-gmax": "toxtricity-gmax",
        "growlithe-hisui": "",
        "arcanine-hisui": "",
        "voltorb-hisui": "",
        "typhlosion-hisui": "",
        "electrode-hisui": "",
        "qwilfish-hisui": "",
        "sneasel-hisui": "",
        "samurott-hisui": "",
        "lilligant-hisui": "",
        "zoroark-hisui": "",
        "braviary-hisui": "",
        "zorua-hisui": "",
        "sliggoo-hisui": "",
        "goodra-hisui": "",
        "avalugg-hisui": "",
        "decidueye-hisui": "",
        "dialga-origin": "",
        "basculin-white-striped": "",
        "basculegion-female": "",
        "enamorus-therian": "",
        "palkia-origin": "",
    },
    "back_shiny": {
        "nidoran-m": "nidoranm",
        "nidoran-f": "nidoranf",
        "mr-mime": "mrmime",
        "ho-oh": "hooh",
        "deoxys-normal": "deoxys",
        "wormadam-plant": "wormadam",
        "mime-jr": "mimejr",
        "giratina-altered": "giratina",
        "shaymin-land": "shaymin",
        "basculin-red-striped": "basculin",
        "darmanitan-standard": "darmanitan",
        "thundurus-incarnate": "thundurus",
        "tornadus-incarnate": "tornadus",
        "keldeo-ordinary": "keldeo",
        "landorus-incarnate": "landorus",
        "meloetta-aria": "meloetta",
        "meowstic-male": "meowstic",
        "aegislash-shield": "aegislash",
        "pumpkaboo-average": "pumpkaboo",
        "gourgeist-average": "gourgeist",
        "zygarde-50": "zygarde",
        "oricorio-baile": "oricorio",
        "lycanroc-midday": "lycanroc",
        "wishiwashi-solo": "wishiwashi",
        "type-null": "typenull",
        "minior-red-meteor": "minior",
        "mimikyu-disguised": "mimikyu",
        "hakamo-o": "hakamoo",
        "kommo-o": "kommoo",
        "tapu-lele": "tapulele",
        "tapu-koko": "tapukoko",
        "tapu-bulu": "tapubulu",
        "jangmo-o": "jangmoo",
        "tapu-fini": "tapufini",
        "toxtricity-amped": "toxtricity",
        "mr-rime": "mrrime",
        "eiscue-ice": "eiscue",
        "indeedee-male": "indeedee",
        "morpeko-full-belly": "morpeko",
        "urshifu-single-strike": "urshifu",
        "kleavor": "",
        "ursaluna": "",
        "wyrdeer": "",
        "sneasler": "",
        "overqwil": "",
        "enamorus-incarnate": "",
        "basculegion-male": "",
        "basculin-blue-striped": "basculin-bluestriped",
        "meowstic-female": "meowstic-f",
        "charizard-mega-y": "charizard-megay",
        "charizard-mega-x": "charizard-megax",
        "mewtwo-mega-y": "mewtwo-megay",
        "mewtwo-mega-x": "mewtwo-megax",
        "pikachu-rock-star": "pikachu-rockstar",
        "raticate-totem-alola": "raticate-alola-totem",
        "pikachu-pop-star": "pikachu-popstar",
        "pikachu-libre": "",
        "pikachu-original-cap": "pikachu-kantocap",
        "pikachu-sinnoh-cap": "pikachu-sinnohcap",
        "pikachu-unova-cap": "pikachu-unovacap",
        "pikachu-kalos-cap": "pikachu-kaloscap",
        "pikachu-hoenn-cap": "pikachu-hoenncap",
        "pikachu-alola-cap": "pikachu-alolacap",
        "eevee-starter": "",
        "pikachu-starter": "pikachu-kantocap",
        "greninja-battle-bond": "greninja-ash",
        "zygarde-10-power-construct": "zygarde-10",
        "zygarde-50-power-construct": "zygarde",
        "oricorio-pom-pom": "oricorio-pompom",
        "minior-yellow-meteor": "minior-yellow",
        "minior-green-meteor": "minior-green",
        "minior-blue-meteor": "minior-blue",
        "minior-violet-meteor": "minior-violet",
        "minior-orange-meteor": "minior-orange",
        "minior-red": "minior",
        "minior-indigo-meteor": "minior-indigo",
        "mimikyu-totem-busted": "mimikyu-busted-totem",
        "mimikyu-totem-disguised": "mimikyu-totem",
        "pikachu-partner-cap": "pikachu-partner",
        "rockruff-own-tempo": "rockruff",
        "ribombee-totem": "ribombee",
        "necrozma-dawn": "necrozma-dawnwings",
        "necrozma-dusk": "necrozma-duskmane",
        "pikachu-world-cap": "pikachu-kantocap",
        "mr-mime-galar": "mrmime-galar",
        "inteleon-gmax": "",
        "marowak-total": "marowak-alola-totem",
        "darmanitan-galar-standard": "darmanitan-galar",
        "darmanitan-galar-zen": "darmanitan-galarzen",
        "toxtricity-low-key": "toxtricity-lowkey",
        "indeedee-female": "indeedee-f",
        "venusaur-gmax": "",
        "urshifu-rapid-strike": "urshifu-rapidstrike",
        "blastoise-gmax": "",
        "rillaboom-gmax": "",
        "cinderace-gmax": "",
        "toxtricity-amped-gmax": "toxtricity-gmax",
        "urshifu-single-strike-gmax": "",
        "urshifu-rapid-strike-gmax": "",
        "toxtricity-low-key-gmax": "toxtricity-gmax",
        "growlithe-hisui": "",
        "arcanine-hisui": "",
        "voltorb-hisui": "",
        "typhlosion-hisui": "",
        "electrode-hisui": "",
        "qwilfish-hisui": "",
        "sneasel-hisui": "",
        "samurott-hisui": "",
        "lilligant-hisui": "",
        "zoroark-hisui": "",
        "braviary-hisui": "",
        "zorua-hisui": "",
        "sliggoo-hisui": "",
        "goodra-hisui": "",
        "avalugg-hisui": "",
        "decidueye-hisui": "",
        "dialga-origin": "",
        "basculin-white-striped": "",
        "basculegion-female": "",
        "enamorus-therian": "",
        "palkia-origin": "",
    },
}


@attrs.define(kw_only=True, slots=True)
class ShowdownSprites(BaseModel):
    """Showdown sprites.

    Attributes
    ----------
    back_default: str
        The default back sprite.
    front_default: str
        The default front sprite.
    back_shiny: str
        The shiny back sprite.
    front_shiny: str
        The shiny front sprite.
    """

    front_default: str = attrs.field(factory=str)
    front_shiny: str = attrs.field(factory=str)
    back_default: str = attrs.field(factory=str)
    back_shiny: str = attrs.field(factory=str)

    @classmethod
    def from_name(cls, name: str) -> "ShowdownSprites":
        return cls(
            front_default=PATH.format(path=f"ani/{name}.gif")
            if (name := SPRITES["front_default"].get(name, name))
            else "",
            front_shiny=PATH.format(path=f"ani-shiny/{name}.gif")
            if (name := SPRITES["front_shiny"].get(name, name))
            else "",
            back_default=PATH.format(path=f"ani-back/{name}.gif")
            if (name := SPRITES["back_default"].get(name, name))
            else "",
            back_shiny=PATH.format(path=f"ani-back-shiny/{name}.gif")
            if (name := SPRITES["back_shiny"].get(name, name))
            else "",
        )
