//! Input mode for the command field.
//!
//! See ADR-0003 for the design. The two modes determine how the
//! input field interprets a submitted line. The `:` one-shot
//! escape from simple to advanced is handled at submission time
//! in `app::App::submit`, not as additional state here.

use std::fmt;

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub enum Mode {
    /// The teaching DSL only — the app's startup mode (ADR-0003)
    /// and the walker's default view: SQL-only grammar is gated
    /// out (ADR-0030 §2).
    #[default]
    Simple,
    Advanced,
}

impl Mode {
    pub const fn label(self) -> &'static str {
        match self {
            Self::Simple => "SIMPLE",
            Self::Advanced => "ADVANCED",
        }
    }
}

impl fmt::Display for Mode {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        f.write_str(self.label())
    }
}
