use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct UserStatus {
#[serde(skip_serializing_if = "Option::is_none")]
pub text: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub presence: Option<Presence>,
}
impl UserStatus {
pub fn new(text: impl Into<String>, presence: Presence) -> Self {
Self {
text: Some(text.into()),
presence: Some(presence),
}
}
pub fn text(text: impl Into<String>) -> Self {
Self {
text: Some(text.into()),
presence: None,
}
}
pub fn presence(presence: Presence) -> Self {
Self {
text: None,
presence: Some(presence),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Deserialize, Serialize)]
pub enum Presence {
Online,
Idle,
Busy,
Invisible,
}