Skip to main content

automapper_validation/generated/fv2510/
partin_conditions_fv2510.rs

1// <auto-generated>
2// Generated by automapper-generator generate-conditions
3// AHB: xml-migs-and-ahbs/FV2510/PARTIN_AHB_1_0e_20241001.xml
4// Generated: 2026-03-12T10:51:21Z
5// </auto-generated>
6
7// LLM-produced bodies aren't idiomatic Rust — silence stylistic lints at
8// file scope so `cargo clippy -D warnings` stays green. Correctness,
9// suspicious, and perf categories stay on so real bugs still surface.
10#![allow(clippy::style, clippy::complexity)]
11
12#[allow(unused_imports)]
13use crate::eval::format_validators::*;
14use crate::eval::{ConditionEvaluator, ConditionResult, EvaluationContext};
15
16/// Generated condition evaluator for PARTIN FV2510.
17pub struct PartinConditionEvaluatorFV2510 {
18    // External condition IDs that require runtime context.
19    external_conditions: std::collections::HashSet<u32>,
20}
21
22impl Default for PartinConditionEvaluatorFV2510 {
23    fn default() -> Self {
24        let mut external_conditions = std::collections::HashSet::new();
25        external_conditions.insert(1);
26        external_conditions.insert(2);
27        external_conditions.insert(4);
28        external_conditions.insert(5);
29        external_conditions.insert(17);
30        external_conditions.insert(18);
31        external_conditions.insert(19);
32        external_conditions.insert(20);
33        external_conditions.insert(21);
34        external_conditions.insert(22);
35        external_conditions.insert(23);
36        external_conditions.insert(24);
37        external_conditions.insert(25);
38        external_conditions.insert(26);
39        external_conditions.insert(35);
40        external_conditions.insert(36);
41        Self {
42            external_conditions,
43        }
44    }
45}
46
47impl ConditionEvaluator for PartinConditionEvaluatorFV2510 {
48    fn message_type(&self) -> &str {
49        "PARTIN"
50    }
51
52    fn format_version(&self) -> &str {
53        "FV2510"
54    }
55
56    fn evaluate(&self, condition: u32, ctx: &EvaluationContext) -> ConditionResult {
57        match condition {
58            1 => self.evaluate_1(ctx),
59            2 => self.evaluate_2(ctx),
60            3 => self.evaluate_3(ctx),
61            4 => self.evaluate_4(ctx),
62            5 => self.evaluate_5(ctx),
63            6 => self.evaluate_6(ctx),
64            7 => self.evaluate_7(ctx),
65            8 => self.evaluate_8(ctx),
66            10 => self.evaluate_10(ctx),
67            11 => self.evaluate_11(ctx),
68            12 => self.evaluate_12(ctx),
69            13 => self.evaluate_13(ctx),
70            14 => self.evaluate_14(ctx),
71            15 => self.evaluate_15(ctx),
72            16 => self.evaluate_16(ctx),
73            17 => self.evaluate_17(ctx),
74            18 => self.evaluate_18(ctx),
75            19 => self.evaluate_19(ctx),
76            20 => self.evaluate_20(ctx),
77            21 => self.evaluate_21(ctx),
78            22 => self.evaluate_22(ctx),
79            23 => self.evaluate_23(ctx),
80            24 => self.evaluate_24(ctx),
81            25 => self.evaluate_25(ctx),
82            26 => self.evaluate_26(ctx),
83            27 => self.evaluate_27(ctx),
84            28 => self.evaluate_28(ctx),
85            29 => self.evaluate_29(ctx),
86            30 => self.evaluate_30(ctx),
87            31 => self.evaluate_31(ctx),
88            32 => self.evaluate_32(ctx),
89            33 => self.evaluate_33(ctx),
90            34 => self.evaluate_34(ctx),
91            35 => self.evaluate_35(ctx),
92            36 => self.evaluate_36(ctx),
93            490 => self.evaluate_490(ctx),
94            491 => self.evaluate_491(ctx),
95            494 => self.evaluate_494(ctx),
96            500 => self.evaluate_500(ctx),
97            501 => self.evaluate_501(ctx),
98            502 => self.evaluate_502(ctx),
99            503 => self.evaluate_503(ctx),
100            504 => self.evaluate_504(ctx),
101            505 => self.evaluate_505(ctx),
102            506 => self.evaluate_506(ctx),
103            508 => self.evaluate_508(ctx),
104            908 => self.evaluate_908(ctx),
105            931 => self.evaluate_931(ctx),
106            932 => self.evaluate_932(ctx),
107            933 => self.evaluate_933(ctx),
108            939 => self.evaluate_939(ctx),
109            940 => self.evaluate_940(ctx),
110            _ => ConditionResult::Unknown,
111        }
112    }
113
114    fn is_external(&self, condition: u32) -> bool {
115        self.external_conditions.contains(&condition)
116    }
117    fn is_known(&self, condition: u32) -> bool {
118        matches!(
119            condition,
120            1 | 2
121                | 3
122                | 4
123                | 5
124                | 6
125                | 7
126                | 8
127                | 10
128                | 11
129                | 12
130                | 13
131                | 14
132                | 15
133                | 16
134                | 17
135                | 18
136                | 19
137                | 20
138                | 21
139                | 22
140                | 23
141                | 24
142                | 25
143                | 26
144                | 27
145                | 28
146                | 29
147                | 30
148                | 31
149                | 32
150                | 33
151                | 34
152                | 35
153                | 36
154                | 490
155                | 491
156                | 494
157                | 500
158                | 501
159                | 502
160                | 503
161                | 504
162                | 505
163                | 506
164                | 508
165                | 908
166                | 931
167                | 932
168                | 933
169                | 939
170                | 940
171        )
172    }
173}
174
175impl PartinConditionEvaluatorFV2510 {
176    /// [1] Nur MP-ID aus Sparte Strom
177    /// EXTERNAL: Requires context from outside the message.
178    fn evaluate_1(&self, ctx: &EvaluationContext) -> ConditionResult {
179        ctx.external.evaluate("mp_id_is_strom")
180    }
181
182    /// [2] Wenn der Code im DE3207 in der "EDI@Energy Codeliste der europäischen Ländercodes" in der Spalte "PLZ vorhanden" ein "X" enthält
183    /// EXTERNAL: Requires context from outside the message.
184    fn evaluate_2(&self, ctx: &EvaluationContext) -> ConditionResult {
185        ctx.external.evaluate("country_has_postal_code")
186    }
187
188    /// [4] Wenn Vorgängerversion vorhanden
189    /// EXTERNAL: Requires context from outside the message.
190    fn evaluate_4(&self, ctx: &EvaluationContext) -> ConditionResult {
191        ctx.external.evaluate("predecessor_version_exists")
192    }
193
194    /// [3] wenn vorhanden
195    fn evaluate_3(&self, _ctx: &EvaluationContext) -> ConditionResult {
196        // Hinweis: wenn vorhanden — informational annotation indicating the element is conditional/optional; always applies when evaluated
197        ConditionResult::True
198    }
199
200    /// [5] Wenn MP-ID in SG2 NAD+MR (Nachrichtenempfänger) in der Rolle LF
201    /// EXTERNAL: Requires context from outside the message.
202    fn evaluate_5(&self, ctx: &EvaluationContext) -> ConditionResult {
203        ctx.external.evaluate("recipient_is_lf")
204    }
205
206    /// [6] wenn im DE3155 im demselben COM der Code EM vorhanden ist
207    fn evaluate_6(&self, ctx: &EvaluationContext) -> ConditionResult {
208        let coms = ctx.find_segments("COM");
209        if coms.is_empty() {
210            return ConditionResult::Unknown;
211        }
212        ConditionResult::from(coms.iter().any(|s| {
213            s.elements
214                .first()
215                .and_then(|e| e.get(1))
216                .is_some_and(|v| v == "EM")
217        }))
218    }
219
220    /// [7] wenn im DE3155 im demselben COM der Code TE / FX / AJ / AL vorhanden ist
221    fn evaluate_7(&self, ctx: &EvaluationContext) -> ConditionResult {
222        let coms = ctx.find_segments("COM");
223        if coms.is_empty() {
224            return ConditionResult::Unknown;
225        }
226        ConditionResult::from(coms.iter().any(|s| {
227            s.elements
228                .first()
229                .and_then(|e| e.get(1))
230                .is_some_and(|v| matches!(v.as_str(), "TE" | "FX" | "AJ" | "AL"))
231        }))
232    }
233
234    /// [8] wenn im DE3155 im demselben COM der Code TE / FX vorhanden ist
235    fn evaluate_8(&self, ctx: &EvaluationContext) -> ConditionResult {
236        let coms = ctx.find_segments("COM");
237        if coms.is_empty() {
238            return ConditionResult::Unknown;
239        }
240        ConditionResult::from(coms.iter().any(|s| {
241            s.elements
242                .first()
243                .and_then(|e| e.get(1))
244                .is_some_and(|v| matches!(v.as_str(), "TE" | "FX"))
245        }))
246    }
247
248    /// [10] Wenn BGM DE1373 = 11 (Dokument nicht verfügbar) nicht vorhanden
249    fn evaluate_10(&self, ctx: &EvaluationContext) -> ConditionResult {
250        match ctx.find_segment("BGM") {
251            None => ConditionResult::False, // segment absent → condition not applicable
252            Some(bgm) => ConditionResult::from(
253                bgm.elements
254                    .get(4)
255                    .and_then(|e| e.first())
256                    .map(|v| v != "11")
257                    .unwrap_or(true),
258            ),
259        }
260    }
261
262    /// [11] Wenn SG4 NAD+SU (Lieferant) DE3207 mit Code „DE“ vorhanden
263    fn evaluate_11(&self, ctx: &EvaluationContext) -> ConditionResult {
264        let nads = ctx.find_segments_with_qualifier("NAD", 0, "SU");
265        match nads.first() {
266            None => ConditionResult::False, // segment absent → condition not applicable
267            Some(nad) => ConditionResult::from(
268                nad.elements
269                    .get(8)
270                    .and_then(|e| e.first())
271                    .is_some_and(|v| v == "DE"),
272            ),
273        }
274    }
275
276    /// [12] Wenn SG4 NAD+DDM (Netzbetreiber) DE3207 mit Code „DE“ vorhanden
277    fn evaluate_12(&self, ctx: &EvaluationContext) -> ConditionResult {
278        let nads = ctx.find_segments_with_qualifier("NAD", 0, "DDM");
279        match nads.first() {
280            None => ConditionResult::False, // segment absent → condition not applicable
281            Some(nad) => ConditionResult::from(
282                nad.elements
283                    .get(8)
284                    .and_then(|e| e.first())
285                    .is_some_and(|v| v == "DE"),
286            ),
287        }
288    }
289
290    /// [13] Wenn SG4 NAD+DEB (Messstellenbetreiber) DE3207 mit Code „DE“ vorhanden
291    fn evaluate_13(&self, ctx: &EvaluationContext) -> ConditionResult {
292        let nads = ctx.find_segments_with_qualifier("NAD", 0, "DEB");
293        match nads.first() {
294            None => ConditionResult::False, // segment absent → condition not applicable
295            Some(nad) => ConditionResult::from(
296                nad.elements
297                    .get(8)
298                    .and_then(|e| e.first())
299                    .is_some_and(|v| v == "DE"),
300            ),
301        }
302    }
303
304    /// [14] Wenn SG4 NAD+SU (Lieferant) DE3207 der Code „DE“ nicht vorhanden
305    fn evaluate_14(&self, ctx: &EvaluationContext) -> ConditionResult {
306        let nads = ctx.find_segments_with_qualifier("NAD", 0, "SU");
307        match nads.first() {
308            None => ConditionResult::False, // segment absent → condition not applicable
309            Some(nad) => ConditionResult::from(
310                nad.elements
311                    .get(8)
312                    .and_then(|e| e.first())
313                    .map(|v| v != "DE")
314                    .unwrap_or(true),
315            ),
316        }
317    }
318
319    /// [15] Wenn SG4 NAD+DDM (Netzbetreiber) DE3207 der Code „DE“ nicht vorhanden
320    fn evaluate_15(&self, ctx: &EvaluationContext) -> ConditionResult {
321        let nads = ctx.find_segments_with_qualifier("NAD", 0, "DDM");
322        match nads.first() {
323            None => ConditionResult::False, // segment absent → condition not applicable
324            Some(nad) => ConditionResult::from(
325                nad.elements
326                    .get(8)
327                    .and_then(|e| e.first())
328                    .map(|v| v != "DE")
329                    .unwrap_or(true),
330            ),
331        }
332    }
333
334    /// [16] Wenn SG4 NAD+DEB (Messstellenbetreiber) DE3207 der Code „DE“ nicht vorhanden
335    fn evaluate_16(&self, ctx: &EvaluationContext) -> ConditionResult {
336        let nads = ctx.find_segments_with_qualifier("NAD", 0, "DEB");
337        match nads.first() {
338            None => ConditionResult::False, // segment absent → condition not applicable
339            Some(nad) => ConditionResult::from(
340                nad.elements
341                    .get(8)
342                    .and_then(|e| e.first())
343                    .map(|v| v != "DE")
344                    .unwrap_or(true),
345            ),
346        }
347    }
348
349    /// [17] Wenn MP-ID in SG2 NAD+MR (Nachrichtenempfänger) in der Rolle LF/NB/MSB
350    /// EXTERNAL: Requires context from outside the message.
351    fn evaluate_17(&self, ctx: &EvaluationContext) -> ConditionResult {
352        ctx.external.evaluate("recipient_is_lf_nb_msb")
353    }
354
355    /// [18] Wenn MP-ID in SG2 NAD+MR (Nachrichtenempfänger) in der Rolle LF/MSB
356    /// EXTERNAL: Requires context from outside the message.
357    fn evaluate_18(&self, ctx: &EvaluationContext) -> ConditionResult {
358        ctx.external.evaluate("recipient_is_lf_msb")
359    }
360
361    /// [19] Wenn MP-ID in SG2 NAD+MR (Nachrichtenempfänger) in der Rolle LF/MSB/NB/ÜNB
362    /// EXTERNAL: Requires context from outside the message.
363    fn evaluate_19(&self, ctx: &EvaluationContext) -> ConditionResult {
364        ctx.external.evaluate("recipient_is_lf_msb_nb_uenb")
365    }
366
367    /// [20] Wenn MP-ID in SG2 NAD+MR (Nachrichtenempfänger) in der Rolle LF/MSB/ÜNB
368    /// EXTERNAL: Requires context from outside the message.
369    fn evaluate_20(&self, ctx: &EvaluationContext) -> ConditionResult {
370        ctx.external.evaluate("recipient_is_lf_msb_uenb")
371    }
372
373    /// [21] Wenn MP-ID in SG2 NAD+MR (Nachrichtenempfänger) in der Rolle LF/NB/ESA
374    /// EXTERNAL: Requires context from outside the message.
375    fn evaluate_21(&self, ctx: &EvaluationContext) -> ConditionResult {
376        ctx.external.evaluate("recipient_is_lf_nb_esa")
377    }
378
379    /// [22] Wenn MP-ID in SG2 NAD+MR (Nachrichtenempfänger) in der Rolle MSB
380    /// EXTERNAL: Requires context from outside the message.
381    fn evaluate_22(&self, ctx: &EvaluationContext) -> ConditionResult {
382        ctx.external.evaluate("recipient_is_msb")
383    }
384
385    /// [23] Wenn MP-ID in SG2 NAD+MR (Nachrichtenempfänger) in der Rolle NB/ÜNB
386    /// EXTERNAL: Requires context from outside the message.
387    fn evaluate_23(&self, ctx: &EvaluationContext) -> ConditionResult {
388        ctx.external.evaluate("recipient_is_nb_uenb")
389    }
390
391    /// [24] Wenn MP-ID in SG2 NAD+MR (Nachrichtenempfänger) in der Rolle NB/LF/MSB/ESA
392    /// EXTERNAL: Requires context from outside the message.
393    fn evaluate_24(&self, ctx: &EvaluationContext) -> ConditionResult {
394        ctx.external.evaluate("recipient_is_nb_lf_msb_esa")
395    }
396
397    /// [25] Wenn MP-ID in SG2 NAD+MR (Nachrichtenempfänger) in der Rolle NB
398    /// EXTERNAL: Requires context from outside the message.
399    fn evaluate_25(&self, ctx: &EvaluationContext) -> ConditionResult {
400        ctx.external.evaluate("recipient_is_nb")
401    }
402
403    /// [26] Wenn MP-ID in SG2 NAD+MR (Nachrichtenempfänger) in der Rolle NB/LF/BKV/BIKO
404    /// EXTERNAL: Requires context from outside the message.
405    fn evaluate_26(&self, ctx: &EvaluationContext) -> ConditionResult {
406        ctx.external.evaluate("recipient_is_nb_lf_bkv_biko")
407    }
408
409    /// [27] Wenn SG4 NAD+Z31 (Übertragungsnetzbetreiber) DE3207 mit Code „DE“ vorhanden
410    fn evaluate_27(&self, ctx: &EvaluationContext) -> ConditionResult {
411        ctx.has_qualified_value("NAD", 0, "Z31", 8, 0, &["DE"])
412    }
413
414    /// [28] Wenn SG4 NAD+Z34 (Bilanzkoordinator) DE3207 mit Code „DE“ vorhanden
415    fn evaluate_28(&self, ctx: &EvaluationContext) -> ConditionResult {
416        ctx.has_qualified_value("NAD", 0, "Z34", 8, 0, &["DE"])
417    }
418
419    /// [29] Wenn SG4 NAD+Z35 (Bilanzkreisverantwortlicher) DE3207 mit Code „DE“ vorhanden
420    fn evaluate_29(&self, ctx: &EvaluationContext) -> ConditionResult {
421        ctx.has_qualified_value("NAD", 0, "Z35", 8, 0, &["DE"])
422    }
423
424    /// [30] Wenn SG4 NAD+Z36 (Energieserviceanbieter) DE3207 mit Code „DE“ vorhanden
425    fn evaluate_30(&self, ctx: &EvaluationContext) -> ConditionResult {
426        ctx.has_qualified_value("NAD", 0, "Z36", 8, 0, &["DE"])
427    }
428
429    /// [31] Wenn SG4 NAD+Z31 (Übertragungsnetzbetreiber) DE3207 mit Code „DE“ nicht vorhanden
430    fn evaluate_31(&self, ctx: &EvaluationContext) -> ConditionResult {
431        match ctx.has_qualified_value("NAD", 0, "Z31", 8, 0, &["DE"]) {
432            ConditionResult::True => ConditionResult::False,
433            ConditionResult::False => ConditionResult::True,
434            ConditionResult::Unknown => ConditionResult::Unknown,
435        }
436    }
437
438    /// [32] Wenn SG4 NAD+Z34 (Bilanzkoordinator) DE3207 mit Code „DE“ nicht vorhanden
439    fn evaluate_32(&self, ctx: &EvaluationContext) -> ConditionResult {
440        let nads = ctx.find_segments_with_qualifier("NAD", 0, "Z34");
441        if nads.is_empty() {
442            return ConditionResult::True;
443        }
444        let has_de = nads.iter().any(|s| {
445            s.elements
446                .get(8)
447                .and_then(|e| e.first())
448                .is_some_and(|v| v == "DE")
449        });
450        ConditionResult::from(!has_de)
451    }
452
453    /// [33] Wenn SG4 NAD+Z35 (Bilanzkreisverantwortlicher) DE3207 mit Code „DE“ nicht vorhanden
454    fn evaluate_33(&self, ctx: &EvaluationContext) -> ConditionResult {
455        let nads = ctx.find_segments_with_qualifier("NAD", 0, "Z35");
456        if nads.is_empty() {
457            return ConditionResult::True;
458        }
459        let has_de = nads.iter().any(|s| {
460            s.elements
461                .get(8)
462                .and_then(|e| e.first())
463                .is_some_and(|v| v == "DE")
464        });
465        ConditionResult::from(!has_de)
466    }
467
468    /// [34] Wenn SG4 NAD+Z36 (Energieserviceanbieter) DE3207 mit Code „DE“ nicht vorhanden
469    fn evaluate_34(&self, ctx: &EvaluationContext) -> ConditionResult {
470        let nads = ctx.find_segments_with_qualifier("NAD", 0, "Z36");
471        if nads.is_empty() {
472            return ConditionResult::True;
473        }
474        let has_de = nads.iter().any(|s| {
475            s.elements
476                .get(8)
477                .and_then(|e| e.first())
478                .is_some_and(|v| v == "DE")
479        });
480        ConditionResult::from(!has_de)
481    }
482
483    /// [35] Wenn MP-ID in SG2 NAD+MR (Nachrichtenempfänger) in der Rolle ÜNB
484    /// EXTERNAL: Requires context from outside the message.
485    fn evaluate_35(&self, ctx: &EvaluationContext) -> ConditionResult {
486        ctx.external.evaluate("recipient_is_uenb")
487    }
488
489    /// [36] Wenn MP-ID in SG2 NAD+MR (Nachrichtenempfänger) in der Rolle BKV
490    /// EXTERNAL: Requires context from outside the message.
491    fn evaluate_36(&self, ctx: &EvaluationContext) -> ConditionResult {
492        ctx.external.evaluate("recipient_is_bkv")
493    }
494
495    /// [490] wenn Wert in diesem DE, an der Stelle CCYYMMDD ein Datum aus dem angegeben Zeitraum der Tabelle Kapitel 3.5 „Prozesszeitpunkt bei MESZ mit UTC“ ist
496    fn evaluate_490(&self, ctx: &EvaluationContext) -> ConditionResult {
497        match ctx.resolved_value {
498            Some(val) => is_mesz_utc(val),
499            None => ConditionResult::False,
500        }
501    }
502
503    /// [491] wenn Wert in diesem DE, an der Stelle CCYYMMDD ein Datum aus dem angegeben Zeitraum der Tabelle Kapitel 3.6 „Prozesszeitpunkt bei MEZ mit UTC“ ist
504    fn evaluate_491(&self, ctx: &EvaluationContext) -> ConditionResult {
505        match ctx.resolved_value {
506            Some(val) => is_mez_utc(val),
507            None => ConditionResult::False,
508        }
509    }
510
511    /// [494] Das hier genannte Datum muss der Zeitpunkt sein, zu dem das Dokument erstellt wurde, oder ein Zeitpunkt, der davor liegt.
512    // REVIEW: This condition states the referenced date must be the document creation timestamp or earlier. Verifying this would require knowing the actual document creation time as an external reference point, which is not present in the EDIFACT message itself. The phrasing describes a semantic constraint on the field's value origin rather than a checkable boolean predicate from message content. Treated as an always-true informational annotation similar to a Hinweis, since the field by definition carries the value the sender chose as the document date. (medium confidence)
513    fn evaluate_494(&self, _ctx: &EvaluationContext) -> ConditionResult {
514        // Hinweis: Das hier genannte Datum muss der Zeitpunkt sein, zu dem das Dokument erstellt wurde, oder ein Zeitpunkt, der davor liegt.
515        // This is a semantic annotation about what the date field must represent (document creation time or earlier).
516        // It cannot be evaluated as a boolean predicate from the EDIFACT message content alone.
517        ConditionResult::True
518    }
519
520    /// [500] Hinweis: Es kann der Firmenname eines Dienstleisters oder die identische Firmenbezeichnung aus SG4 NAD+SU / DDM / DEB / Z31 / Z34 / Z35 / Z36 eingetragen werden.
521    fn evaluate_500(&self, _ctx: &EvaluationContext) -> ConditionResult {
522        // Hinweis: Es kann der Firmenname eines Dienstleisters oder die identische Firmenbezeichnung aus SG4 NAD+SU / DDM / DEB / Z31 / Z34 / Z35 / Z36 eingetragen werden.
523        // Informational note about allowed name values — always applies.
524        ConditionResult::True
525    }
526
527    /// [501] Hinweis: Es darf kein Name einer natürlichen Person übermittelt werden, stattdessen ist die organisatorische Einheit im Unternehmen zu nennen.
528    fn evaluate_501(&self, _ctx: &EvaluationContext) -> ConditionResult {
529        // Hinweis: Es darf kein Name einer natürlichen Person übermittelt werden, stattdessen ist die organisatorische Einheit im Unternehmen zu nennen.
530        // Informational note about data privacy — no natural person names, use organisational unit — always applies.
531        ConditionResult::True
532    }
533
534    /// [502] Hinweis: Es darf nur eine Information im DE3148 übermittelt werden
535    fn evaluate_502(&self, _ctx: &EvaluationContext) -> ConditionResult {
536        // Hinweis: Es darf nur eine Information im DE3148 übermittelt werden.
537        // Informational note about cardinality of DE3148 — only one value may be transmitted — always applies.
538        ConditionResult::True
539    }
540
541    /// [503] Hinweis: Angabe erfolgt in gesetzlicher deutscher Zeit
542    fn evaluate_503(&self, _ctx: &EvaluationContext) -> ConditionResult {
543        // Hinweis: Angabe erfolgt in gesetzlicher deutscher Zeit — informational note, always applies
544        ConditionResult::True
545    }
546
547    /// [504] Hinweis: Es ist mindestens die Umsatzsteuer- bzw. Steuernummer zu nennen, die in der INVOIC genutzt wird.
548    fn evaluate_504(&self, _ctx: &EvaluationContext) -> ConditionResult {
549        // Hinweis: Es ist mindestens die Umsatzsteuer- bzw. Steuernummer zu nennen — informational note, always applies
550        ConditionResult::True
551    }
552
553    /// [505] Wenn eine Vorgängerversion (RFF+ACW) angegeben ist, so muss der Wert in diesem DE1056 mindestens um 1 höher sein, als der Wert aus DE1056 der Vorgängerversion (RFF+ACW).
554    // REVIEW: When RFF+ACW (predecessor version) is present, compare DE1056 (elements[0][3]) of RFF+AGK (current version) against DE1056 of RFF+ACW. Condition is True when current version is at least 1 higher than predecessor. Returns False when no ACW present (condition does not apply), Unknown if version numbers cannot be parsed. (medium confidence)
555    fn evaluate_505(&self, ctx: &EvaluationContext) -> ConditionResult {
556        let acw_segments = ctx.find_segments_with_qualifier("RFF", 0, "ACW");
557        if acw_segments.is_empty() {
558            return ConditionResult::False;
559        }
560        let agk_segments = ctx.find_segments_with_qualifier("RFF", 0, "AGK");
561        let current_version = agk_segments
562            .first()
563            .and_then(|s| s.elements.first())
564            .and_then(|e| e.get(3))
565            .and_then(|v| v.parse::<i64>().ok());
566        let predecessor_version = acw_segments
567            .first()
568            .and_then(|s| s.elements.first())
569            .and_then(|e| e.get(3))
570            .and_then(|v| v.parse::<i64>().ok());
571        match (current_version, predecessor_version) {
572            (Some(cur), Some(pred)) => ConditionResult::from(cur >= pred + 1),
573            _ => ConditionResult::Unknown,
574        }
575    }
576
577    /// [506] Hinweis: Das Datenelement ist so zu füllen, dass sein Inhalt den Vorgaben des USt.-Gesetzes genügt, so dass der Empfänger diese Daten in einer INVOIC nutzen kann.
578    fn evaluate_506(&self, _ctx: &EvaluationContext) -> ConditionResult {
579        // Hinweis: Das Datenelement ist so zu füllen, dass sein Inhalt den Vorgaben des USt.-Gesetzes genügt — informational note, always applies
580        ConditionResult::True
581    }
582
583    /// [508] Hinweis: Der LF in seiner Funktion als Grund- und Ersatzversorger muss den NB, in deren Netzgebiet der LF als Grund- und Ersatzversorger ist, einen Bilanzkreis für verbrauchende Marktlokationen ü...
584    fn evaluate_508(&self, _ctx: &EvaluationContext) -> ConditionResult {
585        // Hinweis: Der LF als Grund- und Ersatzversorger muss dem NB einen Bilanzkreis übermitteln — informational note, always applies
586        ConditionResult::True
587    }
588
589    /// [908] Format: Mögliche Werte: 1 bis n
590    fn evaluate_908(&self, _ctx: &EvaluationContext) -> ConditionResult {
591        // Format: Mögliche Werte: 1 bis n — informational cardinality note, always applies
592        ConditionResult::True
593    }
594
595    /// [931] Format: ZZZ = +00
596    fn evaluate_931(&self, ctx: &EvaluationContext) -> ConditionResult {
597        ctx.format_check("DTM", 0, 1, validate_timezone_utc)
598    }
599
600    /// [932] Format: HHMM = 2200
601    fn evaluate_932(&self, ctx: &EvaluationContext) -> ConditionResult {
602        ctx.format_check("DTM", 0, 1, |val| validate_hhmm_equals(val, "2200"))
603    }
604
605    /// [933] Format: HHMM = 2300
606    fn evaluate_933(&self, ctx: &EvaluationContext) -> ConditionResult {
607        ctx.format_check("DTM", 0, 1, |val| validate_hhmm_equals(val, "2300"))
608    }
609
610    /// [939] Format: Die Zeichenkette muss die Zeichen @ und . enthalten
611    fn evaluate_939(&self, ctx: &EvaluationContext) -> ConditionResult {
612        ctx.format_check("COM", 0, 0, validate_email)
613    }
614
615    /// [940] Format: Die Zeichenkette muss mit dem Zeichen + beginnen und danach dürfen nur noch Ziffern folgen
616    fn evaluate_940(&self, ctx: &EvaluationContext) -> ConditionResult {
617        ctx.format_check("COM", 0, 0, validate_phone)
618    }
619}