swift_mt_message/messages/mt196.rs
1use crate::fields::*;
2use serde::{Deserialize, Serialize};
3use swift_mt_message_macros::{SwiftMessage, serde_swift_fields};
4
5/// MT196: Answers
6///
7/// ## Purpose
8/// Used to provide comprehensive answers and responses to various queries and requests related to customer
9/// payments and transactions. This flexible message format serves as the standard response mechanism for
10/// payment inquiries, cancellation requests, and status updates in the SWIFT payment ecosystem.
11///
12/// ## Scope
13/// This message is:
14/// - Used for responses to queries about payment status, cancellation requests, and transaction inquiries
15/// - Applicable for structured answers with detailed information and resolution status
16/// - Designed for flexible narrative content supporting various inquiry types
17/// - Compatible with automated and manual response generation systems
18/// - Subject to validation rules for proper reference tracking and response formatting
19/// - Integrated with customer service and payment processing workflow systems
20///
21/// ## Key Features
22/// - **Comprehensive Query Response**: Structured response to various types of payment inquiries and requests
23/// - **Reference Tracking System**: Direct links to original query or request messages
24/// - **Detailed Narrative Content**: Field 76 for comprehensive explanatory information and answers
25/// - **Status Resolution Information**: Clear indication of query resolution and processing outcomes
26/// - **Flexible Response Format**: Adaptable to different types of customer payment inquiries and scenarios
27/// - **Audit Trail Support**: Complete documentation of inquiry resolution for compliance and tracking
28///
29/// ## Common Use Cases
30/// - Response to MT192 cancellation requests with approval or rejection status
31/// - Status updates on payment processing and execution outcomes
32/// - Detailed inquiry responses about transaction details and processing steps
33/// - Error resolution and clarification messages for payment issues
34/// - Customer service communications for payment-related questions
35/// - Regulatory inquiry responses for compliance and audit purposes
36/// - Technical problem resolution and system status communications
37///
38/// ## Message Structure
39/// - **Field 20**: Sender's Reference (mandatory) - Unique reference for response message
40/// - **Field 21**: Related Reference (mandatory) - Reference to original query or request message
41/// - **Field 76**: Answers (mandatory) - Detailed response content and status information
42/// - **Field 77A**: Proprietary Message (optional) - Additional proprietary information for specific scenarios
43/// - **Field 11**: Message Type and Date (optional) - Reference to original message type and processing date
44/// - **Field 79**: Narrative (optional) - Additional explanatory text and detailed information
45///
46/// ## Network Validation Rules
47/// - **Reference Format Validation**: Reference fields must not start/end with '/' or contain '//'
48/// - **Mutual Exclusivity**: Field 79 and original message field copies cannot both be present
49/// - **Field 11 Format**: Field 11 must have proper format when present (minimum 8 characters)
50/// - **Answer Content Validation**: Field 76 must contain valid answer codes and non-empty content
51/// - **Reference Consistency**: All references must be consistent with original inquiry message
52/// - **Response Completeness**: All mandatory fields must be present with valid content
53/// - **Format Compliance**: All fields must comply with SWIFT format specifications
54///
55/// ## SRG2025 Status
56/// - **Structural Changes**: None - MT196 format remains stable for answer and response processing
57/// - **Validation Updates**: Enhanced validation for response completeness and reference accuracy
58/// - **Processing Improvements**: Improved handling of automated response generation
59/// - **Compliance Notes**: Strengthened requirements for audit trail and regulatory response documentation
60///
61/// ## Integration Considerations
62/// - **Banking Systems**: Compatible with customer service systems and payment processing platforms
63/// - **API Integration**: RESTful API support for modern digital banking response systems
64/// - **Processing Requirements**: Supports both automated and manual response generation workflows
65/// - **Compliance Integration**: Built-in validation for regulatory response requirements and documentation
66///
67/// ## Relationship to Other Messages
68/// - **Triggers**: Directly triggered by MT192 cancellation requests and various payment inquiry messages
69/// - **Responses**: Provides definitive responses to inquiries, completing request-response workflows
70/// - **Related**: Works with payment messages, customer service systems, and audit platforms
71/// - **Alternatives**: Direct system notifications for internal processing status updates
72/// - **Status Updates**: Final response message in inquiry and request resolution lifecycle
73#[serde_swift_fields]
74#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftMessage)]
75#[validation_rules(MT196_VALIDATION_RULES)]
76pub struct MT196 {
77 #[field("20")]
78 pub field_20: Field20,
79
80 #[field("21")]
81 pub field_21: Field21NoOption,
82
83 #[field("76")]
84 pub field_76: Field76,
85
86 #[field("77A")]
87 pub field_77a: Option<Field77A>,
88
89 #[field("11")]
90 pub field_11: Option<Field11>,
91
92 #[field("79")]
93 pub field_79: Option<Field79>,
94}
95
96/// Enhanced validation rules for MT196
97const MT196_VALIDATION_RULES: &str = r#"{
98 "rules": [
99 {
100 "id": "C1",
101 "description": "Only one of the following may be present: Field 79, or a copy of mandatory fields of the original message",
102 "condition": {
103 "!!": {"var": "fields.79"}
104 }
105 }
106 ]
107}"#;