fcm_service/domain/android_config/
android_notification.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4use super::{
5    light_settings::LightSettings, notification_priority::NotificationPriority,
6    visibility::Visibility,
7};
8use crate::domain::android_config::proxy::Proxy;
9#[derive(Serialize, Deserialize, Default, Clone, Debug)]
10pub struct AndroidNotification {
11    title: Option<String>,
12    body: Option<String>,
13    icon: Option<String>,
14    color: Option<String>,
15    sound: Option<String>,
16    tag: Option<String>,
17    click_action: Option<String>,
18    body_loc_key: Option<String>,
19    body_loc_key_args: Option<Vec<String>>,
20    title_loc_key: Option<String>,
21    title_loc_key_args: Option<Vec<String>>,
22    channel_id: Option<String>,
23    ticker: Option<String>,
24    sticky: Option<bool>,
25    event_time: Option<DateTime<Utc>>,
26    local_only: Option<bool>,
27    notification_priority: Option<NotificationPriority>,
28    default_sound: Option<bool>,
29    default_light_settings: Option<bool>,
30    default_vibrate_timings: Option<bool>,
31    vibrate_timings: Option<Vec<String>>,
32    visibility: Option<Visibility>,
33    notification_count: Option<i32>,
34    light_settings: Option<LightSettings>,
35    image: Option<String>,
36    bypass_proxy_notification: Option<bool>,
37    proxy: Option<Proxy>,
38}
39
40impl AndroidNotification {
41    pub fn new() -> Self {
42        Self::default()
43    }
44
45    pub fn title(&self) -> Option<&String> {
46        self.title.as_ref()
47    }
48
49    pub fn body(&self) -> Option<&String> {
50        self.body.as_ref()
51    }
52
53    pub fn icon(&self) -> Option<&String> {
54        self.icon.as_ref()
55    }
56
57    pub fn color(&self) -> Option<&String> {
58        self.color.as_ref()
59    }
60
61    pub fn sound(&self) -> Option<&String> {
62        self.sound.as_ref()
63    }
64
65    pub fn tag(&self) -> Option<&String> {
66        self.tag.as_ref()
67    }
68
69    pub fn click_action(&self) -> Option<&String> {
70        self.click_action.as_ref()
71    }
72
73    pub fn body_loc_key(&self) -> Option<&String> {
74        self.body_loc_key.as_ref()
75    }
76
77    pub fn body_loc_key_args(&self) -> Option<&Vec<String>> {
78        self.body_loc_key_args.as_ref()
79    }
80
81    pub fn title_loc_key(&self) -> Option<&String> {
82        self.title_loc_key.as_ref()
83    }
84
85    pub fn title_loc_key_args(&self) -> Option<&Vec<String>> {
86        self.title_loc_key_args.as_ref()
87    }
88
89    pub fn channel_id(&self) -> Option<&String> {
90        self.channel_id.as_ref()
91    }
92
93    pub fn ticker(&self) -> Option<&String> {
94        self.ticker.as_ref()
95    }
96
97    pub fn sticky(&self) -> Option<&bool> {
98        self.sticky.as_ref()
99    }
100
101    pub fn event_time(&self) -> Option<&DateTime<Utc>> {
102        self.event_time.as_ref()
103    }
104
105    pub fn local_only(&self) -> Option<&bool> {
106        self.local_only.as_ref()
107    }
108
109    pub fn notification_priority(&self) -> Option<&NotificationPriority> {
110        self.notification_priority.as_ref()
111    }
112
113    pub fn default_sound(&self) -> Option<&bool> {
114        self.default_sound.as_ref()
115    }
116
117    pub fn default_light_settings(&self) -> Option<&bool> {
118        self.default_light_settings.as_ref()
119    }
120
121    pub fn default_vibrate_timings(&self) -> Option<&bool> {
122        self.default_vibrate_timings.as_ref()
123    }
124
125    pub fn vibrate_timings(&self) -> Option<&Vec<String>> {
126        self.vibrate_timings.as_ref()
127    }
128
129    pub fn visibility(&self) -> Option<&Visibility> {
130        self.visibility.as_ref()
131    }
132
133    pub fn notification_count(&self) -> Option<&i32> {
134        self.notification_count.as_ref()
135    }
136
137    pub fn light_settings(&self) -> Option<&LightSettings> {
138        self.light_settings.as_ref()
139    }
140
141    pub fn image(&self) -> Option<&String> {
142        self.image.as_ref()
143    }
144
145    pub fn bypass_proxy_notification(&self) -> Option<&bool> {
146        self.bypass_proxy_notification.as_ref()
147    }
148
149    pub fn proxy(&self) -> Option<&Proxy> {
150        self.proxy.as_ref()
151    }
152
153    pub fn set_title(&mut self, title: Option<String>) {
154        self.title = title;
155    }
156
157    pub fn set_body(&mut self, body: Option<String>) {
158        self.body = body;
159    }
160
161    pub fn set_icon(&mut self, icon: Option<String>) {
162        self.icon = icon;
163    }
164
165    pub fn set_color(&mut self, color: Option<String>) {
166        self.color = color;
167    }
168
169    pub fn set_sound(&mut self, sound: Option<String>) {
170        self.sound = sound;
171    }
172
173    pub fn set_tag(&mut self, tag: Option<String>) {
174        self.tag = tag;
175    }
176
177    pub fn set_click_action(&mut self, click_action: Option<String>) {
178        self.click_action = click_action;
179    }
180
181    pub fn set_body_loc_key(&mut self, body_loc_key: Option<String>) {
182        self.body_loc_key = body_loc_key;
183    }
184
185    pub fn set_body_loc_key_args(&mut self, body_loc_key_args: Option<Vec<String>>) {
186        self.body_loc_key_args = body_loc_key_args;
187    }
188
189    pub fn set_title_loc_key(&mut self, title_loc_key: Option<String>) {
190        self.title_loc_key = title_loc_key;
191    }
192
193    pub fn set_title_loc_key_args(&mut self, title_loc_key_args: Option<Vec<String>>) {
194        self.title_loc_key_args = title_loc_key_args;
195    }
196
197    pub fn set_channel_id(&mut self, channel_id: Option<String>) {
198        self.channel_id = channel_id;
199    }
200
201    pub fn set_ticker(&mut self, ticker: Option<String>) {
202        self.ticker = ticker;
203    }
204
205    pub fn set_sticky(&mut self, sticky: Option<bool>) {
206        self.sticky = sticky;
207    }
208
209    pub fn set_event_time(&mut self, event_time: Option<DateTime<Utc>>) {
210        self.event_time = event_time;
211    }
212
213    pub fn set_local_only(&mut self, local_only: Option<bool>) {
214        self.local_only = local_only;
215    }
216
217    pub fn set_notification_priority(
218        &mut self,
219        notification_priority: Option<NotificationPriority>,
220    ) {
221        self.notification_priority = notification_priority;
222    }
223
224    pub fn set_default_sound(&mut self, default_sound: Option<bool>) {
225        self.default_sound = default_sound;
226    }
227
228    pub fn set_default_light_settings(&mut self, default_light_settings: Option<bool>) {
229        self.default_light_settings = default_light_settings;
230    }
231
232    pub fn set_default_vibrate_timings(&mut self, default_vibrate_timings: Option<bool>) {
233        self.default_vibrate_timings = default_vibrate_timings;
234    }
235
236    pub fn set_vibrate_timings(&mut self, vibrate_timings: Option<Vec<String>>) {
237        self.vibrate_timings = vibrate_timings;
238    }
239
240    pub fn set_visibility(&mut self, visibility: Option<Visibility>) {
241        self.visibility = visibility;
242    }
243
244    pub fn set_notification_count(&mut self, notification_count: Option<i32>) {
245        self.notification_count = notification_count;
246    }
247
248    pub fn set_light_settings(&mut self, light_settings: Option<LightSettings>) {
249        self.light_settings = light_settings;
250    }
251
252    pub fn set_image(&mut self, image: Option<String>) {
253        self.image = image;
254    }
255
256    pub fn set_bypass_proxy_notification(&mut self, bypass_proxy_notification: Option<bool>) {
257        self.bypass_proxy_notification = bypass_proxy_notification;
258    }
259
260    pub fn set_proxy(&mut self, proxy: Option<Proxy>) {
261        self.proxy = proxy;
262    }
263}