//! Manages turns and phases
#![allow(dead_code, unused_imports)]

#[derive(Debug, Default)]
pub struct TurnState {
    current_phase: Phase,
    /// The game starts when this is 1.
    current_turn: usize,
}

impl TurnState {
    pub fn phase(&self) -> Phase {
        self.current_phase
    }
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub enum Phase {
    #[default]
    Ready,
    Standby,
    Draw,
    PrecombatMain,
    Battle(BattleStep),
    PostcombatMain,
    End,
}

impl Phase {
    /// Does this phase default to a closed GES?
    pub fn is_closed(self) -> bool {
        matches!(
            self,
            Phase::Ready | Phase::Battle(BattleStep::ResolveDamage)
        )
    }
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum BattleStep {
    BeginBattle,
    DeclareAttackers,
    MakeAttacks,
    ResolveDamage,
    EndBattle,
}