media_tools/models/
media_profile.rs1use agent_storage::{FamilyId, UserId};
3use serde::{Deserialize, Serialize};
4
5use super::MediaProfileId;
6
7#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
12pub struct MediaProfile {
13 pub id: MediaProfileId,
14 #[serde(default)]
15 pub family_id: Option<FamilyId>,
16 #[serde(default)]
17 pub owner_id: Option<UserId>,
18 pub name: String,
19 pub user_id: Option<UserId>,
20 pub active: bool,
21}
22
23impl MediaProfile {
24 pub fn new(family_id: FamilyId, name: impl Into<String>) -> Self {
25 Self {
26 id: MediaProfileId::new(),
27 family_id: Some(family_id),
28 owner_id: None,
29 name: name.into(),
30 user_id: None,
31 active: true,
32 }
33 }
34
35 pub fn new_personal(owner_id: UserId, name: impl Into<String>) -> Self {
37 Self {
38 id: MediaProfileId::new(),
39 family_id: None,
40 owner_id: Some(owner_id),
41 name: name.into(),
42 user_id: None,
43 active: true,
44 }
45 }
46}