swift_mt_message/fields/
field12.rs

1//! # Field 12: Sub Message Type
2//!
3//! ## Purpose
4//! Specifies a sub-message type or additional message categorization code that supplements
5//! the main MT message type. This field provides further classification within a message
6//! category, enabling more precise message routing and processing.
7//!
8//! ## Format Specification
9//! - **Swift Format**: `3!n`
10//! - **Description**: Exactly 3 numeric digits
11//! - **Character Set**: 0-9 only, no alphabetic characters
12//! - **Range**: Valid codes depend on parent message type and business context
13//!
14//! ## Presence and Usage
15//! - **Status**: Optional in most contexts, mandatory when sub-classification is required
16//! - **Swift Error Codes**: T12 (invalid format), T50 (invalid sub-type code)
17//! - **Usage Context**: Varies by message type and processing requirements
18//!
19//! ## Business Applications
20//! ### Message Classification
21//! - **Sub-Classification**: Provides additional categorization within main message type
22//! - **Processing Logic**: Used by routing and processing systems for message handling
23//! - **Validation**: Must be valid sub-type code for the specific message context
24//! - **System Integration**: Enables automated processing based on sub-type classification
25//!
26//! ### Network Processing
27//! - **Message Routing**: Determines specific processing paths within message categories
28//! - **System Processing**: Enables automated handling based on sub-type requirements
29//! - **Compliance**: May be required for certain regulatory or business requirements
30//! - **Integration**: Facilitates system-to-system communication with precise message typing
31//!
32//! ## Network Validation Rules
33//! - **Format Validation**: Must be exactly 3 numeric digits
34//! - **Code Validation**: Sub-type code must be valid for the message context
35//! - **Processing Rules**: Used by SWIFT network for routing and validation decisions
36//! - **Context Verification**: Sub-type must be appropriate for business scenario
37//!
38//! ## Common Sub-Type Codes
39//! - **103**: Customer credit transfer variant
40//! - **102**: Multiple customer credit transfer
41//! - **950**: Statement message variant
42//! - **001**: Standard processing
43//!
44//! ## Regional Considerations
45//! - **Local Variations**: Some regions may use specific sub-type codes
46//! - **Processing Standards**: Different markets may have preferred sub-type classifications
47//! - **Regulatory Requirements**: Certain jurisdictions may mandate specific sub-types
48//! - **System Integration**: Local clearing systems may require specific sub-type codes
49//!
50//! ## Processing Impact
51//! - **Routing Decisions**: Influences how messages are routed through SWIFT network
52//! - **Validation Rules**: May trigger specific validation requirements
53//! - **STP Processing**: Can affect straight-through processing capabilities
54//! - **Exception Handling**: Determines appropriate exception handling procedures
55//!
56//! ## Error Prevention Guidelines
57//! - **Code Validation**: Verify sub-type code is valid for message context
58//! - **Format Checking**: Ensure exactly 3 numeric digits
59//! - **Context Validation**: Confirm sub-type is appropriate for business scenario
60//! - **System Compatibility**: Check receiving system supports the sub-type code
61//!
62//! ## Related Fields Integration
63//! - **Block 2**: Application Header (contains main message type)
64//! - **Field 11**: MT Reference (may reference messages with specific sub-types)
65//! - **Message Body**: Other fields may have dependencies on sub-type classification
66//!
67//! ## See Also
68//! - Swift FIN User Handbook: Message Type Classification
69//! - Network Rules: Sub-Message Type Standards
70//! - Processing Guidelines: Sub-Type Routing Rules
71//! - System Integration Guide: Sub-Type Code Usage
72
73use serde::{Deserialize, Serialize};
74use swift_mt_message_macros::SwiftField;
75
76/// **Field 12: Sub Message Type**
77///
78/// Sub-message type classification variant of [Field 12 module](index.html). Provides additional
79/// categorization within main MT message types for precise routing and processing.
80///
81/// **Components:**
82/// - Type code (3!n, exactly 3 numeric digits)
83///
84/// For complete documentation, see the [Field 12 module](index.html).
85#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
86pub struct Field12 {
87    /// Sub-message type or categorization code
88    ///
89    /// Format: 3!n - Exactly 3 numeric digits (0-9)
90    /// Used for additional message classification within main MT type
91    #[component("3!n")]
92    pub type_code: String,
93}