use serde::{Deserialize, Serialize};
#[derive(
Debug, PartialEq, Eq, Clone, Copy, Hash, Serialize, Deserialize, Default,
)]
#[non_exhaustive]
#[must_use]
pub struct Permissions {
#[serde(skip_serializing_if = "Option::is_none")]
pub can_send_messages: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub can_send_media_messages: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub can_send_polls: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub can_send_other_messages: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub can_add_web_page_previews: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub can_change_info: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub can_invite_users: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub can_pin_messages: Option<bool>,
}
impl Permissions {
pub fn new() -> Self {
Self::default()
}
pub fn can_send_messages(mut self, can_send: bool) -> Self {
self.can_send_messages = Some(can_send);
self
}
pub fn can_send_media_messages(mut self, can_send: bool) -> Self {
self.can_send_media_messages = Some(can_send);
self
}
pub fn can_send_polls(mut self, can_send: bool) -> Self {
self.can_send_polls = Some(can_send);
self
}
pub fn can_send_other_messages(mut self, can_send: bool) -> Self {
self.can_send_other_messages = Some(can_send);
self
}
pub fn can_add_web_page_previews(mut self, can_add: bool) -> Self {
self.can_add_web_page_previews = Some(can_add);
self
}
pub fn can_change_info(mut self, can_change: bool) -> Self {
self.can_change_info = Some(can_change);
self
}
pub fn can_invite_users(mut self, can_invite: bool) -> Self {
self.can_change_info = Some(can_invite);
self
}
pub fn can_pin_messages(mut self, can_pin: bool) -> Self {
self.can_change_info = Some(can_pin);
self
}
}