ddex_core/models/graph/
release.rs

1// core/src/models/graph/release.rs
2//! Release types
3
4use super::Artist;
5use crate::models::{
6    common::{Identifier, LocalizedString},
7    AttributeMap, Comment, Extensions,
8};
9use chrono::{DateTime, Utc};
10use serde::{Deserialize, Serialize};
11
12#[derive(Debug, Clone, Serialize, Deserialize)]
13pub struct Release {
14    pub release_reference: String,
15    pub release_id: Vec<Identifier>,
16    pub release_title: Vec<LocalizedString>,
17    pub release_subtitle: Option<Vec<LocalizedString>>,
18    pub release_type: Option<ReleaseType>,
19    pub genre: Vec<Genre>,
20    pub release_resource_reference_list: Vec<ReleaseResourceReference>,
21    pub display_artist: Vec<Artist>,
22    pub party_list: Vec<ReleaseParty>,
23    pub release_date: Vec<ReleaseEvent>,
24    pub territory_code: Vec<String>,
25    pub excluded_territory_code: Vec<String>,
26    /// All XML attributes (standard and custom)
27    pub attributes: Option<AttributeMap>,
28    /// Extensions for release
29    pub extensions: Option<Extensions>,
30    /// Comments associated with release
31    pub comments: Option<Vec<Comment>>,
32}
33
34#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
35pub enum ReleaseType {
36    Album,
37    Single,
38    EP,
39    Compilation,
40    Other(String),
41}
42
43#[derive(Debug, Clone, Serialize, Deserialize)]
44pub struct Genre {
45    pub genre_text: String,
46    pub sub_genre: Option<String>,
47    /// All XML attributes (standard and custom)
48    pub attributes: Option<AttributeMap>,
49    /// Extensions for genre
50    pub extensions: Option<Extensions>,
51    /// Comments associated with genre
52    pub comments: Option<Vec<Comment>>,
53}
54
55#[derive(Debug, Clone, Serialize, Deserialize)]
56pub struct ReleaseResourceReference {
57    pub resource_reference: String,
58    pub sequence_number: Option<i32>,
59    pub disc_number: Option<i32>,
60    pub track_number: Option<i32>,
61    pub side: Option<String>,
62    pub is_hidden: bool,
63    pub is_bonus: bool,
64    /// Extensions for resource reference
65    pub extensions: Option<Extensions>,
66    /// Comments associated with resource reference
67    pub comments: Option<Vec<Comment>>,
68}
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
71pub struct ReleaseParty {
72    pub party_reference: String,
73    pub role: Vec<String>,
74    /// Extensions for release party
75    pub extensions: Option<Extensions>,
76    /// Comments associated with release party
77    pub comments: Option<Vec<Comment>>,
78}
79
80#[derive(Debug, Clone, Serialize, Deserialize)]
81pub struct ReleaseEvent {
82    pub release_event_type: String,
83    pub event_date: Option<DateTime<Utc>>,
84    pub territory: Option<String>,
85    /// Extensions for release event
86    pub extensions: Option<Extensions>,
87    /// Comments associated with release event
88    pub comments: Option<Vec<Comment>>,
89}