// ─── Crafting Store Initial State ─────────────────────────────────────────────
// Helper to generate the starting equipment instances for new games.

import * as CraftingUtils from '../crafting-utils';

export function createInitialEquipmentInstances() {
  const staffId = CraftingUtils.generateInstanceId();
  const staffInstance = {
    instanceId: staffId,
    typeId: 'basicStaff',
    name: 'Basic Staff',
    enchantments: [{ effectId: 'spell_manaBolt', stacks: 1, actualCost: 50 }],
    usedCapacity: 50,
    totalCapacity: 50,
    rarity: 'common',
    quality: 100,
    tags: [],
  };

  const shirtId = CraftingUtils.generateInstanceId();
  const shirtInstance = {
    instanceId: shirtId,
    typeId: 'civilianShirt',
    name: 'Civilian Shirt',
    enchantments: [],
    usedCapacity: 0,
    totalCapacity: 30,
    rarity: 'common',
    quality: 100,
    tags: [],
  };

  const shoesId = CraftingUtils.generateInstanceId();
  const shoesInstance = {
    instanceId: shoesId,
    typeId: 'civilianShoes',
    name: 'Civilian Shoes',
    enchantments: [],
    usedCapacity: 0,
    totalCapacity: 15,
    rarity: 'common',
    quality: 100,
    tags: [],
  };

  return {
    instances: {
      [staffId]: staffInstance,
      [shirtId]: shirtInstance,
      [shoesId]: shoesInstance,
    } as Record<string, typeof staffInstance>,
    equippedInstances: {
      mainHand: staffId,
      offHand: null,
      head: null,
      body: shirtId,
      hands: null,
      feet: shoesId,
      accessory1: null,
      accessory2: null,
    } as Record<string, string | null>,
  };
}
