1use crossterm::event::KeyEvent;
2use tty_interface::{Interface, Position};
3
4use crate::{
5 dependency::DependencyState,
6 text::{DrawerContents, Segment},
7 Form,
8};
9
10mod compound;
11pub use compound::*;
12
13mod keyvalue;
14pub use keyvalue::*;
15
16mod textblock;
17pub use textblock::*;
18
19mod yesno;
20pub use yesno::*;
21
22pub trait Step {
24 fn initialize(&mut self, dependency_state: &mut DependencyState, index: usize);
26
27 fn render(
29 &self,
30 interface: &mut Interface,
31 dependency_state: &DependencyState,
32 position: Position,
33 is_focused: bool,
34 ) -> u16;
35
36 fn update(
38 &mut self,
39 dependency_state: &mut DependencyState,
40 input: KeyEvent,
41 ) -> Option<InputResult>;
42
43 fn help(&self) -> Segment;
45
46 fn drawer(&self) -> Option<DrawerContents>;
48
49 fn result(&self, dependency_state: &DependencyState) -> String;
51
52 fn add_to(self, form: &mut Form);
54}
55
56pub enum InputResult {
58 AdvanceForm,
60 RetreatForm,
62}