//! Handling of abilities and effects

use std::collections::VecDeque;

/// Contains stack items
#[derive(Debug, Default)]
pub struct Stack {
    /// Are we in the middle of resolving an effect?
    is_resolving: bool,
    stack: VecDeque<StackItem>,
}

#[derive(Debug, Clone)]
pub enum StackItem {}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum GameEffectState {
    Closed,
    HalfOpen,
    Open,
}

impl Stack {
    // The only way to override this is to look are the Phase::is_closed result
    // If that is true, GES is closed no matter what
    pub fn game_effect_state(&self) -> GameEffectState {
        if self.stack.is_empty() {
            GameEffectState::Open
        } else if self.is_resolving {
            GameEffectState::Closed
        } else {
            // The stack is *not* empty, but we are *not* in the middle of effect resolution
            GameEffectState::HalfOpen
        }
    }
}