zoe_app_primitives/group/events/
settings.rs1use serde::{Deserialize, Serialize};
2
3use super::permissions::GroupPermissions;
4
5#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)]
9pub struct GroupSettings {
10 pub permissions: GroupPermissions,
12 pub encryption_settings: EncryptionSettings,
14}
15
16#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)]
20pub struct EncryptionSettings {
21 pub key_rotation_enabled: bool,
26
27 pub key_rotation_interval: Option<u64>,
31}
32
33impl GroupSettings {
34 pub fn new() -> Self {
36 Self::default()
37 }
38
39 pub fn permissions(mut self, permissions: GroupPermissions) -> Self {
41 self.permissions = permissions;
42 self
43 }
44
45 pub fn encryption_settings(mut self, settings: EncryptionSettings) -> Self {
47 self.encryption_settings = settings;
48 self
49 }
50}
51
52impl EncryptionSettings {
53 pub fn new() -> Self {
55 Self::default()
56 }
57
58 pub fn with_key_rotation(mut self, interval_seconds: u64) -> Self {
60 self.key_rotation_enabled = true;
61 self.key_rotation_interval = Some(interval_seconds);
62 self
63 }
64}