ddex_core/models/versions/
common.rs

1// core/src/models/versions/common.rs
2//! Common types for version-specific models
3
4use serde::{Deserialize, Serialize};
5use chrono::{DateTime, Utc};
6
7/// Common ValidityPeriod for 4.2+
8#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct ValidityPeriod42 {
10    pub start_date: Option<DateTime<Utc>>,
11    pub end_date: Option<DateTime<Utc>>,
12}
13
14/// Common ValidityPeriod for 4.3
15pub type ValidityPeriod43 = ValidityPeriod42;
16
17/// Common MessageControlType for 4.3
18#[derive(Debug, Clone, Serialize, Deserialize)]
19pub enum MessageControlType43 {
20    LiveMessage,
21    TestMessage,
22    DevelopmentMessage,
23}
24
25/// Common PartyDescriptor for 4.3
26#[derive(Debug, Clone, Serialize, Deserialize)]
27pub struct PartyDescriptor43 {
28    pub party_name: Vec<crate::models::common::LocalizedString>,
29    pub party_id: Vec<crate::models::common::Identifier>,
30    pub trading_name: Option<String>,
31}
32
33/// Common MessageAuditTrail for 4.3
34#[derive(Debug, Clone, Serialize, Deserialize)]
35pub struct MessageAuditTrail43 {
36    pub message_audit_trail_event: Vec<MessageAuditTrailEvent43>,
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
40pub struct MessageAuditTrailEvent43 {
41    pub message_audit_trail_event_type: String,
42    pub date_time: DateTime<Utc>,
43    pub responsible_party_reference: Option<String>,
44}
45
46/// Territory code for 4.3
47#[derive(Debug, Clone, Serialize, Deserialize)]
48pub struct TerritoryCode43 {
49    pub territory_code: String,
50    pub excluded: bool,
51}
52
53/// Distribution channel for 4.3
54#[derive(Debug, Clone, Serialize, Deserialize)]
55pub struct DistributionChannel43 {
56    pub distribution_channel_type: String,
57    pub distribution_channel_name: Option<String>,
58}
59
60/// Price information for 4.3
61#[derive(Debug, Clone, Serialize, Deserialize)]
62pub struct PriceInformation43 {
63    pub price_type: String,
64    pub price_range_type: Option<String>,
65    pub price: Price43,
66}
67
68#[derive(Debug, Clone, Serialize, Deserialize)]
69pub struct Price43 {
70    pub amount: f64,
71    pub currency_code: String,
72    pub price_tier: Option<String>,
73}