const localizeOrFallback = (key, fallback) => globalThis.game?.i18n?.localize?.(key) ?? fallback

export const MOURNBLADECYD2_CONFIG = {
  attributs: {
    adr: "Adresse",
    pui: "Puissance",
    cla: "Clairvoyance",
    pre: "Présence",
    tre: "Trempe"
  },
  allegeanceOptions: {
    tous: localizeOrFallback("MNBL.all", "Tous"),
    chaos: localizeOrFallback("MNBL.chaos", "Chaos"),
    loi: localizeOrFallback("MNBL.law", "Loi"),
    balance: localizeOrFallback("MNBL.balance", "Balance"),
    betes: localizeOrFallback("MNBL.betes", "Bêtes"),
    elementaires: localizeOrFallback("MNBL.elementaires", "Élémentaires")
  },
  lancementRuneOptions: {
    prononcer: localizeOrFallback("MNBL.pronouncerune", "Prononcer"),
    inscrire: localizeOrFallback("MNBL.tracerune", "Tracer")
  },
  effetRuneOptions: {
    prononcee: localizeOrFallback("MNBL.pronounced", "Prononcée"),
    inscrite: localizeOrFallback("MNBL.traced", "Tracée")
  },

  optionsDifficulte: [
    { key: "0", label: "Aucune/Inconnue" },
    { key: "5", label: "Facile (5)" },
    { key: "6", label: "(6)" },
    { key: "7", label: "(7)" },
    { key: "8", label: "(8)" },
    { key: "9", label: "(9)" },
    { key: "10", label: "Moyenne (10)" },
    { key: "11", label: "(11)" },
    { key: "12", label: "(12)" },
    { key: "13", label: "(13)" },
    { key: "14", label: "(14)" },
    { key: "15", label: "Ardue (15)" },
    { key: "16", label: "(16)" },
    { key: "17", label: "(17)" },
    { key: "18", label: "(18)" },
    { key: "19", label: "(19)" },
    { key: "20", label: "Hasardeuse (20)" },
    { key: "21", label: "(21)" },
    { key: "22", label: "(22)" },
    { key: "23", label: "(23)" },
    { key: "24", label: "(24)" },
    { key: "25", label: "Insensée (25)" },
    { key: "26", label: "(26)" },
    { key: "27", label: "(27)" },
    { key: "28", label: "(28)" },
    { key: "29", label: "(29)" },
    { key: "30", label: "Pure Folie (30)" }
  ],
  optionsDistanceTir: [
    { key: "porteecourte", label: "Courte (base +5)" },
    { key: "porteemoyenne", label: "Moyenne (base +9)" },
    { key: "porteelongue", label: "Longue (base +14)" }
  ],
  optionsBonusMalus: [
    { key: "-10", label: "-10" },
    { key: "-9", label: "-9" },
    { key: "-8", label: "-8" },
    { key: "-7", label: "-7" },
    { key: "-6", label: "-6" },
    { key: "-5", label: "-5" },
    { key: "-4", label: "-4" },
    { key: "-3", label: "-3" },
    { key: "-2", label: "-2" },
    { key: "-1", label: "-1" },
    { key: "0", label: "0" },
    { key: "1", label: "+1" },
    { key: "2", label: "+2" },
    { key: "3", label: "+3" },
    { key: "4", label: "+4" },
    { key: "5", label: "+5" },
    { key: "6", label: "+6" },
    { key: "7", label: "+7" },
    { key: "8", label: "+8" },
    { key: "9", label: "+9" },
    { key: "10", label: "+10" }
  ],
  optionsTailleCible: [
    { key: "normal", label: "Normal (SD+0)" },
    { key: "main", label: "Main (SD+10)" },
    { key: "enfant", label: "Enfant (SD+3)" },
    { key: "maison", label: "Maison (SD-10)" }
  ],
  optionsCouvert: [
    { key: "aucun", label: "Aucun" },
    { key: "leger", label: "Léger (SD+5)" },
    { key: "complet", label: "Quasi complet (SD+10)" }
  ],
  optionsTireurDeplacement: [
    { key: "immobile", label: "Immobile (SD+0)" },
    { key: "lent", label: "Lent (SD+3)" },
    { key: "rapide", label: "Rapide (SD+5)" }
  ],
  optionsSoutiens: [
    { key: "0", label: "Aucun" },
    { key: "1", label: "Un soutien (+3)" },
    { key: "2", label: "Deux soutiens (+4)" },
    { key: "3", label: "Trois soutiens (+5)" }
  ],
  optionsStatutResistant: [
    { key: "commun", label: "Commun" },
    { key: "clandestin", label: "Clandestin" },
    { key: "insurge", label: "Insurgé" }
  ],
  optionsTypeArme: [
    { key: "contact", label: "Arme de contact" },
    { key: "contactjet", label: "Arme de contact et de Jet" },
    { key: "jet", label: "Arme de Jet" },
    { key: "tir", label: "Arme de Tir" }
  ],
  optionsTypeTalent: [
    { key: "personnage", label: "Personnage" },
    { key: "traitespece", label: "Trait d'espèce" }
  ],

  // Configuration des ActiveEffects
  effectTypes: {
    bonus: "Bonus",
    malus: "Malus",
    rune: "Effet de Rune",
    don: "Effet de Don",
    talent: "Effet de Talent",
    trait: "Effet de Trait",
    temporaire: "Effet Temporaire",
    permanent: "Effet Permanent"
  },

  // Clés des attributs pour les modifications d'effets
  effectAttributeKeys: {
    // Attributs
    adr: "system.attributs.adr.value",
    pui: "system.attributs.pui.value",
    cla: "system.attributs.cla.value",
    pre: "system.attributs.pre.value",
    tre: "system.attributs.tre.value",
    
    // Santé
    vigueur: "system.sante.vigueur",
    etat: "system.sante.etat",
    nbcombativite: "system.sante.nbcombativite",
    
    // Âme
    nbame: "system.ame.nbame",
    seuilpouvoir: "system.ame.seuilpouvoir",
    etatAme: "system.ame.etat",
    
    // Bonne Aventure
    bonneaventure: "system.bonneaventure.base",
    bonneaventureActuelle: "system.bonneaventure.actuelle",
    eclat: "system.eclat.value",
    
    // Combat
    initiative: "system.combat.inittotal",
    defense: "system.combat.defensetotal",
    protection: "system.combat.protectiontotal",
    
    // Adversités
    adversiteBleue: "system.adversite.bleue",
    adversiteRouge: "system.adversite.rouge",
    adversiteNoire: "system.adversite.noire",
    
    // Balance
    loi: "system.balance.loi",
    chaos: "system.balance.chaos",
    aspect: "system.balance.aspect",
    
    // Ressources
    ressources: "system.ressources.value",
    
    // Vitesse
    vitesse: "system.vitesse.value"
  },

  // Types de bonus/malus supportés (groupés par catégorie)
  effectTypesConfig: {
    attribut: {
      label: "Attribut",
      keys: ["adr", "pui", "cla", "pre", "tre"]
    },
    sante: {
      label: "Santé",
      keys: ["vigueur", "etat", "nbcombativite"]
    },
    ame: {
      label: "Âme",
      keys: ["nbame", "seuilpouvoir", "etatAme"]
    },
    combat: {
      label: "Combat",
      keys: ["initiative", "defense", "protection"]
    },
    bonneAventure: {
      label: "Bonne Aventure",
      keys: ["bonneaventure", "bonneaventureActuelle", "eclat"]
    },
    adversite: {
      label: "Adversité",
      keys: ["adversiteBleue", "adversiteRouge", "adversiteNoire"]
    },
    balance: {
      label: "Balance",
      keys: ["loi", "chaos", "aspect"]
    }
  },
  optionsUseTalent: [
    { key: "permanent", label: "Permanent" },
    { key: "sceance", label: "Une fois par séance" },
    { key: "scenario", label: "Une fois par scénario" },
    { key: "jour", label: "Une fois par jour" },
    { key: "unique", label: "Unique" }
  ],
  optionsAutomationEvent: [
    { key: "on-drop", label: "Drop sur l'acteur" },
    { key: "prepare-roll", label: "Préparation d'un jet" },
    { key: "bonus-permanent", label: "Bonus permanent" }
  ],
  optionsBonusPermanent: [
    { key: "vigueur", label: "Vigueur" },
    { key: "seuilpouvoir", label: "Seuil de Pouvoir" },
    { key: "bonus-defensif", label: "Bonus au Seuil de Défense" }
  ],
  etatsCombativite: [
    { key: 0, label: "Combatif" },
    { key: 1, label: "Éprouvé 1" },
    { key: 2, label: "Éprouvé 2" },
    { key: 3, label: "Affaibli" },
    { key: 4, label: "Très Affaibli" },
    { key: 5, label: "Vaincu" }
  ],
  etatsAme: [
    { key: 0, label: "Serein" },
    { key: 1, label: "Stressé 1" },
    { key: 2, label: "Stressé 2" },
    { key: 3, label: "Stressé 3" },
    { key: 4, label: "Stressé 4" },
    { key: 5, label: "Traumatisé" },
    { key: 6, label: "Très Traumatisé" },
    { key: 7, label: "Brisé" }
  ]
}