use serde::{Deserialize, Serialize};
#[repr(u8)]
#[cfg_attr(
feature = "borsh",
derive(borsh::BorshSerialize, borsh::BorshDeserialize)
)]
#[cfg_attr(feature = "borsh", borsh(use_discriminant = true))]
#[derive(
Debug,
Clone,
PartialEq,
Eq,
Hash,
Deserialize,
Serialize,
strum::Display,
strum::EnumString,
strum::AsRefStr,
strum::VariantNames,
)]
pub enum OnlineStatus {
Away = 2,
Busy = 3,
Invisible = 1,
Offline = 0,
Online = 4,
Sociable = 5,
}
impl Default for OnlineStatus {
fn default() -> Self { Self::Offline }
}
impl OnlineStatus {
#[must_use]
pub const fn color(&self) -> (u8, u8, u8) {
match &self {
Self::Sociable => (97, 209, 250),
Self::Online => (0, 255, 0),
Self::Away => (255, 200, 0),
Self::Busy => (255, 0, 0),
Self::Offline | Self::Invisible => (127, 127, 127),
}
}
}