export const SYSTEM_ID = "fvtt-celestopol"

export const ASCII = `
 ░█▀▀░█▀▀░█░░░█▀▀░█▀▀░▀█▀░█▀█░█▀█░█▀█░█░░
 ░█░░░█▀▀░█░░░█▀▀░▀▀█░░█░░█░█░█▀▀░█░█░█░░
 ░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀▀▀░░▀░░▀▀▀░▀░░░▀▀▀░▀▀▀
 ░░░░░░░░░░░░░░░░░░1922░░░░░░░░░░░░░░░░░░░
`

/** Les 4 attributs principaux (stats). Chacun a une résistance (res) et 4 domaines. */
export const STATS = {
  ame:    { id: "ame",    label: "CELESTOPOL.Stat.ame" },
  corps:  { id: "corps",  label: "CELESTOPOL.Stat.corps" },
  coeur:  { id: "coeur",  label: "CELESTOPOL.Stat.coeur" },
  esprit: { id: "esprit", label: "CELESTOPOL.Stat.esprit" },
}

/** Domaines groupées par attribut. */
export const SKILLS = {
  ame: {
    artifice:   { id: "artifice",   label: "CELESTOPOL.Skill.artifice",   stat: "ame" },
    attraction: { id: "attraction", label: "CELESTOPOL.Skill.attraction", stat: "ame" },
    coercition: { id: "coercition", label: "CELESTOPOL.Skill.coercition", stat: "ame" },
    faveur:     { id: "faveur",     label: "CELESTOPOL.Skill.faveur",     stat: "ame" },
  },
  corps: {
    echauffouree: { id: "echauffouree", label: "CELESTOPOL.Skill.echauffouree", stat: "corps" },
    effacement:   { id: "effacement",   label: "CELESTOPOL.Skill.effacement",   stat: "corps" },
    mobilite:     { id: "mobilite",     label: "CELESTOPOL.Skill.mobilite",     stat: "corps" },
    prouesse:     { id: "prouesse",     label: "CELESTOPOL.Skill.prouesse",     stat: "corps" },
  },
  coeur: {
    appreciation: { id: "appreciation", label: "CELESTOPOL.Skill.appreciation", stat: "coeur" },
    arts:         { id: "arts",         label: "CELESTOPOL.Skill.arts",         stat: "coeur" },
    inspiration:  { id: "inspiration",  label: "CELESTOPOL.Skill.inspiration",  stat: "coeur" },
    traque:       { id: "traque",       label: "CELESTOPOL.Skill.traque",       stat: "coeur" },
  },
  esprit: {
    instruction:    { id: "instruction",    label: "CELESTOPOL.Skill.instruction",    stat: "esprit" },
    mtechnologique: { id: "mtechnologique", label: "CELESTOPOL.Skill.mtechnologique", stat: "esprit" },
    raisonnement:   { id: "raisonnement",   label: "CELESTOPOL.Skill.raisonnement",   stat: "esprit" },
    traitement:     { id: "traitement",     label: "CELESTOPOL.Skill.traitement",     stat: "esprit" },
  },
}

/** Liste plate de tous les domaines (utile pour les DataModels d'items). */
export const ALL_SKILLS = Object.values(SKILLS).flatMap(group => Object.values(group))

/** Types d'anomalies (pouvoirs paranormaux). */
export const ANOMALY_TYPES = {
  none:                     { id: "none",                     label: "CELESTOPOL.Anomaly.none" },
  entropie:                 { id: "entropie",                 label: "CELESTOPOL.Anomaly.entropie" },
  communicationaveclesmorts:{ id: "communicationaveclesmorts",label: "CELESTOPOL.Anomaly.communicationaveclesmorts" },
  illusion:                 { id: "illusion",                 label: "CELESTOPOL.Anomaly.illusion" },
  suggestion:               { id: "suggestion",               label: "CELESTOPOL.Anomaly.suggestion" },
  tarotdivinatoire:         { id: "tarotdivinatoire",         label: "CELESTOPOL.Anomaly.tarotdivinatoire" },
  telekinesie:              { id: "telekinesie",              label: "CELESTOPOL.Anomaly.telekinesie" },
  telepathie:               { id: "telepathie",               label: "CELESTOPOL.Anomaly.telepathie" },
  voyageastral:             { id: "voyageastral",             label: "CELESTOPOL.Anomaly.voyageastral" },
}

/**
 * Définitions des anomalies : compétences applicables pour l'usage Technique.
 * "lune" est une clé spéciale désignant le dé de lune (Entropie).
 * Les autres clés correspondent aux identifiants de domaine dans SKILLS.
 */
export const ANOMALY_DEFINITIONS = {
  none:                     { technicalSkills: [] },
  entropie:                 { technicalSkills: ["lune"] },
  communicationaveclesmorts:{ technicalSkills: ["instruction", "mtechnologique", "raisonnement", "traitement"] },
  telekinesie:              { technicalSkills: ["echauffouree", "effacement", "mobilite", "prouesse"] },
  telepathie:               { technicalSkills: ["appreciation", "attraction", "echauffouree", "faveur"] },
  tarotdivinatoire:         { technicalSkills: ["appreciation", "arts", "inspiration", "traque"] },
  illusion:                 { technicalSkills: ["coercition", "echauffouree", "effacement", "traque"] },
  suggestion:               { technicalSkills: ["artifice", "attraction", "coercition", "faveur"] },
  voyageastral:             { technicalSkills: ["appreciation", "mtechnologique", "traitement", "traque"] },
}

/** Factions du monde de Célestopol. */
export const FACTIONS = {
  pinkerton:   { id: "pinkerton",   label: "CELESTOPOL.Faction.pinkerton" },
  police:      { id: "police",      label: "CELESTOPOL.Faction.police" },
  okhrana:     { id: "okhrana",     label: "CELESTOPOL.Faction.okhrana" },
  lunanovatek: { id: "lunanovatek", label: "CELESTOPOL.Faction.lunanovatek" },
  oto:         { id: "oto",         label: "CELESTOPOL.Faction.oto" },
  syndicats:   { id: "syndicats",   label: "CELESTOPOL.Faction.syndicats" },
  vorovskoymir:{ id: "vorovskoymir",label: "CELESTOPOL.Faction.vorovskoymir" },
  cour:        { id: "cour",        label: "CELESTOPOL.Faction.cour" },
}

/** Niveaux de blessures avec leur malus associé. */
export const WOUND_LEVELS = [
  { id: 0, label: "CELESTOPOL.Wound.none",        malus: 0 },
  { id: 1, label: "CELESTOPOL.Wound.anodin",      malus: 0 },
  { id: 2, label: "CELESTOPOL.Wound.derisoire",   malus: 0 },
  { id: 3, label: "CELESTOPOL.Wound.negligeable", malus: -1 },
  { id: 4, label: "CELESTOPOL.Wound.superficiel", malus: -1 },
  { id: 5, label: "CELESTOPOL.Wound.leger",       malus: -2 },
  { id: 6, label: "CELESTOPOL.Wound.modere",      malus: -2 },
  { id: 7, label: "CELESTOPOL.Wound.grave",       malus: -3 },
  { id: 8, label: "CELESTOPOL.Wound.dramatique",  malus: -999 },
]

/** Seuils de difficulté pour les jets de dés. */
export const DIFFICULTY_CHOICES = {
  unknown: { id: "unknown", label: "CELESTOPOL.Difficulty.unknown", value: 0 },
  facile:  { id: "facile",  label: "CELESTOPOL.Difficulty.facile",  value: 5 },
  normal:  { id: "normal",  label: "CELESTOPOL.Difficulty.normal",  value: 7 },
  difficile:{ id: "difficile", label: "CELESTOPOL.Difficulty.difficile", value: 9 },
  ardu:    { id: "ardu",    label: "CELESTOPOL.Difficulty.ardu",    value: 11 },
  extreme: { id: "extreme", label: "CELESTOPOL.Difficulty.extreme", value: 13 },
}

/** Phases de la lune (dé de lune d8). Index 1-8 = résultat du dé. */
export const MOON_DIE_FACES = [
  null, // index 0 non utilisé
  { phase: "nouvellelune",     label: "CELESTOPOL.Moon.nouvellelune",     result: "triomphe",    symbol: "🌑" },
  { phase: "premiercroissant", label: "CELESTOPOL.Moon.premiercroissant", result: "triomphe",    symbol: "🌒" },
  { phase: "premierquartier",  label: "CELESTOPOL.Moon.premierquartier",  result: "brio",        symbol: "🌓" },
  { phase: "lunegibbeuse",     label: "CELESTOPOL.Moon.lunegibbeuse",     result: "brio",        symbol: "🌔" },
  { phase: "lunevoutee",       label: "CELESTOPOL.Moon.lunevoutee",       result: "contrecoup",  symbol: "🌕" },
  { phase: "dernierquartier",  label: "CELESTOPOL.Moon.dernierquartier",  result: "contrecoup",  symbol: "🌖" },
  { phase: "derniercroissant", label: "CELESTOPOL.Moon.derniercroissant", result: "catastrophe", symbol: "🌗" },
  { phase: "pleinelune",       label: "CELESTOPOL.Moon.pleinelune",       result: "catastrophe", symbol: "🌘" },
]

/** Types de résultats narratifs du dé de Lune. */
export const MOON_RESULT_TYPES = {
  triomphe:    { id: "triomphe",    label: "CELESTOPOL.Moon.triomphe",    desc: "CELESTOPOL.Moon.triompheFull",    cssClass: "moon-triomphe" },
  brio:        { id: "brio",        label: "CELESTOPOL.Moon.brio",        desc: "CELESTOPOL.Moon.brioFull",        cssClass: "moon-brio" },
  contrecoup:  { id: "contrecoup",  label: "CELESTOPOL.Moon.contrecoup",  desc: "CELESTOPOL.Moon.contrecoupFull",  cssClass: "moon-contrecoup" },
  catastrophe: { id: "catastrophe", label: "CELESTOPOL.Moon.catastrophe", desc: "CELESTOPOL.Moon.catastropheFull", cssClass: "moon-catastrophe" },
}

/** Types d'équipements. */
export const EQUIPMENT_TYPES = {
  autre:     { id: "autre",     label: "CELESTOPOL.Equipment.autre" },
  arme:      { id: "arme",      label: "CELESTOPOL.Equipment.arme" },
  protection:{ id: "protection",label: "CELESTOPOL.Equipment.protection" },
  vehicule:  { id: "vehicule",  label: "CELESTOPOL.Equipment.vehicule" },
}

export const SYSTEM = {
  id: SYSTEM_ID,
  ASCII,
  STATS,
  SKILLS,
  ALL_SKILLS,
  ANOMALY_TYPES,
  ANOMALY_DEFINITIONS,
  FACTIONS,
  WOUND_LEVELS,
  DIFFICULTY_CHOICES,
  MOON_DIE_FACES,
  MOON_RESULT_TYPES,
  EQUIPMENT_TYPES,
}
