import { Spec, _Class, Class } from "./Types"

export type SpecT = {
    Warrior : 'Arms' | 'Fury' | 'Protection'
    Rogue: 'Subtlety' | 'Combat' | 'Assassination'
    Hunter: 'Beast Mastery' | 'Marksmanship' | 'Survival'
    Paladin: 'Holy' | 'Protection' | 'Retribution'
    Priest: 'Discipline' | 'Holy' | 'Shadow'
    Druid: 'Feral (Tank)' | 'Feral (DPS)' | 'Restoration' | 'Balance'
    Mage: 'Frost' | 'Arcane' | 'Fire'
    Warlock: 'Demonology' | 'Destruction' | 'Affliction'
    Shaman: 'Restoration' | 'Enhancement' | 'Elemental'
}

export const specs : { [classname in keyof SpecT] : SpecT[classname][] } = {
    Warrior : [
        'Arms',
        'Fury',
        'Protection'
    ],

    Rogue: [
        'Subtlety',
        'Combat',
        'Assassination'
    ],

    Hunter: [
        'Beast Mastery',
        'Marksmanship',
        'Survival'
    ],

    Paladin: [
        'Holy',
        'Protection',
        'Retribution'
    ],

    Priest: [
        'Discipline',
        'Holy',
        'Shadow'
    ],

    Druid: [
        'Feral (Tank)',
        'Feral (DPS)',
        'Restoration',
        'Balance'
    ],

    Mage: [
        'Frost',
        'Arcane',
        'Fire'
    ],

    Warlock: [
        'Demonology',
        'Destruction',
        'Affliction'
    ],

    Shaman: [
        'Restoration',
        'Enhancement',
        'Elemental'
    ],
}

export function getSpecTableData() : Spec[]{
    return _Class.flatMap((_class) => {
        const specNames : string[] = specs[_class]
        return specNames.map(specName => {
            return {
                specname: specName,
                class: _class
            }
        })
    })
}

export function getClassColor(c: Class) : string{
    switch(c){
        case "Warrior": return "#C79C6E"
        case "Warlock": return "#8787ED"
        case "Shaman": return "#0070DE"
        case "Rogue": return "#FFF569"
        case "Priest": return "#FFFFFF"
        case "Paladin": return "#F58CBA"
        case "Mage": return "#40C7EB"
        case "Druid": return "#FF7D0A"
        case "Hunter": return "#A9D271"
    }
}