// src/state/pages/intro.rs
use crate::movement::MovementAction;

#[derive(Default, Clone, Debug)]
pub struct IntroState {
    pub selected_option: usize,
}

impl IntroState {
    pub fn new() -> Self {
        Self::default()
    }

    pub fn next_option(&mut self) {
        if self.selected_option < 3 {
            self.selected_option += 1;
        }
    }

    pub fn previous_option(&mut self) {
        if self.selected_option > 0 {
             self.selected_option -= 1
        }
    }
}

impl IntroState {
    pub fn handle_movement(&mut self, action: MovementAction) -> bool {
        match action {
            MovementAction::Next | MovementAction::Right | MovementAction::Down => {
                self.next_option();
                true
            }
            MovementAction::Previous | MovementAction::Left | MovementAction::Up => {
                self.previous_option();
                true
            }
            MovementAction::Select => {
                // Actual selection handled in event loop (UiContext::Intro)
                false
            }
            MovementAction::Esc => {
                // Nothing special for Intro, but could be used to quit
                true
            }
        }
    }
}
