swift_mt_message/fields/
field61.rs

1use chrono::NaiveDate;
2use serde::{Deserialize, Serialize};
3use swift_mt_message_macros::SwiftField;
4
5/// # Field 61: Statement Line
6/// Format: 6!n[4!n]2a[1!a]15d4!a2!a[16x][34x] (complex composite format)
7/// Validation: date_format, valid_date_range, debit_credit_indicator, amount_format, reference_format
8#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
9pub struct Field61 {
10    /// Value date (6!n format, YYMMDD)
11    #[component("6!n", validate = ["date_format", "valid_date_range"])]
12    pub value_date: NaiveDate,
13
14    /// Optional entry date (4!n format, MMDD)
15    #[component("4!n", optional, validate = ["date_format"])]
16    pub entry_date: Option<String>,
17
18    /// Debit/Credit mark (2a format: D, C, RD, RC)
19    #[component("2a", validate = ["debit_credit_indicator"])]
20    pub debit_credit_mark: String,
21
22    /// Optional funds code (1!a format)
23    #[component("1!a", optional)]
24    pub funds_code: Option<char>,
25
26    /// Amount (15d format)
27    #[component("15d", validate = ["amount_format"])]
28    pub amount: f64,
29
30    /// Transaction type identification code (4!a format)
31    #[component("4!a", validate = ["reference_format"])]
32    pub transaction_type: String,
33
34    /// Customer reference (2!a format)
35    #[component("2!a", validate = ["reference_format"])]
36    pub customer_reference: String,
37
38    /// Optional bank reference (16x format, preceded by //)
39    #[component("16x", optional, validate = ["reference_format"])]
40    pub bank_reference: Option<String>,
41
42    /// Optional supplementary details (34x format)
43    #[component("34x", optional, validate = ["reference_format"])]
44    pub supplementary_details: Option<String>,
45}