export type PlayerClass =
  | 'warrior'
  | 'paladin'
  | 'hunter'
  | 'rogue'
  | 'priest'
  | 'shaman'
  | 'mage'
  | 'warlock'
  | 'druid'

export interface Stats {
  str: number
  agi: number
  sta: number
  int: number
  spi: number
  armor: number
}

export interface WeaponInfo {
  min: number
  max: number
  speed: number
  dagger?: boolean
}

export type EquipSlot =
  | 'mainhand'
  | 'helmet'
  | 'shoulder'
  | 'chest'
  | 'waist'
  | 'legs'
  | 'gloves'
  | 'feet'

export const EQUIP_SLOTS: readonly EquipSlot[] = [
  'mainhand',
  'helmet',
  'shoulder',
  'chest',
  'waist',
  'legs',
  'gloves',
  'feet',
]

export interface ItemDef {
  id: string
  name: string
  kind: 'weapon' | 'armor' | 'quest' | 'junk' | 'food' | 'drink' | 'tool' | 'potion' | 'elixir'
  slot?: EquipSlot
  weapon?: WeaponInfo
  stats?: Partial<Stats>
  sellValue: number
  buyValue?: number
  armorType?: 'cloth' | 'leather' | 'mail'
  questId?: string
  quality?: 'poor' | 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary'
  requiredClass?: PlayerClass[]
}

export interface InvSlot {
  itemId: string
  count: number
}

export interface LootEntry {
  itemId?: string
  copper?: number
  chance: number
  questId?: string
  rollGroup?: string
}

export type MobFamily =
  | 'beast'
  | 'humanoid'
  | 'murloc'
  | 'spider'
  | 'kobold'
  | 'undead'
  | 'troll'
  | 'ogre'
  | 'elemental'
  | 'dragonkin'
  | 'demon'

export interface MobTemplate {
  id: string
  name: string
  minLevel: number
  maxLevel: number
  family: MobFamily
  hpPerLevel: number
  hpBase: number
  dmgBase: number
  dmgPerLevel: number
  attackSpeed: number
  armorPerLevel: number
  moveSpeed: number
  aggroRadius: number
  loot: LootEntry[]
  scale: number
  color: number
  boss?: boolean
  rare?: boolean
  elite?: boolean
  ccImmune?: boolean
  aoePulse?: {
    min: number
    max: number
    radius: number
    every: number
    name: string
    school?: string
    fx?: 'nova' | 'projectile'
  }
  summonAdds?: { mobId: string; count: number; atHpPct: number[] }
  enrage?: { belowHpPct: number; dmgMult: number; hasteMult?: number }
  stomp?: { radius: number; every: number; duration: number; min: number; max: number; name: string }
}
