use crate::models::serde_helpers::is_empty_vec;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
pub struct UpdateGuildMute {
#[serde(default, skip_serializing_if = "String::is_empty")]
pub mute_end_timestamp: String,
#[serde(default, skip_serializing_if = "String::is_empty")]
pub mute_seconds: String,
#[serde(default, skip_serializing_if = "is_empty_vec")]
pub user_ids: Vec<String>,
}
impl UpdateGuildMute {
pub fn new(mute_end_timestamp: Option<&str>, mute_seconds: Option<&str>) -> Self {
Self {
mute_end_timestamp: mute_end_timestamp.unwrap_or_default().to_string(),
mute_seconds: mute_seconds.unwrap_or_default().to_string(),
user_ids: Vec::new(),
}
}
pub fn new_multi(
user_ids: Vec<String>,
mute_end_timestamp: Option<&str>,
mute_seconds: Option<&str>,
) -> Self {
Self {
mute_end_timestamp: mute_end_timestamp.unwrap_or_default().to_string(),
mute_seconds: mute_seconds.unwrap_or_default().to_string(),
user_ids,
}
}
pub fn cancel() -> Self {
Self {
mute_end_timestamp: "0".to_string(),
mute_seconds: "0".to_string(),
user_ids: Vec::new(),
}
}
pub fn cancel_multi(user_ids: Vec<String>) -> Self {
Self {
mute_end_timestamp: "0".to_string(),
mute_seconds: "0".to_string(),
user_ids,
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
pub struct UpdateGuildMuteResponse {
#[serde(default)]
pub user_ids: Vec<String>,
}