use rand::rngs::ThreadRng;

use super::ui_controller::UiController;

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Direction {
  Up,
  Down,
}

#[derive(Clone)]
pub enum WizardAction {
  Exit,
  Submit(String),
  Navigate(Direction),
  Resize(u16, u16),
}

pub enum StateResult {
  Continue,
  Done {
    next: Box<dyn WizardState>,
    output: Option<(String, String)>,
  },
  Finished,
}

pub trait WizardState {
  fn tick(&mut self, ui: &mut UiController, rng: &mut ThreadRng) -> StateResult;
  fn handle_action(&mut self, action: WizardAction, ui: &mut UiController) -> StateResult;
}
