/**
 * Chroniques de l'Étrange — Système FoundryVTT
 *
 * Chroniques de l'Étrange est un jeu de rôle édité par Antre-Monde Éditions.
 * Ce système FoundryVTT est une implémentation indépendante et n'est pas
 * affilié à Antre-Monde Éditions,
 * mais a été réalisé avec l'autorisation d'Antre-Monde Éditions.
 *
 * @author    LeRatierBretonnien
 * @copyright 2024–2026 LeRatierBretonnien
 * @license   CC BY-NC-SA 4.0 – https://creativecommons.org/licenses/by-nc-sa/4.0/
 */

export const SYSTEM_ID = "fvtt-chroniques-de-l-etrange"

export const ACTOR_TYPES = {
  character: "character",
  npc: "npc",
}

export const ITEM_TYPES = {
  item: "item",
  kungfu: "kungfu",
  spell: "spell",
  supernatural: "supernatural",
  weapon: "weapon",
  armor: "armor",
  sanhei: "sanhei",
  ingredient: "ingredient",
}

export const SUBTYPES = {
  weapon: { id: "weapon", label: "CDE.Weapon" },
  armor: { id: "armor", label: "CDE.Armor" },
  sanhei: { id: "sanhei", label: "CDE.Sanhei" },
  other: { id: "other", label: "CDE.Other" },
}

export const MAGICS = {
  internalcinnabar: {
    id: "internalcinnabar",
    background: "linear-grey",
    label: "CDE.InternalCinnabar",
    aspectlabel: "CDE.Metal",
    speciality: {
      essence: { label: "CDE.Essence", classicon: "icon-yin", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yin.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_metal.webp", labelicon: "Yin", labelelement: "CDE.Metal" },
      mind: { label: "CDE.Mind", classicon: "icon-yin", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yin.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_eau.webp", labelicon: "Yin", labelelement: "CDE.Water" },
      purification: { label: "CDE.Purification", classicon: "icon-yinyang", icon: "/systems/fvtt-chroniques-de-l-etrange/images/yin_yang.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_terre.webp", labelicon: "Yin/Yang", labelelement: "CDE.Earth" },
      manipulation: { label: "CDE.Manipulation", classicon: "icon-yang", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yang.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_feu.webp", labelicon: "Yang", labelelement: "CDE.Fire" },
      aura: { label: "CDE.Aura", classicon: "icon-yang", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yang.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_bois.webp", labelicon: "Yang", labelelement: "CDE.Wood" },
    },
  },
  alchemy: {
    id: "alchemy",
    background: "linear-blue",
    label: "CDE.Alchemy",
    aspectlabel: "CDE.Water",
    speciality: {
      acupuncture: { label: "CDE.Acupuncture", classicon: "icon-yin", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yin.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_metal.webp", labelicon: "Yin", labelelement: "CDE.Metal" },
      elixirs: { label: "CDE.Elixirs", classicon: "icon-yin", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yin.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_eau.webp", labelicon: "Yin", labelelement: "CDE.Water" },
      poisons: { label: "CDE.Poisons", classicon: "icon-yinyang", icon: "/systems/fvtt-chroniques-de-l-etrange/images/yin_yang.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_terre.webp", labelicon: "Yin/Yang", labelelement: "CDE.Earth" },
      arsenal: { label: "CDE.Arsenal", classicon: "icon-yang", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yang.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_feu.webp", labelicon: "Yang", labelelement: "CDE.Fire" },
      potions: { label: "CDE.Potions", classicon: "icon-yang", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yang.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_bois.webp", labelicon: "Yang", labelelement: "CDE.Wood" },
    },
  },
  masteryoftheway: {
    id: "masteryoftheway",
    background: "linear-brown",
    label: "CDE.MasteryOfTheWay",
    aspectlabel: "CDE.Earth",
    speciality: {
      curse: { label: "CDE.Curse", classicon: "icon-yin", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yin.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_metal.webp", labelicon: "Yin", labelelement: "CDE.Metal" },
      transfiguration: { label: "CDE.Transfiguration", classicon: "icon-yin", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yin.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_eau.webp", labelicon: "Yin", labelelement: "CDE.Water" },
      necromancy: { label: "CDE.Necromancy", classicon: "icon-yinyang", icon: "/systems/fvtt-chroniques-de-l-etrange/images/yin_yang.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_terre.webp", labelicon: "Yin/Yang", labelelement: "CDE.Earth" },
      climatecontrol: { label: "CDE.ClimateControl", classicon: "icon-yang", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yang.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_feu.webp", labelicon: "Yang", labelelement: "CDE.Fire" },
      goldenmagic: { label: "CDE.GoldenMagic", classicon: "icon-yang", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yang.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_bois.webp", labelicon: "Yang", labelelement: "CDE.Wood" },
    },
  },
  exorcism: {
    id: "exorcism",
    background: "linear-red",
    label: "CDE.Exorcism",
    aspectlabel: "CDE.Fire",
    speciality: {
      invocation: { label: "CDE.Invocation", classicon: "icon-yin", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yin.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_metal.webp", labelicon: "Yin", labelelement: "CDE.Metal" },
      tracking: { label: "CDE.Tracking", classicon: "icon-yin", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yin.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_eau.webp", labelicon: "Yin", labelelement: "CDE.Water" },
      protection: { label: "CDE.Protection", classicon: "icon-yinyang", icon: "/systems/fvtt-chroniques-de-l-etrange/images/yin_yang.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_terre.webp", labelicon: "Yin/Yang", labelelement: "CDE.Earth" },
      punishment: { label: "CDE.Punishment", classicon: "icon-yang", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yang.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_feu.webp", labelicon: "Yang", labelelement: "CDE.Fire" },
      domination: { label: "CDE.Domination", classicon: "icon-yang", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yang.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_bois.webp", labelicon: "Yang", labelelement: "CDE.Wood" },
    },
  },
  geomancy: {
    id: "geomancy",
    background: "linear-green",
    label: "CDE.Geomancy",
    aspectlabel: "CDE.Wood",
    speciality: {
      neutralization: { label: "CDE.Neutralization", classicon: "icon-yin", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yin.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_metal.webp", labelicon: "Yin", labelelement: "CDE.Metal" },
      divination: { label: "CDE.Divination", classicon: "icon-yin", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yin.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_eau.webp", labelicon: "Yin", labelelement: "CDE.Water" },
      earthlyprayer: { label: "CDE.EarthlyPrayer", classicon: "icon-yinyang", icon: "/systems/fvtt-chroniques-de-l-etrange/images/yin_yang.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_terre.webp", labelicon: "Yin/Yang", labelelement: "CDE.Earth" },
      heavenlyprayer: { label: "CDE.HeavenlyPrayer", classicon: "icon-yang", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yang.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_feu.webp", labelicon: "Yang", labelelement: "CDE.Fire" },
      fungseoi: { label: "CDE.Fungseoi", classicon: "icon-yang", icon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_yang.webp", elementicon: "/systems/fvtt-chroniques-de-l-etrange/images/cde_bois.webp", labelicon: "Yang", labelelement: "CDE.Wood" },
    },
  },
}

/** Map aspect name → i18n label key */
export const ASPECT_LABELS = {
  metal: "CDE.Metal",
  water: "CDE.Water",
  earth: "CDE.Earth",
  fire:  "CDE.Fire",
  wood:  "CDE.Wood",
}

/** Map aspect name → image path */
export const ASPECT_ICONS = {
  metal: "systems/fvtt-chroniques-de-l-etrange/images/cde_metal.webp",
  water: "systems/fvtt-chroniques-de-l-etrange/images/cde_eau.webp",
  earth: "systems/fvtt-chroniques-de-l-etrange/images/cde_terre.webp",
  fire:  "systems/fvtt-chroniques-de-l-etrange/images/cde_feu.webp",
  wood:  "systems/fvtt-chroniques-de-l-etrange/images/cde_bois.webp",
}

/** Map aspect name → die face pair [yin, yang] (face=10 stored as 0) */
export const ASPECT_FACES = {
  metal: [3, 8],
  water: [1, 6],
  earth: [0, 5], // 0 = face "10"
  fire:  [2, 7],
  wood:  [4, 9],
}

/** Ordered aspect names by index (metal=0, water=1, earth=2, fire=3, wood=4) */
export const ASPECT_NAMES = ["metal", "water", "earth", "fire", "wood"]

/**
 * Wu Xing generating/overcoming cycle.
 * For each active aspect, the five result categories in order:
 * [successes, auspicious, noxious, loksyu, tinji]
 */
export const WU_XING_CYCLE = {
  wood:  ["wood",  "fire",  "water", "earth", "metal"],
  fire:  ["fire",  "earth", "wood",  "metal", "water"],
  earth: ["earth", "metal", "fire",  "water", "wood"],
  metal: ["metal", "water", "earth", "wood",  "fire"],
  water: ["water", "wood",  "metal", "fire",  "earth"],
}

export const TEMPLATE_PARTIALS = [
  "systems/fvtt-chroniques-de-l-etrange/templates/actor/parts/cde-character-skills.html",
  "systems/fvtt-chroniques-de-l-etrange/templates/actor/parts/cde-character-magics.html",
  "systems/fvtt-chroniques-de-l-etrange/templates/actor/parts/cde-character-nghang.html",
  "systems/fvtt-chroniques-de-l-etrange/templates/actor/parts/cde-character-treasures.html",
  "systems/fvtt-chroniques-de-l-etrange/templates/actor/parts/cde-character-items.html",
  "systems/fvtt-chroniques-de-l-etrange/templates/actor/parts/cde-character-kungfus.html",
  "systems/fvtt-chroniques-de-l-etrange/templates/actor/parts/cde-npc-supernaturals.html",
  "systems/fvtt-chroniques-de-l-etrange/templates/actor/parts/cde-npc-spells.html",
  "systems/fvtt-chroniques-de-l-etrange/templates/actor/parts/cde-npc-kungfus.html",
  "systems/fvtt-chroniques-de-l-etrange/templates/actor/parts/cde-npc-items.html",
  "systems/fvtt-chroniques-de-l-etrange/templates/apps/cde-loksyu-app.html",
  "systems/fvtt-chroniques-de-l-etrange/templates/apps/cde-tinji-app.html",
  "systems/fvtt-chroniques-de-l-etrange/templates/apps/cde-wheel-app.html",
]
