ddex_core/models/graph/
header.rs

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