ddex_core/models/graph/
release.rs

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