1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
mod segment;
use edifact_types_macros::{DisplayEdifact, DisplayEdifactSg, DisplayOuterSegment};
pub use segment::*;
mod types;
use serde::{Deserialize, Serialize};
use std::fmt;
pub use types::*;

#[cfg(test)]
mod test_coprar;

#[cfg(test)]
mod test_segment;

/// Container discharge/loading order message
///
/// https://service.unece.org/trade/untdid/d95b/trmd/coprar_d.htm#MESDEF
#[derive(Debug, Serialize, Deserialize, Default, Clone, DisplayEdifact)]
pub struct Coprar {
    pub unh: Unh,
    pub bgm: Bgm,
    pub ftx: Vec<Ftx>,
    pub rff: Vec<Rff>,
    pub sg1: CoprarSg1,
    pub sg2: Vec<CoprarSg2>,
    pub sg3: Vec<CoprarSg3>,
    pub cnt: Cnt,
    pub unt: Unt,
}

#[derive(Debug, Serialize, Deserialize, Default, Clone, DisplayEdifactSg)]
pub struct CoprarSg1 {
    pub tdt: Tdt,
    pub rff: Vec<Rff>,
    pub loc: Vec<Loc>,
    pub dtm: Vec<Dtm>,
    pub ftx: Vec<Ftx>,
}

#[derive(Debug, Serialize, Deserialize, Default, Clone, DisplayEdifactSg)]
pub struct CoprarSg2 {
    pub nad: Nad,
    pub cta: Cta,
}

#[derive(Debug, Serialize, Deserialize, Default, Clone, DisplayEdifactSg)]
pub struct CoprarSg3 {
    pub eqd: Eqd,
    pub rff: Vec<Rff>,
    pub eqn: Vec<Eqn>,
    pub tmd: Vec<Tmd>,
    pub dtm: Vec<Dtm>,
    pub loc: Vec<Loc>,
    pub mea: Vec<Mea>,
    pub dim: Vec<Dim>,
    pub tmp: Vec<Tmp>,
    pub rng: Vec<Rng>,
    pub sel: Vec<Sel>,
    pub ftx: Vec<Ftx>,
    pub dgs: Vec<Dgs>,
    pub eqa: Vec<Eqa>,
    pub sg4: Option<CoprarSg3Sg4>,
    pub nad: Option<Nad>,
}

#[derive(Debug, Serialize, Deserialize, Default, Clone, DisplayEdifactSg)]
pub struct CoprarSg3Sg4 {
    pub tdt: Tdt,
    pub rff: Option<Rff>,
    pub loc: Option<Loc>,
    pub dtm: Option<Dtm>,
}