use enum_dispatch::enum_dispatch;
use crate::{element::{ElementalAura, Element}, event::EventType, status::{Statuses, EquipmentStatuses}, dice::AbstractDices};


#[derive(Hash, Eq, PartialEq, Debug)]
#[enum_dispatch(CharacterTrait)]
pub enum Character {
  Klee,
}

#[enum_dispatch]
pub trait CharacterTrait {
  fn status(&self) -> &CharacterStatus;
}

struct Klee(CharacterInfo, CharacterStatus);
impl CharacterTrait for Klee {
  fn status(&self) -> &CharacterStatus {
    &self.1
  }
}

pub struct CharacterInfo {
  element: Element,
  weapon: WeaponType,
  normal_attack_cost: AbstractDices,
  elemental_skill1_cost: AbstractDices,
  elemental_skill2_cost: AbstractDices,
  elemental_burst_cost: AbstractDices,
}

pub struct CharacterStatus {
  id: u8,
  alive: bool,
  hp: u8,
  max_hp: u8,
  energy: u8,
  max_energy: u8,
  hiddens: Statuses,
  equipments: EquipmentStatuses,
  statuses: Statuses,
  elemental_aura: ElementalAura,
}

pub struct Characters {
  pub inner: Vec<Character>,
  pub active: Option<u32>,
}

impl Characters {
  fn characters(&self) -> &[Character] {
    &self.inner
  }

  fn characters_in_activity_order(&self) -> Vec<Character> {
    todo!()
  }
}

pub enum CharacterSkill {
  Normal,
  ElementalSkill1,
  ElementalSkill2,
  ElementalBurst,
}

impl From<CharacterSkill> for EventType {
  fn from(skill: CharacterSkill) -> Self {
    match skill {
      CharacterSkill::Normal => EventType::Normal,
      CharacterSkill::ElementalSkill1 => EventType::ElementalSkill1,
      CharacterSkill::ElementalSkill2 => EventType::ElementalSkill2,
      CharacterSkill::ElementalBurst => EventType::ElementalBurst,
    }
  }
}

pub enum WeaponType {
  Bow,
  Catalyst,
  Claymore,
  Polearm,
  Sword,
  None,
}