Skip to main content

automapper_validation/generated/fv2610/
invoic_conditions_fv2610.rs

1// <auto-generated>
2// Generated by automapper-generator generate-conditions
3// AHB: xml-migs-and-ahbs/FV2610/INVOIC_AHB_1_0b_20260401.xml
4// Generated: 2026-04-22T18:10:21Z
5// Delegates unchanged conditions to InvoicConditionEvaluatorFV2510 (FV2510).
6// </auto-generated>
7
8#![allow(clippy::style, clippy::complexity)]
9
10#[allow(unused_imports)]
11use crate::eval::format_validators::*;
12use crate::eval::{ConditionEvaluator, ConditionResult, EvaluationContext};
13use crate::generated::fv2510::InvoicConditionEvaluatorFV2510;
14
15/// Condition evaluator for INVOIC FV2610.
16///
17/// Delegates to [`InvoicConditionEvaluatorFV2510`] for conditions whose AHB description is
18/// unchanged from that version. Local overrides: [5, 6, 56, 90, 527, 903, 2000].
19pub struct InvoicConditionEvaluatorFV2610 {
20    fallback: InvoicConditionEvaluatorFV2510,
21}
22
23impl Default for InvoicConditionEvaluatorFV2610 {
24    fn default() -> Self {
25        Self {
26            fallback: InvoicConditionEvaluatorFV2510::default(),
27        }
28    }
29}
30
31/// Condition IDs whose implementation differs from the fallback.
32const FV2610_OVERRIDES: &[u32] = &[5, 6, 56, 90, 527, 903, 2000];
33
34impl ConditionEvaluator for InvoicConditionEvaluatorFV2610 {
35    fn message_type(&self) -> &str {
36        "INVOIC"
37    }
38
39    fn format_version(&self) -> &str {
40        "FV2610"
41    }
42
43    fn evaluate(&self, condition: u32, ctx: &EvaluationContext) -> ConditionResult {
44        match condition {
45            5 => self.evaluate_5(ctx),
46            6 => self.evaluate_6(ctx),
47            56 => self.evaluate_56(ctx),
48            90 => self.evaluate_90(ctx),
49            527 => self.evaluate_527(ctx),
50            903 => self.evaluate_903(ctx),
51            2000 => self.evaluate_2000(ctx),
52            other => self.fallback.evaluate(other, ctx),
53        }
54    }
55
56    fn is_external(&self, condition: u32) -> bool {
57        self.fallback.is_external(condition)
58    }
59
60    fn is_known(&self, condition: u32) -> bool {
61        FV2610_OVERRIDES.contains(&condition) || self.fallback.is_known(condition)
62    }
63}
64
65impl InvoicConditionEvaluatorFV2610 {
66    /// [5] Wenn NAD+MR DE3207 &lt;&gt; "DE"
67    fn evaluate_5(&self, ctx: &EvaluationContext) -> ConditionResult {
68        match ctx.has_qualified_value("NAD", 0, "MR", 8, 0, &["DE"]) {
69            ConditionResult::True => ConditionResult::False,
70            ConditionResult::False => ConditionResult::True,
71            ConditionResult::Unknown => ConditionResult::Unknown,
72        }
73    }
74
75    /// [6] Wenn NAD+MR DE3207 = "DE"
76    fn evaluate_6(&self, ctx: &EvaluationContext) -> ConditionResult {
77        ctx.has_qualified_value("NAD", 0, "MR", 8, 0, &["DE"])
78    }
79
80    /// [56] Wenn DTM+137 (Nachrichtendatum) ≥ 1.1.2023 0:00 gesetzlicher deutscher Zeit
81    fn evaluate_56(&self, ctx: &EvaluationContext) -> ConditionResult {
82        ctx.dtm_ge("137", "202301010000")
83    }
84
85    /// [90] Der Wert muss &lt; 01.01.2027 00:00 Uhr gesetzlicher deutscher Zeit sein
86    // REVIEW: Der Wert targets the current field value. Uses format_check to prefer ctx.resolved_value (tree-based path) with string comparison on the first 12 characters (CCYYMMDDHHMM) to handle potential timezone suffixes. January 1 is in CET (UTC+1) so local 00:00 is the threshold. Confidence medium because the fallback segment tag 'DTM' and element position 0/1 are assumed from INVOIC context. (medium confidence)
87    fn evaluate_90(&self, ctx: &EvaluationContext) -> ConditionResult {
88        ctx.format_check("DTM", 0, 1, |val| {
89            let comparable = val.get(..12).unwrap_or(val);
90            ConditionResult::from(!comparable.is_empty() && comparable < "202701010000")
91        })
92    }
93
94    /// [527] Hinweis: Es ist die Umsatzsteuer- bzw. Steuernummer anzugeben, die vorher per PARTIN ausgetauscht wurde.
95    fn evaluate_527(&self, _ctx: &EvaluationContext) -> ConditionResult {
96        // Hinweis: Es ist die Umsatzsteuer- bzw. Steuernummer anzugeben, die vorher per PARTIN ausgetauscht wurde.
97        ConditionResult::True
98    }
99
100    /// [903] Format: Möglicher Wert: 1
101    fn evaluate_903(&self, ctx: &EvaluationContext) -> ConditionResult {
102        if let Some(val) = ctx.resolved_value {
103            return ConditionResult::from(val == "1");
104        }
105        ConditionResult::Unknown
106    }
107
108    /// [2000] Segmentgruppe ist genau einmal anzugeben.
109    fn evaluate_2000(&self, _ctx: &EvaluationContext) -> ConditionResult {
110        // Segmentgruppe ist genau einmal anzugeben — informational cardinality constraint
111        ConditionResult::True
112    }
113}