Skip to main content

automapper_validation/generated/fv2610/
reqote_conditions_fv2610.rs

1// <auto-generated>
2// Generated by automapper-generator generate-conditions
3// AHB: xml-migs-and-ahbs/FV2610/REQOTE_AHB_1_2_20260401.xml
4// Generated: 2026-04-22T18:16:49Z
5// Delegates unchanged conditions to ReqoteConditionEvaluatorFV2510 (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::ReqoteConditionEvaluatorFV2510;
14
15/// Condition evaluator for REQOTE FV2610.
16///
17/// Delegates to [`ReqoteConditionEvaluatorFV2510`] for conditions whose AHB description is
18/// unchanged from that version. Local overrides: [1, 2, 16, 17, 18, 19, 20, 21, 22, 23, 24, 35, 36, 39, 40, 52, 53, 490, 491, 492, 493, 2005, 2060, 2061, 2062, 2063, 2064].
19pub struct ReqoteConditionEvaluatorFV2610 {
20    fallback: ReqoteConditionEvaluatorFV2510,
21}
22
23impl Default for ReqoteConditionEvaluatorFV2610 {
24    fn default() -> Self {
25        Self {
26            fallback: ReqoteConditionEvaluatorFV2510::default(),
27        }
28    }
29}
30
31/// Condition IDs whose implementation differs from the fallback.
32const FV2610_OVERRIDES: &[u32] = &[
33    1, 2, 16, 17, 18, 19, 20, 21, 22, 23, 24, 35, 36, 39, 40, 52, 53, 490, 491, 492, 493, 2005,
34    2060, 2061, 2062, 2063, 2064,
35];
36
37impl ConditionEvaluator for ReqoteConditionEvaluatorFV2610 {
38    fn message_type(&self) -> &str {
39        "REQOTE"
40    }
41
42    fn format_version(&self) -> &str {
43        "FV2610"
44    }
45
46    fn evaluate(&self, condition: u32, ctx: &EvaluationContext) -> ConditionResult {
47        match condition {
48            1 => self.evaluate_1(ctx),
49            2 => self.evaluate_2(ctx),
50            16 => self.evaluate_16(ctx),
51            17 => self.evaluate_17(ctx),
52            18 => self.evaluate_18(ctx),
53            19 => self.evaluate_19(ctx),
54            20 => self.evaluate_20(ctx),
55            21 => self.evaluate_21(ctx),
56            22 => self.evaluate_22(ctx),
57            23 => self.evaluate_23(ctx),
58            24 => self.evaluate_24(ctx),
59            35 => self.evaluate_35(ctx),
60            36 => self.evaluate_36(ctx),
61            39 => self.evaluate_39(ctx),
62            40 => self.evaluate_40(ctx),
63            52 => self.evaluate_52(ctx),
64            53 => self.evaluate_53(ctx),
65            490 => self.evaluate_490(ctx),
66            491 => self.evaluate_491(ctx),
67            492 => self.evaluate_492(ctx),
68            493 => self.evaluate_493(ctx),
69            2005 => self.evaluate_2005(ctx),
70            2060 => self.evaluate_2060(ctx),
71            2061 => self.evaluate_2061(ctx),
72            2062 => self.evaluate_2062(ctx),
73            2063 => self.evaluate_2063(ctx),
74            2064 => self.evaluate_2064(ctx),
75            other => self.fallback.evaluate(other, ctx),
76        }
77    }
78
79    fn is_external(&self, condition: u32) -> bool {
80        matches!(condition, 24 | 35 | 36 | 53 | 492 | 493) || self.fallback.is_external(condition)
81    }
82
83    fn is_known(&self, condition: u32) -> bool {
84        FV2610_OVERRIDES.contains(&condition) || self.fallback.is_known(condition)
85    }
86}
87
88impl ReqoteConditionEvaluatorFV2610 {
89    /// [1] Wenn DTM+203 (Ausführungsdatum) nicht vorhanden.
90    fn evaluate_1(&self, ctx: &EvaluationContext) -> ConditionResult {
91        ctx.lacks_qualifier("DTM", 0, "203")
92    }
93
94    /// [2] Wenn DTM+469 (Beginn zum (nächstmöglichen Termin)) nicht vorhanden.
95    fn evaluate_2(&self, ctx: &EvaluationContext) -> ConditionResult {
96        ctx.lacks_qualifier("DTM", 0, "469")
97    }
98
99    /// [16] Wenn SG1 RFF+Z41 (Referenznummer des Vorgangs der Anmeldung nach WiM) nicht vorhanden.
100    fn evaluate_16(&self, ctx: &EvaluationContext) -> ConditionResult {
101        ctx.lacks_qualifier("RFF", 0, "Z41")
102    }
103
104    /// [17] Wenn SG1 RFF+Z41 (Referenznummer des Vorgangs der Anmeldung nach WiM) vorhanden.
105    fn evaluate_17(&self, ctx: &EvaluationContext) -> ConditionResult {
106        ctx.has_qualifier("RFF", 0, "Z41")
107    }
108
109    /// [18] Wenn IMD++Z55 (Änderung Konfiguration) vorhanden.
110    fn evaluate_18(&self, ctx: &EvaluationContext) -> ConditionResult {
111        ctx.has_segment_matching("IMD", &[(1, 0, "Z55")])
112    }
113
114    /// [19] Wenn SG27 LIN++Z64 (Erforderliches Produkt Schaltzeitdefinitionen) vorhanden.
115    fn evaluate_19(&self, ctx: &EvaluationContext) -> ConditionResult {
116        ctx.has_segment_matching("LIN", &[(1, 0, "Z64")])
117    }
118
119    /// [20] Wenn SG27 LIN++Z65 (Erforderliches Produkt Leistungskurvendefinitionen) vorhanden.
120    fn evaluate_20(&self, ctx: &EvaluationContext) -> ConditionResult {
121        ctx.has_segment_matching("LIN", &[(1, 0, "Z65")])
122    }
123
124    /// [21] Wenn SG27 LIN++Z66 (Erforderliches Produkt Ad-hoc-Steuerkanal) vorhanden.
125    fn evaluate_21(&self, ctx: &EvaluationContext) -> ConditionResult {
126        ctx.has_segment_matching("LIN", &[(1, 0, "Z66")])
127    }
128
129    /// [22] Wenn SG27 LIN++Z67 (Erforderliches Messprodukt für Werte nach Typ 2 aus Backend) vorhanden.
130    fn evaluate_22(&self, ctx: &EvaluationContext) -> ConditionResult {
131        ctx.has_segment_matching("LIN", &[(1, 0, "Z67")])
132    }
133
134    /// [23] Wenn SG27 LIN++Z68 (Erforderliches Produkt Konfigurationserlaubnis für Werte nach Typ 2 aus SMGW) vorhanden.
135    fn evaluate_23(&self, ctx: &EvaluationContext) -> ConditionResult {
136        ctx.has_segment_matching("LIN", &[(1, 0, "Z68")])
137    }
138
139    /// [24] Wenn Produkt bestellt werden soll.
140    /// EXTERNAL: Requires context from outside the message.
141    fn evaluate_24(&self, ctx: &EvaluationContext) -> ConditionResult {
142        ctx.external.evaluate("product_to_be_ordered")
143    }
144
145    /// [35] Wenn MP-ID in SG11 NAD+MS mit Rolle LF vorhanden.
146    /// EXTERNAL: Requires context from outside the message.
147    fn evaluate_35(&self, ctx: &EvaluationContext) -> ConditionResult {
148        ctx.external.evaluate("nad_ms_has_role_lf")
149    }
150
151    /// [36] Wenn MP-ID in SG11 NAD+MS mit Rolle NB vorhanden.
152    /// EXTERNAL: Requires context from outside the message.
153    fn evaluate_36(&self, ctx: &EvaluationContext) -> ConditionResult {
154        ctx.external.evaluate("nad_ms_has_role_nb")
155    }
156
157    /// [39] Wenn im DE3155 in demselben COM der Code EM vorhanden ist.
158    fn evaluate_39(&self, ctx: &EvaluationContext) -> ConditionResult {
159        // Wenn im DE3155 in demselben COM der Code EM vorhanden ist
160        // DE3155 is the communication qualifier at COM elements[0][1]
161        ConditionResult::from(ctx.self_segment_value_equals("COM", 0, 1, "EM"))
162    }
163
164    /// [40] Wenn im DE3155 in demselben COM der Code TE / FX / AJ / AL vorhanden ist.
165    fn evaluate_40(&self, ctx: &EvaluationContext) -> ConditionResult {
166        // Wenn im DE3155 in demselben COM der Code TE / FX / AJ / AL vorhanden ist
167        // DE3155 is the communication qualifier at COM elements[0][1]
168        match ctx.self_segment_value("COM", 0, 1) {
169            Some(code) => ConditionResult::from(matches!(code, "TE" | "FX" | "AJ" | "AL")),
170            None => ConditionResult::Unknown,
171        }
172    }
173
174    /// [52] Wenn im DE3155 in demselben COM der Code TE / AL Worhanden ist.
175    fn evaluate_52(&self, ctx: &EvaluationContext) -> ConditionResult {
176        // Wenn im DE3155 in demselben COM der Code TE / AL vorhanden ist
177        // DE3155 is the communication qualifier at COM elements[0][1]
178        match ctx.self_segment_value("COM", 0, 1) {
179            Some(code) => ConditionResult::from(matches!(code, "TE" | "AL")),
180            None => ConditionResult::Unknown,
181        }
182    }
183
184    /// [53] Wenn der LF der Marktlokation der genannten Lokation im gewünschten Umsetzungszeitraum nicht zugeordnet ist.
185    /// EXTERNAL: Requires context from outside the message.
186    fn evaluate_53(&self, ctx: &EvaluationContext) -> ConditionResult {
187        ctx.external
188            .evaluate("lf_not_assigned_to_lokation_in_period")
189    }
190
191    /// [490] Wenn Wert in diesem DE, an der Stelle CCYYMMDDHHMM ein Zeitpunkt aus dem angegeben Zeitraum der Tabelle Kapitel 3.5 „Übersicht gesetzliche deutsche Sommerzeit (MESZ)“ der Spalten: „Sommerzei...
192    fn evaluate_490(&self, ctx: &EvaluationContext) -> ConditionResult {
193        // Wert an Stelle CCYYMMDDHHMM liegt in deutschem Sommerzeit-Zeitraum (MESZ) in UTC
194        ctx.format_check("DTM", 0, 1, is_mesz_utc)
195    }
196
197    /// [491] Wenn Wert in diesem DE, an der Stelle CCYYMMDDHHMM ein Zeitpunkt aus dem angegeben Zeitraum der Tabelle Kapitel 3.6 „Übersicht gesetzliche deutsche Zeit (MEZ)“ der Spalten: „Winterzeit (MEZ)...
198    fn evaluate_491(&self, ctx: &EvaluationContext) -> ConditionResult {
199        // Wert an Stelle CCYYMMDDHHMM liegt in deutschem Winterzeit-Zeitraum (MEZ) in UTC
200        ctx.format_check("DTM", 0, 1, is_mez_utc)
201    }
202
203    /// [492] Wenn MP-ID in NAD+MR aus Sparte Strom.
204    /// EXTERNAL: Requires context from outside the message.
205    fn evaluate_492(&self, ctx: &EvaluationContext) -> ConditionResult {
206        ctx.external.evaluate("nad_mr_is_strom_sector")
207    }
208
209    /// [493] Wenn MP-ID in NAD+MR aus Sparte Gas.
210    /// EXTERNAL: Requires context from outside the message.
211    // REVIEW: Whether the NAD+MR market participant ID belongs to the gas sector (Sparte Gas) cannot be determined from the EDIFACT message content alone — it requires an external market participant registry lookup. (medium confidence)
212    fn evaluate_493(&self, ctx: &EvaluationContext) -> ConditionResult {
213        ctx.external.evaluate("recipient_is_gas_sector")
214    }
215
216    /// [2005] Pro Nachricht ist die SG27 genau einmal anzugeben.
217    // REVIEW: SG27 must appear exactly once per message. LIN is the entry segment of SG27, so counting LIN instances in the SG27 group path gives the SG27 repetition count. Returns True only when exactly one SG27 is present. (medium confidence)
218    fn evaluate_2005(&self, ctx: &EvaluationContext) -> ConditionResult {
219        ConditionResult::from(ctx.count_in_group("LIN", &["SG27"]) == 1)
220    }
221
222    /// [2060] Pro Nachricht ist die SG27 LIN+Z64 (Erforderliches Produkt Schaltzeitdefinitionen) maximal einmal anzugeben.
223    // REVIEW: LIN+Z64 (Erforderliches Produkt Schaltzeitdefinitionen) may appear at most once per message in SG27. Notation LIN+Z64 means elements[0][0]=="Z64". Count via count_qualified_in_group at element index 0. Zero occurrences also satisfies <= 1. (medium confidence)
224    fn evaluate_2060(&self, ctx: &EvaluationContext) -> ConditionResult {
225        ConditionResult::from(ctx.count_qualified_in_group("LIN", 0, "Z64", &["SG27"]) <= 1)
226    }
227
228    /// [2061] Pro Nachricht ist die SG27 LIN++Z65 (Erforderliches Produkt Leistungskurvendefinitionen) maximal einmal anzugeben.
229    // REVIEW: LIN++Z65 means elements[0] is empty and elements[1][0]=="Z65". count_qualified_in_group checks element index 1 for qualifier Z65 in SG27 group. At most one occurrence satisfies the constraint. (medium confidence)
230    fn evaluate_2061(&self, ctx: &EvaluationContext) -> ConditionResult {
231        ConditionResult::from(ctx.count_qualified_in_group("LIN", 1, "Z65", &["SG27"]) <= 1)
232    }
233
234    /// [2062] Pro Nachricht ist die SG27 LIN++Z66 (Erforderliches Produkt Ad-hoc-Steuerkanal) maximal einmal anzugeben.
235    // REVIEW: LIN++Z66 means elements[1][0]=="Z66" (Ad-hoc-Steuerkanal product). Parallel to condition 2061 but for Z66. At most one occurrence per message in SG27. (medium confidence)
236    fn evaluate_2062(&self, ctx: &EvaluationContext) -> ConditionResult {
237        ConditionResult::from(ctx.count_qualified_in_group("LIN", 1, "Z66", &["SG27"]) <= 1)
238    }
239
240    /// [2063] Pro Nachricht ist die SG27 LIN++Z67 (Erforderliches Messprodukt für Werte nach Typ 2 aus Backend) maximal einmal anzugeben.
241    // REVIEW: LIN++Z67 means elements[1][0]=="Z67" (Erforderliches Messprodukt Typ 2 Backend). Parallel to 2061/2062 for Z67. At most one occurrence per message in SG27. (medium confidence)
242    fn evaluate_2063(&self, ctx: &EvaluationContext) -> ConditionResult {
243        ConditionResult::from(ctx.count_qualified_in_group("LIN", 1, "Z67", &["SG27"]) <= 1)
244    }
245
246    /// [2064] Pro Nachricht ist die SG27 LIN++Z68 (Erforderliches Produkt Konfigurationserlaubnis für Werte nach Typ 2 aus SMGW) maximal einmal anzugeben.
247    // REVIEW: LIN++Z68 means elements[1][0]=="Z68" (Konfigurationserlaubnis Typ 2 SMGW). Parallel pattern for Z68. At most one occurrence per message in SG27. (medium confidence)
248    fn evaluate_2064(&self, ctx: &EvaluationContext) -> ConditionResult {
249        ConditionResult::from(ctx.count_qualified_in_group("LIN", 1, "Z68", &["SG27"]) <= 1)
250    }
251}