ddex_core/models/graph/
header.rs

1// core/src/models/graph/header.rs
2//! Message header types
3
4use serde::{Deserialize, Serialize};
5use chrono::{DateTime, Utc};
6use crate::models::{Extensions, Comment, AttributeMap, common::{Identifier, LocalizedString}};
7
8#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct MessageHeader {
10    pub message_id: String,
11    pub message_type: MessageType,
12    pub message_created_date_time: DateTime<Utc>,
13    pub message_sender: MessageSender,
14    pub message_recipient: MessageRecipient,
15    pub message_control_type: Option<MessageControlType>,
16    pub message_thread_id: Option<String>,
17    /// All XML attributes (standard and custom)
18    pub attributes: Option<AttributeMap>,
19    /// Extensions for message header
20    pub extensions: Option<Extensions>,
21    /// Comments associated with message header
22    pub comments: Option<Vec<Comment>>,
23}
24
25#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
26pub enum MessageType {
27    NewReleaseMessage,
28    UpdateReleaseMessage,
29    TakedownMessage,
30}
31
32#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
33pub enum MessageControlType {
34    LiveMessage,
35    TestMessage,
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
39pub struct MessageSender {
40    pub party_id: Vec<Identifier>,
41    pub party_name: Vec<LocalizedString>,
42    pub trading_name: Option<String>,
43    /// All XML attributes (standard and custom)
44    pub attributes: Option<AttributeMap>,
45    /// Extensions for message sender
46    pub extensions: Option<Extensions>,
47    /// Comments associated with message sender
48    pub comments: Option<Vec<Comment>>,
49}
50
51#[derive(Debug, Clone, Serialize, Deserialize)]
52pub struct MessageRecipient {
53    pub party_id: Vec<Identifier>,
54    pub party_name: Vec<LocalizedString>,
55    pub trading_name: Option<String>,
56    /// All XML attributes (standard and custom)
57    pub attributes: Option<AttributeMap>,
58    /// Extensions for message recipient
59    pub extensions: Option<Extensions>,
60    /// Comments associated with message recipient
61    pub comments: Option<Vec<Comment>>,
62}