swift_mt_message/fields/field53.rs
1use serde::{Deserialize, Serialize};
2use swift_mt_message_macros::SwiftField;
3
4/// **Field 53: Sender's Correspondent**
5///
6/// ## Purpose
7/// Specifies the account or branch of the Sender through which reimbursement will occur
8/// in correspondent banking arrangements. This field defines the reimbursement path between
9/// the Sender and Receiver, enabling proper settlement coordination in cross-border payments.
10/// Critical for establishing clear correspondent banking relationships and settlement flows.
11///
12/// ## Format Options Overview
13/// - **Option A**: BIC with optional party identifier - structured correspondent identification
14/// - **Option B**: Party identifier with location - domestic correspondent routing
15/// - **Option D**: Party identifier with name/address - detailed correspondent information
16///
17/// ## Business Context Applications
18/// - **Reimbursement Routing**: Defines settlement path between correspondent banks
19/// - **Nostro Account Management**: Specifies accounts used for correspondent settlements
20/// - **Currency Settlement**: Enables currency-specific correspondent arrangements
21/// - **Cross-Border Payments**: Essential for international payment routing and settlement
22///
23/// ## Usage Rules and Conditions
24/// - **Conditional Presence**: Required when no direct account relationship exists (Rule C4)
25/// - **Direct Relationships**: Omitted when unique bilateral account relationship exists
26/// - **Multiple Accounts**: Option B with party identifier when multiple accounts exist
27/// - **Cover Messages**: May trigger MT 202 COV requirement for certain configurations
28///
29/// ## Network Validation Requirements
30/// - **BIC Registration**: All BIC codes must be registered financial institutions
31/// - **Account Validity**: Party identifiers must reference valid correspondent accounts
32/// - **Reachability**: Correspondent institutions must be operational and reachable
33/// - **Currency Support**: Correspondents must support transaction currency
34///
35/// ## Correspondent Banking Logic
36/// ### Direct Account Relationships
37/// - **Unique Accounts**: When only one account exists, field may be omitted
38/// - **Bilateral Agreements**: Pre-agreed account arrangements remove field requirement
39/// - **Standard Currencies**: Common currency pairs with established relationships
40///
41/// ### Multiple Account Scenarios
42/// - **Currency-Specific**: Different correspondents for different currencies
43/// - **Service-Specific**: Specialized correspondents for different services
44/// - **Geographic**: Regional correspondents for specific market coverage
45/// - **Risk Management**: Diversified correspondent relationships for risk mitigation
46///
47/// ## Cover Message Requirements
48/// - **Non-Receiver Branch**: Field 53A containing non-Receiver branch triggers cover message
49/// - **MT 202 COV**: Cover payment message required for certain correspondent configurations
50/// - **Settlement Coordination**: Ensures proper settlement through correspondent network
51/// - **Regulatory Compliance**: Meets regulatory requirements for payment transparency
52///
53/// ## Regional Considerations
54/// - **European Networks**: TARGET2 correspondent arrangements and SEPA integration
55/// - **US Systems**: Fedwire correspondent relationships and dollar clearing
56/// - **Asian Markets**: Regional correspondent networks and local currency clearing
57/// - **Cross-Border**: Multi-currency correspondent arrangements and settlement
58///
59/// ## Risk Management Applications
60/// - **Counterparty Risk**: Correspondent bank risk assessment and management
61/// - **Settlement Risk**: Mitigation through established correspondent relationships
62/// - **Operational Risk**: Backup correspondent arrangements for business continuity
63/// - **Regulatory Risk**: Compliance with correspondent banking regulations
64///
65/// ## STP Processing Benefits
66/// - **Automated Routing**: System-driven correspondent routing based on clear identification
67/// - **Settlement Efficiency**: Streamlined settlement through established relationships
68/// - **Exception Reduction**: Proper correspondent identification reduces processing delays
69/// - **Straight-Through Processing**: Enhanced STP rates through structured correspondent data
70///
71/// ## Error Prevention Guidelines
72/// - **Relationship Verification**: Confirm correspondent relationships are active
73/// - **Account Validation**: Verify correspondent accounts are operational
74/// - **Currency Checking**: Ensure correspondent supports transaction currency
75/// - **Format Compliance**: Exact adherence to option format requirements
76///
77/// ## Related Fields Integration
78/// - **Field 52A**: Ordering Institution (institutional hierarchy)
79/// - **Field 54A**: Receiver's Correspondent (settlement coordination)
80/// - **Field 57A**: Account With Institution (final delivery arrangement)
81/// - **Field 32A**: Value Date, Currency, Amount (settlement details)
82///
83/// ## Compliance Framework
84/// - **Correspondent Due Diligence**: Enhanced due diligence on correspondent relationships
85/// - **Regulatory Reporting**: Correspondent banking relationship reporting requirements
86/// - **AML Compliance**: Anti-money laundering considerations in correspondent banking
87/// - **Sanctions Screening**: Correspondent bank sanctions screening requirements
88///
89/// ## Settlement Coordination
90/// - **Nostro Management**: Coordination with nostro account balances and limits
91/// - **Value Dating**: Alignment with correspondent value dating practices
92/// - **Cut-off Times**: Coordination with correspondent processing cut-offs
93/// - **Holiday Calendars**: Consideration of correspondent market holidays
94///
95/// ## See Also
96/// - Swift FIN User Handbook: Sender's Correspondent Specifications
97/// - Correspondent Banking Guidelines: Relationship Management Standards
98/// - Settlement Systems: Cross-Border Settlement Mechanisms
99/// - Risk Management: Correspondent Banking Risk Assessment
100///
101/// **Field 53A: Sender's Correspondent (BIC with Party Identifier)**
102///
103/// Structured correspondent identification using BIC code with optional party identifier.
104/// Preferred option for automated correspondent banking processing.
105#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
106pub struct Field53A {
107 /// Optional party identifier for correspondent account reference
108 ///
109 /// Format: \[/1!a\]\[/34x\] - Single character code + up to 34 character identifier
110 /// Used for nostro account identification and correspondent routing
111 #[component("[/1!a][/34x]")]
112 pub party_identifier: Option<String>,
113
114 /// Bank Identifier Code of the sender's correspondent
115 ///
116 /// Format: 4!a2!a2!c\[3!c\] - 8 or 11 character BIC code
117 /// Must be registered financial institution BIC
118 #[component("4!a2!a2!c[3!c]")]
119 pub bic: String,
120}
121
122/// **Field 53B: Sender's Correspondent (Party Identifier with Location)**
123///
124/// Domestic correspondent routing using party identifier and location details.
125/// Used when multiple correspondent accounts exist and location-based routing is required.
126#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
127pub struct Field53B {
128 /// Optional party identifier for correspondent account reference
129 ///
130 /// Format: \[/1!a\]\[/34x\] - Single character code + up to 34 character identifier
131 /// Used for nostro account identification when multiple accounts exist
132 #[component("[/1!a][/34x]")]
133 pub party_identifier: Option<String>,
134
135 /// Location information for correspondent routing
136 ///
137 /// Format: \[35x\] - Up to 35 character location identifier
138 /// Used for location-based correspondent routing within domestic systems
139 #[component("[35x]")]
140 pub location: Option<String>,
141}
142
143/// **Field 53D: Sender's Correspondent (Party Identifier with Name and Address)**
144///
145/// Detailed correspondent identification with full name and address information.
146/// Used when structured BIC identification is not available for correspondent.
147#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
148pub struct Field53D {
149 /// Optional party identifier for correspondent account reference
150 ///
151 /// Format: \[/1!a\]\[/34x\] - Single character code + up to 34 character identifier
152 /// Used for nostro account identification and correspondent routing
153 #[component("[/1!a][/34x]")]
154 pub party_identifier: Option<String>,
155
156 /// Name and address of the sender's correspondent
157 ///
158 /// Format: 4*35x - Up to 4 lines of 35 characters each
159 /// Contains correspondent name, address, city, country details
160 #[component("4*35x")]
161 pub name_and_address: Vec<String>,
162}
163
164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, SwiftField)]
165pub enum Field53SenderCorrespondent {
166 A(Field53A),
167 B(Field53B),
168 D(Field53D),
169}