ddex_core/models/versions/
ern_43.rs

1// core/src/models/versions/ern_43.rs
2//! ERN 4.3 specific model variations (latest and most complete)
3
4use super::common::{
5    DistributionChannel43, MessageAuditTrail43, MessageControlType43, PartyDescriptor43,
6    PriceInformation43, TerritoryCode43, ValidityPeriod43,
7};
8use crate::models::common::LocalizedString;
9use chrono::{DateTime, Utc};
10use serde::{Deserialize, Serialize}; // Import from common module
11
12/// MessageHeader for ERN 4.3 (most complete)
13#[derive(Debug, Clone, Serialize, Deserialize)]
14pub struct MessageHeader43 {
15    pub message_id: String,
16    pub message_thread_id: Option<String>,
17    pub message_type: MessageType43,
18    pub message_sender: PartyDescriptor43,
19    pub message_recipient: PartyDescriptor43,
20    pub message_created_date_time: DateTime<Utc>,
21    pub message_audit_trail: Option<MessageAuditTrail43>,
22    pub message_control_type: Option<MessageControlType43>,
23    pub profile: Option<ReleaseProfile43>, // New in 4.3
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
27pub enum MessageType43 {
28    NewReleaseMessage,
29    CatalogListMessage,
30    UpdateReleaseMessage,
31    TakedownMessage, // New in 4.3
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
35pub enum ReleaseProfile43 {
36    AudioAlbumMusicOnly,
37    AudioSingle,
38    VideoAlbum,
39    VideoSingle,
40    LongFormVideo,
41    Mixed,
42}
43
44/// DealTerms for ERN 4.3 (extended structure)
45#[derive(Debug, Clone, Serialize, Deserialize)]
46pub struct DealTerms43 {
47    pub deal_reference: Option<String>,
48    pub commercial_model_type: Vec<CommercialModelType43>,
49    pub use_type: Vec<UseType43>,
50    pub territory_code: Vec<TerritoryCode43>,
51    pub distribution_channel: Vec<DistributionChannel43>,
52    pub price_information: Vec<PriceInformation43>,
53    pub validity_period: Option<ValidityPeriod43>,
54    pub pre_order_date: Option<DateTime<Utc>>, // New in 4.3
55    pub pre_order_preview_date: Option<DateTime<Utc>>, // New in 4.3
56    pub instant_gratification_date: Option<DateTime<Utc>>, // New in 4.3
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
60pub enum CommercialModelType43 {
61    PayAsYouGoModel,
62    SubscriptionModel,
63    AdSupportedModel,
64    FreeOfChargeModel, // New in 4.3
65    BundledModel,      // New in 4.3
66}
67
68#[derive(Debug, Clone, Serialize, Deserialize)]
69pub enum UseType43 {
70    Stream,
71    Download,
72    OnDemandStream,
73    NonInteractiveStream,
74    ConditionalDownload, // New in 4.3
75    TetheredDownload,    // New in 4.3
76}
77
78/// ResourceGroup introduced in ERN 4.3
79#[derive(Debug, Clone, Serialize, Deserialize)]
80pub struct ResourceGroup43 {
81    pub resource_group_reference: String,
82    pub resource_group_type: ResourceGroupType43,
83    pub resource_reference: Vec<String>,
84    pub sequence_number: Option<i32>,
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize)]
88pub enum ResourceGroupType43 {
89    MainRelease,
90    BonusResources,
91    Chapter,
92    Session,
93}
94
95/// ChapterInformation introduced in ERN 4.3
96#[derive(Debug, Clone, Serialize, Deserialize)]
97pub struct ChapterInformation43 {
98    pub chapter_reference: String,
99    pub chapter_title: Vec<LocalizedString>,
100    pub start_time: String, // ISO 8601 duration
101    pub end_time: String,
102    pub chapter_type: Option<String>,
103}