use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
use crate::{field_access, impl_default, impl_display, UserSettingsEmojisetChoice};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RealmUserSettingsDefault {
#[serde(skip_serializing_if = "Option::is_none")]
twenty_four_hour_time: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
web_mark_read_on_scroll_policy: Option<WebMarkReadOnScrollPolicy>,
#[serde(skip_serializing_if = "Option::is_none")]
web_channel_default_view: Option<WebChannelDefaultView>,
#[serde(skip_serializing_if = "Option::is_none")]
starred_message_counts: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
receives_typing_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
web_suggest_update_timezone: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
fluid_layout_width: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
high_contrast_mode: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
web_font_size_px: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
web_line_height_percent: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
color_scheme: Option<ColorScheme>,
#[serde(skip_serializing_if = "Option::is_none")]
translate_emoticons: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
display_emoji_reaction_users: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
default_language: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
web_home_view: Option<WebHomeView>,
#[serde(skip_serializing_if = "Option::is_none")]
web_escape_navigates_to_home_view: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
left_side_userlist: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
emojiset: Option<Emojiset>,
#[serde(skip_serializing_if = "Option::is_none")]
demote_inactive_streams: Option<DemoteInactiveStreams>,
#[serde(skip_serializing_if = "Option::is_none")]
user_list_style: Option<UserListStyle>,
#[serde(skip_serializing_if = "Option::is_none")]
web_animate_image_previews: Option<WebAnimateImagePreviews>,
#[serde(skip_serializing_if = "Option::is_none")]
web_stream_unreads_count_display_policy: Option<WebStreamUnreadsCountDisplayPolicy>,
#[serde(skip_serializing_if = "Option::is_none")]
hide_ai_features: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
web_left_sidebar_show_channel_folders: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
web_left_sidebar_unreads_count_summary: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_stream_desktop_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_stream_email_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_stream_push_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_stream_audible_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
notification_sound: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_desktop_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_sounds: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_offline_email_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_offline_push_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_online_push_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_followed_topic_desktop_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_followed_topic_email_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_followed_topic_push_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_followed_topic_audible_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_digest_emails: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_marketing_emails: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_login_emails: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_content_in_email_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pm_content_in_desktop_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
wildcard_mentions_notify: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_followed_topic_wildcard_mentions_notify: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
desktop_icon_count_display: Option<DesktopIconCountDisplay>,
#[serde(skip_serializing_if = "Option::is_none")]
realm_name_in_email_notifications_policy: Option<RealmNameInEmailNotificationsPolicy>,
#[serde(skip_serializing_if = "Option::is_none")]
automatically_follow_topics_policy: Option<AutomaticallyFollowTopicsPolicy>,
#[serde(skip_serializing_if = "Option::is_none")]
automatically_unmute_topics_in_muted_streams_policy:
Option<AutomaticallyUnmuteTopicsInMutedStreamsPolicy>,
#[serde(skip_serializing_if = "Option::is_none")]
automatically_follow_topics_where_mentioned: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
resolved_topic_notice_auto_read_policy: Option<ResolvedTopicNoticeAutoReadPolicy>,
#[serde(skip_serializing_if = "Option::is_none")]
presence_enabled: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enter_sends: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
enable_drafts_synchronization: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
email_notifications_batching_period_seconds: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
available_notification_sounds: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
emojiset_choices: Option<Vec<UserSettingsEmojisetChoice>>,
#[serde(skip_serializing_if = "Option::is_none")]
send_private_typing_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
send_stream_typing_notifications: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
send_read_receipts: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_private_data_export: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
email_address_visibility: Option<EmailAddressVisibility>,
#[serde(skip_serializing_if = "Option::is_none")]
web_navigate_to_sent_message: Option<bool>,
}
impl RealmUserSettingsDefault {
pub const fn new() -> Self {
Self {
twenty_four_hour_time: None,
web_mark_read_on_scroll_policy: None,
web_channel_default_view: None,
starred_message_counts: None,
receives_typing_notifications: None,
web_suggest_update_timezone: None,
fluid_layout_width: None,
high_contrast_mode: None,
web_font_size_px: None,
web_line_height_percent: None,
color_scheme: None,
translate_emoticons: None,
display_emoji_reaction_users: None,
default_language: None,
web_home_view: None,
web_escape_navigates_to_home_view: None,
left_side_userlist: None,
emojiset: None,
demote_inactive_streams: None,
user_list_style: None,
web_animate_image_previews: None,
web_stream_unreads_count_display_policy: None,
hide_ai_features: None,
web_left_sidebar_show_channel_folders: None,
web_left_sidebar_unreads_count_summary: None,
enable_stream_desktop_notifications: None,
enable_stream_email_notifications: None,
enable_stream_push_notifications: None,
enable_stream_audible_notifications: None,
notification_sound: None,
enable_desktop_notifications: None,
enable_sounds: None,
enable_offline_email_notifications: None,
enable_offline_push_notifications: None,
enable_online_push_notifications: None,
enable_followed_topic_desktop_notifications: None,
enable_followed_topic_email_notifications: None,
enable_followed_topic_push_notifications: None,
enable_followed_topic_audible_notifications: None,
enable_digest_emails: None,
enable_marketing_emails: None,
enable_login_emails: None,
message_content_in_email_notifications: None,
pm_content_in_desktop_notifications: None,
wildcard_mentions_notify: None,
enable_followed_topic_wildcard_mentions_notify: None,
desktop_icon_count_display: None,
realm_name_in_email_notifications_policy: None,
automatically_follow_topics_policy: None,
automatically_unmute_topics_in_muted_streams_policy: None,
automatically_follow_topics_where_mentioned: None,
resolved_topic_notice_auto_read_policy: None,
presence_enabled: None,
enter_sends: None,
enable_drafts_synchronization: None,
email_notifications_batching_period_seconds: None,
available_notification_sounds: None,
emojiset_choices: None,
send_private_typing_notifications: None,
send_stream_typing_notifications: None,
send_read_receipts: None,
allow_private_data_export: None,
email_address_visibility: None,
web_navigate_to_sent_message: None,
}
}
}
field_access! {
RealmUserSettingsDefault {
twenty_four_hour_time: option { bool },
web_mark_read_on_scroll_policy: option { WebMarkReadOnScrollPolicy },
web_channel_default_view: option { WebChannelDefaultView },
starred_message_counts: option { bool },
receives_typing_notifications: option { bool },
web_suggest_update_timezone: option { bool },
fluid_layout_width: option { bool },
high_contrast_mode: option { bool },
web_font_size_px: option { u64 },
web_line_height_percent: option { u64 },
color_scheme: option { ColorScheme },
translate_emoticons: option { bool },
display_emoji_reaction_users: option { bool },
web_home_view: option { WebHomeView },
web_escape_navigates_to_home_view: option { bool },
left_side_userlist: option { bool },
emojiset: option { Emojiset },
demote_inactive_streams: option { DemoteInactiveStreams },
user_list_style: option { UserListStyle },
web_animate_image_previews: option { WebAnimateImagePreviews },
web_stream_unreads_count_display_policy: option { WebStreamUnreadsCountDisplayPolicy },
hide_ai_features: option { bool },
web_left_sidebar_show_channel_folders: option { bool },
web_left_sidebar_unreads_count_summary: option { bool },
enable_stream_desktop_notifications: option { bool },
enable_stream_email_notifications: option { bool },
enable_stream_push_notifications: option { bool },
enable_stream_audible_notifications: option { bool },
enable_desktop_notifications: option { bool },
enable_sounds: option { bool },
enable_offline_email_notifications: option { bool },
enable_offline_push_notifications: option { bool },
enable_online_push_notifications: option { bool },
enable_followed_topic_desktop_notifications: option { bool },
enable_followed_topic_email_notifications: option { bool },
enable_followed_topic_push_notifications: option { bool },
enable_followed_topic_audible_notifications: option { bool },
enable_digest_emails: option { bool },
enable_marketing_emails: option { bool },
enable_login_emails: option { bool },
message_content_in_email_notifications: option { bool },
pm_content_in_desktop_notifications: option { bool },
wildcard_mentions_notify: option { bool },
enable_followed_topic_wildcard_mentions_notify: option { bool },
desktop_icon_count_display: option { DesktopIconCountDisplay },
realm_name_in_email_notifications_policy: option { RealmNameInEmailNotificationsPolicy },
automatically_follow_topics_policy: option { AutomaticallyFollowTopicsPolicy },
automatically_unmute_topics_in_muted_streams_policy: option { AutomaticallyUnmuteTopicsInMutedStreamsPolicy },
automatically_follow_topics_where_mentioned: option { bool },
resolved_topic_notice_auto_read_policy: option { ResolvedTopicNoticeAutoReadPolicy },
presence_enabled: option { bool },
enter_sends: option { bool },
enable_drafts_synchronization: option { bool },
email_notifications_batching_period_seconds: option { u64 },
send_private_typing_notifications: option { bool },
send_stream_typing_notifications: option { bool },
send_read_receipts: option { bool },
allow_private_data_export: option { bool },
email_address_visibility: option { EmailAddressVisibility },
web_navigate_to_sent_message: option { bool },
}
}
field_access! {
RealmUserSettingsDefault {
default_language: option_cow_deref { str, String },
notification_sound: option_cow_deref { str, String },
available_notification_sounds: option_cow_deref { [String], Vec<String> },
emojiset_choices: option_cow_deref { [UserSettingsEmojisetChoice], Vec<UserSettingsEmojisetChoice> },
}
}
impl_default!(RealmUserSettingsDefault);
impl_display!(RealmUserSettingsDefault);
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize_repr, Serialize_repr)]
#[repr(u8)]
pub enum WebMarkReadOnScrollPolicy {
Always = 1,
OnlyInConversationViews = 2,
Never = 3,
}
impl WebMarkReadOnScrollPolicy {
pub const fn new() -> Self {
Self::Always
}
}
impl_default!(WebMarkReadOnScrollPolicy);
impl_display!(WebMarkReadOnScrollPolicy);
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize_repr, Serialize_repr)]
#[repr(u8)]
pub enum WebChannelDefaultView {
TopTopic = 1,
ChannelFeed = 2,
ListOfTopics = 3,
TopUnreadTopic = 4,
}
impl WebChannelDefaultView {
pub const fn new() -> Self {
Self::TopTopic
}
}
impl_default!(WebChannelDefaultView);
impl_display!(WebChannelDefaultView);
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize_repr, Serialize_repr)]
#[repr(u8)]
pub enum ColorScheme {
Automatic = 1,
DarkTheme = 2,
LightTheme = 3,
}
impl ColorScheme {
pub const fn new() -> Self {
Self::Automatic
}
}
impl_default!(ColorScheme);
impl_display!(ColorScheme);
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum WebHomeView {
Recent,
Inbox,
AllMessages,
}
impl WebHomeView {
pub const fn new() -> Self {
Self::Recent
}
}
impl_default!(WebHomeView);
impl_display!(WebHomeView);
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum Emojiset {
Google,
Twitter,
Text,
}
impl Emojiset {
pub const fn new() -> Self {
Self::Google
}
}
impl_default!(Emojiset);
impl_display!(Emojiset);
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize_repr, Serialize_repr)]
pub enum DemoteInactiveStreams {
Automatic = 1,
Always = 2,
Never = 3,
}
impl DemoteInactiveStreams {
pub const fn new() -> Self {
Self::Automatic
}
}
impl_default!(DemoteInactiveStreams);
impl_display!(DemoteInactiveStreams);
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize_repr, Serialize_repr)]
pub enum UserListStyle {
Compact = 1,
WithStatus = 2,
WithAvatarAndStatus = 3,
}
impl UserListStyle {
pub const fn new() -> Self {
Self::Compact
}
}
impl_default!(UserListStyle);
impl_display!(UserListStyle);
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum WebAnimateImagePreviews {
Always,
OnHover,
Never,
}
impl WebAnimateImagePreviews {
pub const fn new() -> Self {
Self::Always
}
}
impl_default!(WebAnimateImagePreviews);
impl_display!(WebAnimateImagePreviews);
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize_repr, Serialize_repr)]
pub enum WebStreamUnreadsCountDisplayPolicy {
AllChannels = 1,
UnmutedChannelsAndTopics = 2,
NoChannels = 3,
}
impl WebStreamUnreadsCountDisplayPolicy {
pub const fn new() -> Self {
Self::AllChannels
}
}
impl_default!(WebStreamUnreadsCountDisplayPolicy);
impl_display!(WebStreamUnreadsCountDisplayPolicy);
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize_repr, Serialize_repr)]
pub enum DesktopIconCountDisplay {
AllUnreadMessages = 1,
DmsMentionsFollowedTopics = 2,
DmsMentions = 3,
None = 4,
}
impl DesktopIconCountDisplay {
pub const fn new() -> Self {
Self::AllUnreadMessages
}
}
impl_default!(DesktopIconCountDisplay);
impl_display!(DesktopIconCountDisplay);
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize_repr, Serialize_repr)]
pub enum RealmNameInEmailNotificationsPolicy {
Automatic = 1,
Always = 2,
Never = 3,
}
impl RealmNameInEmailNotificationsPolicy {
pub const fn new() -> Self {
Self::Automatic
}
}
impl_default!(RealmNameInEmailNotificationsPolicy);
impl_display!(RealmNameInEmailNotificationsPolicy);
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize_repr, Serialize_repr)]
pub enum AutomaticallyFollowTopicsPolicy {
Participates = 1,
SendMessages = 2,
Starts = 3,
Never = 4,
}
impl AutomaticallyFollowTopicsPolicy {
pub const fn new() -> Self {
Self::Participates
}
}
impl_default!(AutomaticallyFollowTopicsPolicy);
impl_display!(AutomaticallyFollowTopicsPolicy);
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize_repr, Serialize_repr)]
pub enum AutomaticallyUnmuteTopicsInMutedStreamsPolicy {
Participates = 1,
SendMessages = 2,
Starts = 3,
Never = 4,
}
impl AutomaticallyUnmuteTopicsInMutedStreamsPolicy {
pub const fn new() -> Self {
Self::Participates
}
}
impl_default!(AutomaticallyUnmuteTopicsInMutedStreamsPolicy);
impl_display!(AutomaticallyUnmuteTopicsInMutedStreamsPolicy);
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum ResolvedTopicNoticeAutoReadPolicy {
Always,
ExceptFollowed,
Never,
}
impl ResolvedTopicNoticeAutoReadPolicy {
pub const fn new() -> Self {
Self::Always
}
}
impl_default!(ResolvedTopicNoticeAutoReadPolicy);
impl_display!(ResolvedTopicNoticeAutoReadPolicy);
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize_repr, Serialize_repr)]
pub enum EmailAddressVisibility {
Everyone = 1,
MembersOnly = 2,
AdministratorsOnly = 3,
Nobody = 4,
ModeratorsOnly = 5,
}
impl EmailAddressVisibility {
pub const fn new() -> Self {
Self::Everyone
}
}
impl_default!(EmailAddressVisibility);
impl_display!(EmailAddressVisibility);