ddex_core/models/versions/
ern_382.rs

1// core/src/models/versions/ern_382.rs
2//! ERN 3.8.2 specific model variations
3
4use chrono::{DateTime, Utc};
5use serde::{Deserialize, Serialize};
6
7/// MessageHeader for ERN 3.8.2
8#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct MessageHeader382 {
10    pub message_thread_id: String, // Required in 3.8.2
11    pub message_id: String,
12    pub message_file_name: Option<String>,
13    pub message_sender: PartyDescriptor382,
14    pub sent_on_behalf_of: Option<PartyDescriptor382>,
15    pub message_recipient: PartyDescriptor382,
16    pub message_created_date_time: DateTime<Utc>,
17    pub message_control_type: Option<String>,
18}
19
20/// PartyDescriptor for ERN 3.8.2 (simpler structure)
21#[derive(Debug, Clone, Serialize, Deserialize)]
22pub struct PartyDescriptor382 {
23    pub party_name: String,       // Single name, not array
24    pub party_id: Option<String>, // Single ID, not array
25}
26
27/// DealTerms for ERN 3.8.2 (different structure)
28#[derive(Debug, Clone, Serialize, Deserialize)]
29pub struct DealTerms382 {
30    pub commercial_model_type: String, // Single value in 3.8.2
31    pub usage: Option<Usage382>,
32    pub territory_code: Vec<String>,
33    pub excluded_territory_code: Vec<String>,
34    pub distribution_channel: Vec<String>,
35    pub price_information: Option<PriceInformation382>,
36    pub validity_period: Option<ValidityPeriod382>,
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
40pub struct Usage382 {
41    pub use_type: Vec<String>,
42    pub user_interface_type: Vec<String>,
43    pub distribution_format_type: Vec<String>,
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
47pub struct PriceInformation382 {
48    pub price_type: String,
49    pub price: Price382,
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
53pub struct Price382 {
54    pub amount: f64,
55    pub currency_code: String,
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
59pub struct ValidityPeriod382 {
60    pub start_date: DateTime<Utc>,
61    pub end_date: Option<DateTime<Utc>>,
62}
63
64/// SoundRecording for ERN 3.8.2 (no TechnicalInstantiation)
65#[derive(Debug, Clone, Serialize, Deserialize)]
66pub struct SoundRecording382 {
67    pub resource_reference: String,
68    pub resource_id: Vec<ProprietaryId382>,
69    pub title: Vec<String>,       // Not LocalizedString in 3.8.2
70    pub duration: Option<String>, // ISO 8601 duration string
71    pub creation_date: Option<String>,
72    pub mastered_date: Option<String>,
73}
74
75#[derive(Debug, Clone, Serialize, Deserialize)]
76pub struct ProprietaryId382 {
77    pub proprietary_id: String,
78    pub namespace: String,
79}