use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct NotificationItem {
title: String,
message: Option<String>,
url: Option<String>,
icon: Option<String>,
}
impl NotificationItem {
pub fn new(title: &str) -> Self {
NotificationItem {
title: title.to_string(),
message: None,
url: None,
icon: None,
}
}
pub fn with_args(title: &str, message: &str, url: &str, icon: &str) -> Self {
NotificationItem {
title: title.to_string(),
message: Some(message.to_string()),
url: Some(url.to_string()),
icon: Some(icon.to_string()),
}
}
pub fn title(mut self, title: &str) -> Self {
self.title = title.to_string();
self
}
pub fn message(mut self, message: &str) -> Self {
self.message = Some(message.to_string());
self
}
pub fn url(mut self, url: &str) -> Self {
self.url = Some(url.to_string());
self
}
pub fn icon(mut self, icon: &str) -> Self {
self.icon = Some(icon.to_string());
self
}
}