iso_20022_tsmt/
tsmt_026_001_02.rs

1// Copyright 2023 Emergent Financial, LLC - All Rights Reserved
2//
3//
4// This software is licensed under the Emergent Financial Limited Public License Version 1.0
5// (EF-LPLv1). You may use, copy, modify, and distribute this software under the terms and
6// conditions of the EF-LPL. For more information, please refer to the full text of the license
7// at https://github.com/emergentfinancial/ef-lpl.
8//
9//
10// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
11// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
14// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
15// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16//
17// See ISO-20022 Intellectual Property Rights Policy at
18// <https://www.iso20022.org/intellectual-property-rights>
19// for more information.
20
21use validator::Validate;
22
23/// Returns the namespace of the schema
24pub fn namespace() -> String {
25    "urn:iso:std:iso:20022:tech:xsd:tsmt.026.001.02".to_string()
26}
27
28#[derive(
29    Debug,
30    Default,
31    Clone,
32    PartialEq,
33    ::serde::Serialize,
34    ::serde::Deserialize,
35    ::derive_builder::Builder,
36    ::validator::Validate,
37)]
38pub struct StatusChangeRequestV02 {
39    #[validate]
40    #[serde(rename = "ReqId")]
41    pub req_id: MessageIdentification1,
42    #[validate]
43    #[serde(rename = "TxId")]
44    pub tx_id: SimpleIdentificationInformation,
45    #[serde(rename = "SubmitrTxRef", skip_serializing_if = "Option::is_none")]
46    pub submitr_tx_ref: Option<SimpleIdentificationInformation>,
47    #[validate]
48    #[serde(rename = "ReqdSts")]
49    pub reqd_sts: TransactionStatus3,
50    #[serde(rename = "ReqRsn", skip_serializing_if = "Option::is_none")]
51    pub req_rsn: Option<Reason2>,
52}
53#[derive(
54    Debug,
55    Default,
56    Clone,
57    PartialEq,
58    ::serde::Serialize,
59    ::serde::Deserialize,
60    ::derive_builder::Builder,
61    ::validator::Validate,
62)]
63pub struct MessageIdentification1 {
64    #[validate]
65    #[serde(rename = "Id")]
66    pub id: Max35Text,
67    #[validate]
68    #[serde(rename = "CreDtTm")]
69    pub cre_dt_tm: IsoDateTime,
70}
71#[derive(
72    Debug,
73    Default,
74    Clone,
75    PartialEq,
76    ::serde::Serialize,
77    ::serde::Deserialize,
78    ::derive_builder::Builder,
79    ::validator::Validate,
80)]
81pub struct IsoDateTime {
82    #[serde(rename = "$text")]
83    pub value: ::chrono::DateTime<::chrono::Utc>,
84}
85#[derive(
86    Debug,
87    Default,
88    Clone,
89    PartialEq,
90    ::serde::Serialize,
91    ::serde::Deserialize,
92    ::derive_builder::Builder,
93    ::validator::Validate,
94)]
95pub struct TransactionStatus3 {
96    #[serde(rename = "Sts")]
97    pub sts: BaselineStatus2Code,
98}
99#[derive(
100    Debug,
101    Default,
102    Clone,
103    PartialEq,
104    ::serde::Serialize,
105    ::serde::Deserialize,
106    ::derive_builder::Builder,
107    ::validator::Validate,
108)]
109#[serde(rename = "Document")]
110pub struct Document {
111    #[validate]
112    #[serde(rename = "StsChngReq")]
113    pub sts_chng_req: StatusChangeRequestV02,
114    #[serde(rename = "@xmlns", default = "namespace")]
115    pub xmlns: String,
116}
117#[derive(
118    Debug,
119    Default,
120    Clone,
121    PartialEq,
122    ::serde::Serialize,
123    ::serde::Deserialize,
124    ::derive_builder::Builder,
125    ::validator::Validate,
126)]
127pub struct Reason2 {
128    #[validate]
129    #[serde(rename = "Desc")]
130    pub desc: Max140Text,
131}
132#[derive(Debug, Default, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
133pub enum BaselineStatus2Code {
134    #[serde(rename = "COMP")]
135    Comp,
136    #[serde(rename = "CLSD")]
137    Clsd,
138    #[serde(rename = "ACTV")]
139    Actv,
140    #[default]
141    Unknown,
142}
143#[derive(
144    Debug,
145    Default,
146    Clone,
147    PartialEq,
148    ::serde::Serialize,
149    ::serde::Deserialize,
150    ::derive_builder::Builder,
151    ::validator::Validate,
152)]
153pub struct Max140Text {
154    #[validate(length(min = 1, max = 140,))]
155    #[serde(rename = "$text")]
156    pub value: String,
157}
158#[derive(
159    Debug,
160    Default,
161    Clone,
162    PartialEq,
163    ::serde::Serialize,
164    ::serde::Deserialize,
165    ::derive_builder::Builder,
166    ::validator::Validate,
167)]
168pub struct Max35Text {
169    #[validate(length(min = 1, max = 35,))]
170    #[serde(rename = "$text")]
171    pub value: String,
172}
173#[derive(
174    Debug,
175    Default,
176    Clone,
177    PartialEq,
178    ::serde::Serialize,
179    ::serde::Deserialize,
180    ::derive_builder::Builder,
181    ::validator::Validate,
182)]
183pub struct SimpleIdentificationInformation {
184    #[validate]
185    #[serde(rename = "Id")]
186    pub id: Max35Text,
187}