use crate::types::{AlertEvent, AlertSoundConfig};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NotificationConfig {
#[serde(default = "crate::defaults::bool_false", alias = "bell_desktop")]
pub notification_bell_desktop: bool,
#[serde(default = "crate::defaults::bell_sound", alias = "bell_sound")]
pub notification_bell_sound: u8,
#[serde(default = "crate::defaults::bool_true", alias = "bell_visual")]
pub notification_bell_visual: bool,
#[serde(default = "crate::defaults::visual_bell_color")]
pub notification_visual_bell_color: [u8; 3],
#[serde(
default = "crate::defaults::bool_false",
alias = "activity_notifications"
)]
pub notification_activity_enabled: bool,
#[serde(
default = "crate::defaults::activity_threshold",
alias = "activity_threshold"
)]
pub notification_activity_threshold: u64,
#[serde(default = "crate::defaults::bool_false")]
pub anti_idle_enabled: bool,
#[serde(default = "crate::defaults::anti_idle_seconds")]
pub anti_idle_seconds: u64,
#[serde(default = "crate::defaults::anti_idle_code")]
pub anti_idle_code: u8,
#[serde(
default = "crate::defaults::bool_false",
alias = "silence_notifications"
)]
pub notification_silence_enabled: bool,
#[serde(
default = "crate::defaults::silence_threshold",
alias = "silence_threshold"
)]
pub notification_silence_threshold: u64,
#[serde(default = "crate::defaults::bool_false", alias = "session_ended")]
pub notification_session_ended: bool,
#[serde(default = "crate::defaults::bool_true")]
pub suppress_notifications_when_focused: bool,
#[serde(
default = "crate::defaults::notification_max_buffer",
alias = "max_notifications"
)]
pub notification_max_buffer: usize,
#[serde(default)]
pub alert_sounds: HashMap<AlertEvent, AlertSoundConfig>,
}
impl Default for NotificationConfig {
fn default() -> Self {
Self {
notification_bell_desktop: crate::defaults::bool_false(),
notification_bell_sound: crate::defaults::bell_sound(),
notification_bell_visual: crate::defaults::bool_true(),
notification_visual_bell_color: crate::defaults::visual_bell_color(),
notification_activity_enabled: crate::defaults::bool_false(),
notification_activity_threshold: crate::defaults::activity_threshold(),
anti_idle_enabled: crate::defaults::bool_false(),
anti_idle_seconds: crate::defaults::anti_idle_seconds(),
anti_idle_code: crate::defaults::anti_idle_code(),
notification_silence_enabled: crate::defaults::bool_false(),
notification_silence_threshold: crate::defaults::silence_threshold(),
notification_session_ended: crate::defaults::bool_false(),
suppress_notifications_when_focused: crate::defaults::bool_true(),
notification_max_buffer: crate::defaults::notification_max_buffer(),
alert_sounds: HashMap::new(),
}
}
}