import POGOProtos from 'pogo-protos';

export const formatDexNumber = (dex : number) => {
    let prefix : string = '';
    if (dex < 100) {
        prefix += '0';
    }
    if (dex < 10) {
        prefix += '0';
    }
    return prefix + dex;
};

export const formatType = (type : POGOProtos.Enums.PokemonType) => {
    switch (type) {
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_NORMAL:
            return 'normal';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_FIGHTING:
            return 'fighting';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_FLYING:
            return 'flying';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_POISON:
            return 'poison';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_GROUND:
            return 'ground';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_ROCK:
            return 'rock';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_BUG:
            return 'bug';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_GHOST:
            return 'ghost';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_STEEL:
            return 'steel';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_FIRE:
            return 'fire';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_WATER:
            return 'water';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_GRASS:
            return 'grass';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_ELECTRIC:
            return 'electric';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_PSYCHIC:
            return 'psychic';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_ICE:
            return 'ice';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_DRAGON:
            return 'dragon';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_DARK:
            return 'dark';
        case POGOProtos.Enums.PokemonType.POKEMON_TYPE_FAIRY:
            return 'fairy';
        default:
            return '';
    }
};

export const Forms = {
    normal: [
        POGOProtos.Enums.Form.CASTFORM_NORMAL,
        POGOProtos.Enums.Form.DEOXYS_NORMAL,
        POGOProtos.Enums.Form.RATTATA_NORMAL,
        POGOProtos.Enums.Form.RATICATE_NORMAL,
        POGOProtos.Enums.Form.RAICHU_NORMAL,
        POGOProtos.Enums.Form.SANDSHREW_NORMAL,
        POGOProtos.Enums.Form.SANDSLASH_NORMAL,
        POGOProtos.Enums.Form.VULPIX_NORMAL,
        POGOProtos.Enums.Form.NINETALES_NORMAL,
        POGOProtos.Enums.Form.DIGLETT_NORMAL,
        POGOProtos.Enums.Form.DUGTRIO_NORMAL,
        POGOProtos.Enums.Form.MEOWTH_NORMAL,
        POGOProtos.Enums.Form.PERSIAN_NORMAL,
        POGOProtos.Enums.Form.GEODUDE_NORMAL,
        POGOProtos.Enums.Form.GRAVELER_NORMAL,
        POGOProtos.Enums.Form.GOLEM_NORMAL,
        POGOProtos.Enums.Form.GRIMER_NORMAL,
        POGOProtos.Enums.Form.MUK_NORMAL,
        POGOProtos.Enums.Form.EXEGGUTOR_NORMAL,
        POGOProtos.Enums.Form.MAROWAK_NORMAL,
        POGOProtos.Enums.Form.ROTOM_NORMAL,
        POGOProtos.Enums.Form.ARCEUS_NORMAL,
    ],
    alola: [
        POGOProtos.Enums.Form.RATTATA_ALOLA,
        POGOProtos.Enums.Form.RATICATE_ALOLA,
        POGOProtos.Enums.Form.RAICHU_ALOLA,
        POGOProtos.Enums.Form.SANDSHREW_ALOLA,
        POGOProtos.Enums.Form.SANDSLASH_ALOLA,
        POGOProtos.Enums.Form.VULPIX_ALOLA,
        POGOProtos.Enums.Form.NINETALES_ALOLA,
        POGOProtos.Enums.Form.DIGLETT_ALOLA,
        POGOProtos.Enums.Form.DUGTRIO_ALOLA,
        POGOProtos.Enums.Form.MEOWTH_ALOLA,
        POGOProtos.Enums.Form.PERSIAN_ALOLA,
        POGOProtos.Enums.Form.GEODUDE_ALOLA,
        POGOProtos.Enums.Form.GRAVELER_ALOLA,
        POGOProtos.Enums.Form.GOLEM_ALOLA,
        POGOProtos.Enums.Form.GRIMER_ALOLA,
        POGOProtos.Enums.Form.MUK_ALOLA,
        POGOProtos.Enums.Form.EXEGGUTOR_ALOLA,
        POGOProtos.Enums.Form.MAROWAK_ALOLA,
    ],
    plant: [
        POGOProtos.Enums.Form.WORMADAM_PLANT,
        POGOProtos.Enums.Form.BURMY_PLANT,
    ],
    sandy: [
        POGOProtos.Enums.Form.WORMADAM_SANDY,
        POGOProtos.Enums.Form.BURMY_SANDY,
    ],
    trash: [
        POGOProtos.Enums.Form.WORMADAM_TRASH,
        POGOProtos.Enums.Form.BURMY_TRASH,
    ],
    westSea: [
        POGOProtos.Enums.Form.SHELLOS_WEST_SEA,
        POGOProtos.Enums.Form.GASTRODON_WEST_SEA,
    ],
    eastSea: [
        POGOProtos.Enums.Form.SHELLOS_EAST_SEA,
        POGOProtos.Enums.Form.GASTRODON_EAST_SEA,
    ],
    altered: [
        POGOProtos.Enums.Form.GIRATINA_ALTERED,
    ],
    origin: [
        POGOProtos.Enums.Form.GIRATINA_ORIGIN,
    ],
    frost: [
        POGOProtos.Enums.Form.ROTOM_FROST,
    ],
    fan: [
        POGOProtos.Enums.Form.ROTOM_FAN,
    ],
    mow: [
        POGOProtos.Enums.Form.ROTOM_MOW,
    ],
    wash: [
        POGOProtos.Enums.Form.ROTOM_WASH,
    ],
    heat: [
        POGOProtos.Enums.Form.ROTOM_HEAT,
    ],
    sky: [
        POGOProtos.Enums.Form.SHAYMIN_SKY,
    ],
    land: [
        POGOProtos.Enums.Form.SHAYMIN_LAND,
    ],
    overcast: [
        POGOProtos.Enums.Form.CHERRIM_OVERCAST,
    ],
    sunny: [
        POGOProtos.Enums.Form.CASTFORM_SUNNY,
        POGOProtos.Enums.Form.CHERRIM_SUNNY,
    ],
    rainy: [
        POGOProtos.Enums.Form.CASTFORM_RAINY,
    ],
    snowy: [
        POGOProtos.Enums.Form.CASTFORM_SNOWY,
    ],
    attack: [
        POGOProtos.Enums.Form.DEOXYS_ATTACK,
    ],
    defense: [
        POGOProtos.Enums.Form.DEOXYS_DEFENSE,
    ],
    speed: [
        POGOProtos.Enums.Form.DEOXYS_SPEED,
    ],
    fighting: [
        POGOProtos.Enums.Form.ARCEUS_FIGHTING,
    ],
    flying: [
        POGOProtos.Enums.Form.ARCEUS_FLYING,
    ],
    poison: [
        POGOProtos.Enums.Form.ARCEUS_POISON,
    ],
    ground: [
        POGOProtos.Enums.Form.ARCEUS_GROUND,
    ],
    rock: [
        POGOProtos.Enums.Form.ARCEUS_ROCK,
    ],
    bug: [
        POGOProtos.Enums.Form.ARCEUS_BUG,
    ],
    ghost: [
        POGOProtos.Enums.Form.ARCEUS_GHOST,
    ],
    steel: [
        POGOProtos.Enums.Form.ARCEUS_STEEL,
    ],
    fire: [
        POGOProtos.Enums.Form.ARCEUS_FIRE,
    ],
    water: [
        POGOProtos.Enums.Form.ARCEUS_WATER,
    ],
    grass: [
        POGOProtos.Enums.Form.ARCEUS_GRASS,
    ],
    electric: [
        POGOProtos.Enums.Form.ARCEUS_ELECTRIC,
    ],
    psychic: [
        POGOProtos.Enums.Form.ARCEUS_PSYCHIC,
    ],
    ice: [
        POGOProtos.Enums.Form.ARCEUS_ICE,
    ],
    dragon: [
        POGOProtos.Enums.Form.ARCEUS_DRAGON,
    ],
    dark: [
        POGOProtos.Enums.Form.ARCEUS_DARK,
    ],
    fairy: [
        POGOProtos.Enums.Form.ARCEUS_FAIRY,
    ],
};

export const formatForm = (form : POGOProtos.Enums.Form) => {
    if (Forms.normal.indexOf(form) > -1) {
        return 'Normal';
    } else if (Forms.alola.indexOf(form) > -1) {
        return 'Alola';
    } else if (Forms.plant.indexOf(form) > -1) {
        return 'Plant';
    } else if (Forms.sandy.indexOf(form) > -1) {
        return 'Sandy';
    } else if (Forms.trash.indexOf(form) > -1) {
        return 'Trash';
    } else if (Forms.westSea.indexOf(form) > -1) {
        return 'West Sea';
    } else if (Forms.eastSea.indexOf(form) > -1) {
        return 'East Sea';
    } else if (Forms.frost.indexOf(form) > -1) {
        return 'Frost';
    } else if (Forms.fan.indexOf(form) > -1) {
        return 'Fan';
    } else if (Forms.mow.indexOf(form) > -1) {
        return 'Mow';
    } else if (Forms.wash.indexOf(form) > -1) {
        return 'Wash';
    } else if (Forms.heat.indexOf(form) > -1) {
        return 'Heat';
    } else if (Forms.sky.indexOf(form) > -1) {
        return 'Sky';
    } else if (Forms.land.indexOf(form) > -1) {
        return 'Land';
    } else if (Forms.overcast.indexOf(form) > -1) {
        return 'Overcast';
    } else if (Forms.sunny.indexOf(form) > -1) {
        return 'Sunny';
    } else if (Forms.rainy.indexOf(form) > -1) {
        return 'Rainy';
    } else if (Forms.snowy.indexOf(form) > -1) {
        return 'Snowy';
    } else if (Forms.attack.indexOf(form) > -1) {
        return 'Attack';
    } else if (Forms.defense.indexOf(form) > -1) {
        return 'Defense';
    } else if (Forms.speed.indexOf(form) > -1) {
        return 'Speed';
    } else if (Forms.altered.indexOf(form) > -1) {
        return 'Altered';
    } else if (Forms.origin.indexOf(form) > -1) {
        return 'Origin';
    } else if (Forms.fighting.indexOf(form) > -1) {
        return 'Fighting';
    } else if (Forms.flying.indexOf(form) > -1) {
        return 'Flying';
    } else if (Forms.poison.indexOf(form) > -1) {
        return 'Poison';
    } else if (Forms.ground.indexOf(form) > -1) {
        return 'Fround';
    } else if (Forms.rock.indexOf(form) > -1) {
        return 'Rock';
    } else if (Forms.bug.indexOf(form) > -1) {
        return 'Bug';
    } else if (Forms.ghost.indexOf(form) > -1) {
        return 'Ghost';
    } else if (Forms.steel.indexOf(form) > -1) {
        return 'Steel';
    } else if (Forms.fire.indexOf(form) > -1) {
        return 'Fire';
    } else if (Forms.water.indexOf(form) > -1) {
        return 'Water';
    } else if (Forms.grass.indexOf(form) > -1) {
        return 'Grass';
    } else if (Forms.electric.indexOf(form) > -1) {
        return 'Electric';
    } else if (Forms.psychic.indexOf(form) > -1) {
        return 'Psychic';
    } else if (Forms.ice.indexOf(form) > -1) {
        return 'Ice';
    } else if (Forms.dragon.indexOf(form) > -1) {
        return 'Dragon';
    } else if (Forms.dark.indexOf(form) > -1) {
        return 'Dark';
    } else if (Forms.fairy.indexOf(form) > -1) {
        return 'Fairy';
    } else  {
        return '';
    }
};
