ralertsinua_models/
alert_status.rs1use serde::{Deserialize, Serialize};
2
3#[derive(
4 Debug,
5 Default,
6 Deserialize,
7 Serialize,
8 Clone,
9 PartialEq,
10 strum_macros::EnumString,
11 strum_macros::EnumProperty,
12 strum_macros::AsRefStr,
13 strum_macros::Display,
14)]
15pub enum AlertStatus {
16 #[strum(to_string = "Active", props(icon = "🜸", color = "red"))] A,
19 #[strum(to_string = "Partial", props(icon = "🌤", color = "yellow"))] P,
22 #[strum(to_string = "No info", props(icon = "🌣", color = "blue"))] #[default]
25 N,
26 #[strum(to_string = "Loading", props(icon = "↻", color = "gray"))]
28 L,
29 #[strum(to_string = "Offline", props(icon = "?", color = "darkgray"))]
31 O,
32}
33
34impl From<char> for AlertStatus {
35 fn from(c: char) -> Self {
36 match c {
37 'A' => AlertStatus::A,
38 'P' => AlertStatus::P,
39 'L' => AlertStatus::L,
40 'O' => AlertStatus::O,
41 _ => AlertStatus::N,
42 }
43 }
44}