1use super::id::Id;
4use dioxus::prelude::EventHandler;
5
6#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
8#[non_exhaustive]
9pub enum Orientation {
10 #[default]
12 Horizontal,
13 Vertical,
15}
16
17#[derive(Debug, Default, Clone, PartialEq, Eq, Hash)]
19#[non_exhaustive]
20pub enum Availability {
21 #[default]
23 Enabled,
24 Disabled,
26 Unavailable {
28 reason: Id,
30 },
31}
32impl Availability {
33 #[must_use]
35 pub fn guard<T: 'static>(&self, handler: Option<EventHandler<T>>) -> Option<EventHandler<T>> {
36 if *self == Self::Enabled {
37 handler
38 } else {
39 None
40 }
41 }
42}
43
44#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
46#[non_exhaustive]
47pub enum Lifecycle {
48 Pending,
50 Queued,
52 Streaming,
54 Running,
56 Complete,
58 Aborted,
60 Denied,
62 Error,
64}
65impl Lifecycle {
66 pub const ALL: &'static [Self] = &[
68 Self::Pending,
69 Self::Queued,
70 Self::Streaming,
71 Self::Running,
72 Self::Complete,
73 Self::Aborted,
74 Self::Denied,
75 Self::Error,
76 ];
77 #[must_use]
79 pub const fn is_settled(self) -> bool {
80 matches!(
81 self,
82 Self::Complete | Self::Aborted | Self::Denied | Self::Error
83 )
84 }
85 #[must_use]
87 pub const fn as_str(self) -> &'static str {
88 match self {
89 Self::Pending => "pending",
90 Self::Queued => "queued",
91 Self::Streaming => "streaming",
92 Self::Running => "running",
93 Self::Complete => "complete",
94 Self::Aborted => "aborted",
95 Self::Denied => "denied",
96 Self::Error => "error",
97 }
98 }
99}
100
101#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
103#[non_exhaustive]
104pub enum MessageRole {
105 User,
107 Assistant,
109 System,
111 Tool,
113}
114impl MessageRole {
115 #[must_use]
117 pub const fn as_str(self) -> &'static str {
118 match self {
119 Self::User => "user",
120 Self::Assistant => "assistant",
121 Self::System => "system",
122 Self::Tool => "tool",
123 }
124 }
125}
126
127#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
129#[non_exhaustive]
130pub enum HeadingLevel {
131 H1,
133 H2,
135 #[default]
137 H3,
138 H4,
140 H5,
142 H6,
144}