export class LiturgyData {

    static ranks = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII"]

    static #ranks = [
        {index: 0, name: "O", lkp: 3, mod: 2, costKaP: 2, costKaPPermant: 0, duration: "{*} KR", strength: "{*}/2"},
        {index: 1, name: "I", lkp: 3, mod: 0, costKaP: 5, costKaPPermant: 0, duration: "{*} KR", strength: "{*}/2"},
        {
            index: 2,
            name: "II",
            lkp: 6,
            mod: -2,
            costKaP: 10,
            costKaPPermant: 0,
            duration: "{*}*10 KR",
            strength: "{*}/2+5"
        },
        {index: 3, name: "III", lkp: 9, mod: -4, costKaP: 15, costKaPPermant: 0, duration: "{*} SR", strength: "{*}+5"},
        {
            index: 4,
            name: "IV",
            lkp: 12,
            mod: -6,
            costKaP: 20,
            costKaPPermant: 0,
            duration: "{*} Stunden",
            strength: "{*}+10"
        },
        {
            index: 5,
            name: "V",
            lkp: 15,
            mod: -8,
            costKaP: 25,
            costKaPPermant: 1,
            duration: "{*} Tage",
            strength: "{*}+15"
        },
        {
            index: 6,
            name: "VI",
            lkp: 18,
            mod: -10,
            costKaP: 30,
            costKaPPermant: 3,
            duration: "{*} Wochen",
            strength: "{*}+20"
        },
        {
            index: 7,
            name: "VII",
            lkp: 21,
            mod: -12,
            costKaP: 35,
            costKaPPermant: 5,
            duration: "{*} Monate",
            strength: "{*}+25"
        },
        {
            index: 8,
            name: "VIII",
            lkp: 24,
            mod: -14,
            costKaP: 40,
            costKaPPermant: 7,
            duration: "{*} Jahre oder permanent",
            casttime: "",
            strength: "{*}+30"
        },
    ];

    static alverans = [
        "Praios",
        "Rondra",
        "Efferd",
        "Travia",
        "Boron",
        "Hesinde",
        "Firun",
        "Tsa",
        "Phex",
        "Peraine",
        "Ingerimm",
        "Rahja"
    ]

    static #aliases = [
        {
            "originalName": "Handwerkssegen",
            "aliases": ["Cereborns Handreichung", "Hauch der Leidenschaft"]
        },
        {
            "originalName": "Heiliger Befehl",
            "aliases": ["Wort der Wahrheit"],
        },
        {
            "originalName": "Eidsegen",
            "aliases": ["Lehnseid"],
        }
    ]

    static getRankOfLiturgy(liturgy, deity) {
        const lookupData = liturgy.herkunft.find(p => p.name === deity)
        const rank = lookupData?.grad;
        return LiturgyData.#ranks[rank];
    }

    static lookupAlias(alias) {
        return LiturgyData.#aliases.find((entry) => {
            console.log(alias, entry.aliases.indexOf(alias) !== -1)
            return entry.aliases.indexOf(alias) !== -1
        })?.originalName ?? alias; // cant determine thus simply return the original query name
    }

}
