// ─── Golem Enchantment Definitions ───────────────────────────────────────
// Optional sword effects applied to golem basic attacks.
// Requires Enchanter 5 + Fabricator 5.

import type { GolemEnchantmentDefinition } from './types';
import { elemCost } from './types';

const ENCHANTER_5_FABRICATOR_5 = {
  type: 'dual_attunement' as const,
  attunements: ['enchanter', 'fabricator'],
  levels: [5, 5],
};

const SWORD_FIRE: GolemEnchantmentDefinition = {
  id: 'sword_fire',
  name: 'Sword: Fire',
  description: 'Applies Burn DoT on basic attack.',
  effect: 'burn',
  capacityCost: 10,
  summonCost: [elemCost('fire', 5)],
  unlockRequirement: ENCHANTER_5_FABRICATOR_5,
};

const SWORD_FROST: GolemEnchantmentDefinition = {
  id: 'sword_frost',
  name: 'Sword: Frost',
  description: 'Applies additional Slow on basic attack.',
  effect: 'slow',
  capacityCost: 10,
  summonCost: [elemCost('frost', 5)],
  unlockRequirement: ENCHANTER_5_FABRICATOR_5,
};

const SWORD_LIGHTNING: GolemEnchantmentDefinition = {
  id: 'sword_lightning',
  name: 'Sword: Lightning',
  description: 'Chance to Shock (stun) on basic attack.',
  effect: 'shock',
  capacityCost: 12,
  summonCost: [elemCost('lightning', 6)],
  unlockRequirement: ENCHANTER_5_FABRICATOR_5,
};

const SWORD_SHADOW: GolemEnchantmentDefinition = {
  id: 'sword_shadow',
  name: 'Sword: Shadow',
  description: 'Chance to Weaken (reduce enemy damage) on basic attack.',
  effect: 'weaken',
  capacityCost: 12,
  summonCost: [elemCost('dark', 6)],
  unlockRequirement: ENCHANTER_5_FABRICATOR_5,
};

const SWORD_METAL: GolemEnchantmentDefinition = {
  id: 'sword_metal',
  name: 'Sword: Metal',
  description: 'Bonus Armor Pierce on basic attack.',
  effect: 'armorPierce',
  capacityCost: 8,
  summonCost: [elemCost('metal', 5)],
  unlockRequirement: ENCHANTER_5_FABRICATOR_5,
};

const SWORD_CRYSTAL: GolemEnchantmentDefinition = {
  id: 'sword_crystal',
  name: 'Sword: Crystal',
  description: 'Bonus Critical Chance on basic attack.',
  effect: 'criticalChance',
  capacityCost: 14,
  summonCost: [elemCost('crystal', 7)],
  unlockRequirement: ENCHANTER_5_FABRICATOR_5,
};

const SWORD_WATER: GolemEnchantmentDefinition = {
  id: 'sword_water',
  name: 'Sword: Water',
  description: 'Applies Soak on basic attack (increases lightning damage taken).',
  effect: 'soak',
  capacityCost: 8,
  summonCost: [elemCost('water', 4)],
  unlockRequirement: ENCHANTER_5_FABRICATOR_5,
};

const SWORD_EARTH: GolemEnchantmentDefinition = {
  id: 'sword_earth',
  name: 'Sword: Earth',
  description: 'Bonus damage to shielded enemies on basic attack.',
  effect: 'shieldBreak',
  capacityCost: 10,
  summonCost: [elemCost('earth', 5)],
  unlockRequirement: ENCHANTER_5_FABRICATOR_5,
};

// ─── ENCHANTMENT REGISTRY ────────────────────────────────────────────────

export const GOLEM_ENCHANTMENTS: Record<string, GolemEnchantmentDefinition> = {
  [SWORD_FIRE.id]: SWORD_FIRE,
  [SWORD_FROST.id]: SWORD_FROST,
  [SWORD_LIGHTNING.id]: SWORD_LIGHTNING,
  [SWORD_SHADOW.id]: SWORD_SHADOW,
  [SWORD_METAL.id]: SWORD_METAL,
  [SWORD_CRYSTAL.id]: SWORD_CRYSTAL,
  [SWORD_WATER.id]: SWORD_WATER,
  [SWORD_EARTH.id]: SWORD_EARTH,
};

export const ALL_GOLEM_ENCHANTMENTS = [
  SWORD_FIRE,
  SWORD_FROST,
  SWORD_LIGHTNING,
  SWORD_SHADOW,
  SWORD_METAL,
  SWORD_CRYSTAL,
  SWORD_WATER,
  SWORD_EARTH,
];
