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