cock_tier/modules/bin_modules/
mod.rs1use crate::{
2 Abnormalities, Aesthetic, Balls, Circumcision, CockStruct, Curvature, GetVariants, Shape,
3 SizeType, Veininess, ID,
4};
5
6pub mod standard_prompt;
7pub mod tui_prompt;
8
9#[derive(Clone)]
10pub struct UserData {
11 pub user: ID,
12 pub cock: CockStruct,
13 pub state: AppState,
14}
15
16impl UserData {
17 pub fn default() -> UserData {
18 UserData {
19 user: ID::Anonymous,
20 cock: CockStruct::default(),
21 state: AppState::default(),
22 }
23 }
24}
25
26#[derive(Clone, Copy)]
27pub enum AppState {
28 Home,
29 Id,
30 Abnormalities,
31 Aesthetic,
32 Balls,
33 Circumcision,
34 Curvature,
35 Shape,
36 Size,
37 Veininess,
38 Result,
39}
40
41impl AppState {
42 pub fn default() -> AppState {
43 AppState::Home
44 }
45
46 pub fn options(&self) -> Vec<String> {
47 match self {
48 AppState::Abnormalities => Abnormalities::get_variants(),
49 AppState::Aesthetic => Aesthetic::get_variants(),
50 AppState::Balls => Balls::get_variants(),
51 AppState::Circumcision => Circumcision::get_variants(),
52 AppState::Curvature => Curvature::get_variants(),
53 AppState::Id => ID::get_variants(),
54 AppState::Shape => Shape::get_variants(),
55 AppState::Size => SizeType::get_variants(),
56 AppState::Veininess => Veininess::get_variants(),
57 _ => Vec::default(),
58 }
59 }
60
61 pub fn as_str(&self) -> &str {
62 match self {
63 AppState::Home => "Home",
64 AppState::Id => "ID",
65 AppState::Abnormalities => "Abnormalities",
66 AppState::Aesthetic => "Aesthetic",
67 AppState::Balls => "Balls",
68 AppState::Circumcision => "Circumcision",
69 AppState::Curvature => "Curvature",
70 AppState::Shape => "Shape",
71 AppState::Size => "Size",
72 AppState::Veininess => "Veininess",
73 AppState::Result => "Result",
74 }
75 }
76
77 pub fn next(&self) -> AppState {
78 match self {
79 AppState::Home => AppState::Id,
80 AppState::Id => AppState::Size,
81 AppState::Size => AppState::Abnormalities,
82 AppState::Abnormalities => AppState::Aesthetic,
83 AppState::Aesthetic => AppState::Balls,
84 AppState::Balls => AppState::Circumcision,
85 AppState::Circumcision => AppState::Curvature,
86 AppState::Curvature => AppState::Shape,
87 AppState::Shape => AppState::Veininess,
88 AppState::Veininess => AppState::Result,
89 AppState::Result => AppState::Result,
90 }
91 }
92
93 pub fn prev(&self) -> AppState {
94 match self {
95 AppState::Home => AppState::Home,
96 AppState::Id => AppState::Home,
97 AppState::Size => AppState::Id,
98 AppState::Abnormalities => AppState::Size,
99 AppState::Aesthetic => AppState::Abnormalities,
100 AppState::Balls => AppState::Aesthetic,
101 AppState::Circumcision => AppState::Balls,
102 AppState::Curvature => AppState::Circumcision,
103 AppState::Shape => AppState::Curvature,
104 AppState::Veininess => AppState::Shape,
105 AppState::Result => AppState::Veininess,
106 }
107 }
108}