Skip to main content

automapper_validation/generated/fv2510/
remadv_conditions_fv2510.rs

1// <auto-generated>
2// Generated by automapper-generator generate-conditions
3// AHB: xml-migs-and-ahbs/FV2510/REMADV_AHB_1_0__20250401.xml
4// Generated: 2026-03-12T10:35:55Z
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::{Cluster, ConditionEvaluator, ConditionResult, EvaluationContext};
15// HAND-EDITED: shared cluster helpers for [14]/[15]/[16]/[517]/[518].
16// Preserve across regeneration — see CLAUDE.md "Codelist Providers".
17use crate::eval::ebd_cluster::{any_scoped_ajt_in_cluster, resolved_ajt_code_in_cluster};
18
19/// Generated condition evaluator for REMADV FV2510.
20pub struct RemadvConditionEvaluatorFV2510 {
21    // External condition IDs that require runtime context.
22    external_conditions: std::collections::HashSet<u32>,
23}
24
25impl Default for RemadvConditionEvaluatorFV2510 {
26    fn default() -> Self {
27        let mut external_conditions = std::collections::HashSet::new();
28        external_conditions.insert(45);
29        external_conditions.insert(492);
30        external_conditions.insert(493);
31        Self {
32            external_conditions,
33        }
34    }
35}
36
37impl ConditionEvaluator for RemadvConditionEvaluatorFV2510 {
38    fn message_type(&self) -> &str {
39        "REMADV"
40    }
41
42    fn format_version(&self) -> &str {
43        "FV2510"
44    }
45
46    fn evaluate(&self, condition: u32, ctx: &EvaluationContext) -> ConditionResult {
47        match condition {
48            2 => self.evaluate_2(ctx),
49            3 => self.evaluate_3(ctx),
50            4 => self.evaluate_4(ctx),
51            8 => self.evaluate_8(ctx),
52            9 => self.evaluate_9(ctx),
53            11 => self.evaluate_11(ctx),
54            12 => self.evaluate_12(ctx),
55            14 => self.evaluate_14(ctx),
56            15 => self.evaluate_15(ctx),
57            16 => self.evaluate_16(ctx),
58            18 => self.evaluate_18(ctx),
59            22 => self.evaluate_22(ctx),
60            26 => self.evaluate_26(ctx),
61            28 => self.evaluate_28(ctx),
62            33 => self.evaluate_33(ctx),
63            34 => self.evaluate_34(ctx),
64            35 => self.evaluate_35(ctx),
65            36 => self.evaluate_36(ctx),
66            39 => self.evaluate_39(ctx),
67            40 => self.evaluate_40(ctx),
68            41 => self.evaluate_41(ctx),
69            42 => self.evaluate_42(ctx),
70            43 => self.evaluate_43(ctx),
71            45 => self.evaluate_45(ctx),
72            47 => self.evaluate_47(ctx),
73            48 => self.evaluate_48(ctx),
74            49 => self.evaluate_49(ctx),
75            50 => self.evaluate_50(ctx),
76            51 => self.evaluate_51(ctx),
77            52 => self.evaluate_52(ctx),
78            53 => self.evaluate_53(ctx),
79            54 => self.evaluate_54(ctx),
80            55 => self.evaluate_55(ctx),
81            56 => self.evaluate_56(ctx),
82            57 => self.evaluate_57(ctx),
83            58 => self.evaluate_58(ctx),
84            59 => self.evaluate_59(ctx),
85            60 => self.evaluate_60(ctx),
86            61 => self.evaluate_61(ctx),
87            62 => self.evaluate_62(ctx),
88            63 => self.evaluate_63(ctx),
89            64 => self.evaluate_64(ctx),
90            65 => self.evaluate_65(ctx),
91            66 => self.evaluate_66(ctx),
92            67 => self.evaluate_67(ctx),
93            68 => self.evaluate_68(ctx),
94            69 => self.evaluate_69(ctx),
95            70 => self.evaluate_70(ctx),
96            71 => self.evaluate_71(ctx),
97            72 => self.evaluate_72(ctx),
98            73 => self.evaluate_73(ctx),
99            74 => self.evaluate_74(ctx),
100            75 => self.evaluate_75(ctx),
101            76 => self.evaluate_76(ctx),
102            77 => self.evaluate_77(ctx),
103            78 => self.evaluate_78(ctx),
104            79 => self.evaluate_79(ctx),
105            80 => self.evaluate_80(ctx),
106            81 => self.evaluate_81(ctx),
107            82 => self.evaluate_82(ctx),
108            83 => self.evaluate_83(ctx),
109            84 => self.evaluate_84(ctx),
110            85 => self.evaluate_85(ctx),
111            86 => self.evaluate_86(ctx),
112            87 => self.evaluate_87(ctx),
113            88 => self.evaluate_88(ctx),
114            89 => self.evaluate_89(ctx),
115            90 => self.evaluate_90(ctx),
116            91 => self.evaluate_91(ctx),
117            92 => self.evaluate_92(ctx),
118            93 => self.evaluate_93(ctx),
119            94 => self.evaluate_94(ctx),
120            95 => self.evaluate_95(ctx),
121            96 => self.evaluate_96(ctx),
122            97 => self.evaluate_97(ctx),
123            98 => self.evaluate_98(ctx),
124            99 => self.evaluate_99(ctx),
125            100 => self.evaluate_100(ctx),
126            101 => self.evaluate_101(ctx),
127            102 => self.evaluate_102(ctx),
128            103 => self.evaluate_103(ctx),
129            104 => self.evaluate_104(ctx),
130            105 => self.evaluate_105(ctx),
131            106 => self.evaluate_106(ctx),
132            107 => self.evaluate_107(ctx),
133            108 => self.evaluate_108(ctx),
134            109 => self.evaluate_109(ctx),
135            110 => self.evaluate_110(ctx),
136            111 => self.evaluate_111(ctx),
137            112 => self.evaluate_112(ctx),
138            113 => self.evaluate_113(ctx),
139            114 => self.evaluate_114(ctx),
140            115 => self.evaluate_115(ctx),
141            116 => self.evaluate_116(ctx),
142            117 => self.evaluate_117(ctx),
143            118 => self.evaluate_118(ctx),
144            119 => self.evaluate_119(ctx),
145            120 => self.evaluate_120(ctx),
146            492 => self.evaluate_492(ctx),
147            493 => self.evaluate_493(ctx),
148            501 => self.evaluate_501(ctx),
149            502 => self.evaluate_502(ctx),
150            503 => self.evaluate_503(ctx),
151            510 => self.evaluate_510(ctx),
152            511 => self.evaluate_511(ctx),
153            512 => self.evaluate_512(ctx),
154            515 => self.evaluate_515(ctx),
155            517 => self.evaluate_517(ctx),
156            518 => self.evaluate_518(ctx),
157            519 => self.evaluate_519(ctx),
158            520 => self.evaluate_520(ctx),
159            521 => self.evaluate_521(ctx),
160            523 => self.evaluate_523(ctx),
161            525 => self.evaluate_525(ctx),
162            526 => self.evaluate_526(ctx),
163            529 => self.evaluate_529(ctx),
164            533 => self.evaluate_533(ctx),
165            534 => self.evaluate_534(ctx),
166            535 => self.evaluate_535(ctx),
167            536 => self.evaluate_536(ctx),
168            537 => self.evaluate_537(ctx),
169            538 => self.evaluate_538(ctx),
170            544 => self.evaluate_544(ctx),
171            548 => self.evaluate_548(ctx),
172            549 => self.evaluate_549(ctx),
173            926 => self.evaluate_926(ctx),
174            930 => self.evaluate_930(ctx),
175            931 => self.evaluate_931(ctx),
176            939 => self.evaluate_939(ctx),
177            940 => self.evaluate_940(ctx),
178            _ => ConditionResult::Unknown,
179        }
180    }
181
182    fn is_external(&self, condition: u32) -> bool {
183        self.external_conditions.contains(&condition)
184    }
185    fn is_known(&self, condition: u32) -> bool {
186        matches!(
187            condition,
188            2 | 3
189                | 4
190                | 8
191                | 9
192                | 11
193                | 12
194                | 14
195                | 15
196                | 16
197                | 18
198                | 22
199                | 26
200                | 28
201                | 33
202                | 34
203                | 35
204                | 36
205                | 39
206                | 40
207                | 41
208                | 42
209                | 43
210                | 45
211                | 47
212                | 48
213                | 49
214                | 50
215                | 51
216                | 52
217                | 53
218                | 54
219                | 55
220                | 56
221                | 57
222                | 58
223                | 59
224                | 60
225                | 61
226                | 62
227                | 63
228                | 64
229                | 65
230                | 66
231                | 67
232                | 68
233                | 69
234                | 70
235                | 71
236                | 72
237                | 73
238                | 74
239                | 75
240                | 76
241                | 77
242                | 78
243                | 79
244                | 80
245                | 81
246                | 82
247                | 83
248                | 84
249                | 85
250                | 86
251                | 87
252                | 88
253                | 89
254                | 90
255                | 91
256                | 92
257                | 93
258                | 94
259                | 95
260                | 96
261                | 97
262                | 98
263                | 99
264                | 100
265                | 101
266                | 102
267                | 103
268                | 104
269                | 105
270                | 106
271                | 107
272                | 108
273                | 109
274                | 110
275                | 111
276                | 112
277                | 113
278                | 114
279                | 115
280                | 116
281                | 117
282                | 118
283                | 119
284                | 120
285                | 492
286                | 493
287                | 501
288                | 502
289                | 503
290                | 510
291                | 511
292                | 512
293                | 515
294                | 517
295                | 518
296                | 519
297                | 520
298                | 521
299                | 523
300                | 525
301                | 526
302                | 529
303                | 533
304                | 534
305                | 535
306                | 536
307                | 537
308                | 538
309                | 544
310                | 548
311                | 549
312                | 926
313                | 930
314                | 931
315                | 939
316                | 940
317        )
318    }
319}
320
321impl RemadvConditionEvaluatorFV2510 {
322    /// [45] Nur MP-ID aus Sparte Strom
323    /// EXTERNAL: Requires context from outside the message.
324    fn evaluate_45(&self, ctx: &EvaluationContext) -> ConditionResult {
325        ctx.external.evaluate("mp_id_is_strom")
326    }
327
328    /// [49] Wenn in dieser SG7 AJT DE4465 = A01/A05/A22/A23/A90/A96
329    fn evaluate_49(&self, ctx: &EvaluationContext) -> ConditionResult {
330        ctx.any_group_has_any_qualifier(
331            "AJT",
332            0,
333            &["A01", "A05", "A22", "A23", "A90", "A96"],
334            &["SG7"],
335        )
336    }
337
338    /// [50] Wenn in dieser SG7 AJT DE4465 = A01/A05/A18/A19/A20/A90/A96
339    fn evaluate_50(&self, ctx: &EvaluationContext) -> ConditionResult {
340        ctx.any_group_has_any_qualifier(
341            "AJT",
342            0,
343            &["A01", "A05", "A18", "A19", "A20", "A90", "A96"],
344            &["SG7"],
345        )
346    }
347
348    /// [59] Wenn SG7 AJT+A08/A99+E_0459 vorhanden
349    fn evaluate_59(&self, ctx: &EvaluationContext) -> ConditionResult {
350        {
351            let ajt_segs = ctx.find_segments("AJT");
352            let found = ajt_segs.iter().any(|s| {
353                let qual = s
354                    .elements
355                    .first()
356                    .and_then(|e| e.first())
357                    .map(|v| v.as_str());
358                let pos = s
359                    .elements
360                    .get(1)
361                    .and_then(|e| e.first())
362                    .map(|v| v.as_str());
363                matches!(qual, Some("A08") | Some("A99")) && pos == Some("E_0459")
364            });
365            ConditionResult::from(found)
366        }
367    }
368
369    /// [96] Wenn SG7 AJT+E_0503/E_1007 vorhanden
370    fn evaluate_96(&self, ctx: &EvaluationContext) -> ConditionResult {
371        ctx.any_group_has_any_qualifier("AJT", 0, &["E_0503", "E_1007"], &["SG7"])
372    }
373
374    /// [100] Wenn SG7 AJT+A01 vorhanden
375    fn evaluate_100(&self, ctx: &EvaluationContext) -> ConditionResult {
376        ctx.any_group_has_qualifier("AJT", 0, "A01", &["SG5", "SG7"])
377    }
378
379    /// [105] Wenn in diesem AJT DE1082 = E_0270
380    // REVIEW: Checks if any AJT segment has DE1082 (elements[1][0]) == 'E_0270'. 'In diesem AJT' refers to the current AJT context; without per-segment scope, we search all AJT segments. E_0270 appears in the SG12 AJT code list. Returns Unknown if no AJT segments exist. (medium confidence)
381    fn evaluate_105(&self, ctx: &EvaluationContext) -> ConditionResult {
382        let segs = ctx.find_segments("AJT");
383        if segs.is_empty() {
384            return ConditionResult::Unknown;
385        }
386        ConditionResult::from(segs.iter().any(|s| {
387            s.elements
388                .get(1)
389                .and_then(|e| e.first())
390                .is_some_and(|v| v == "E_0270")
391        }))
392    }
393
394    /// [106] Wenn in diesem AJT DE1082 = E_0273
395    // REVIEW: Checks if any AJT segment has DE1082 (elements[1][0]) == 'E_0273'. Same pattern as condition 105. (medium confidence)
396    fn evaluate_106(&self, ctx: &EvaluationContext) -> ConditionResult {
397        let segs = ctx.find_segments("AJT");
398        if segs.is_empty() {
399            return ConditionResult::Unknown;
400        }
401        ConditionResult::from(segs.iter().any(|s| {
402            s.elements
403                .get(1)
404                .and_then(|e| e.first())
405                .is_some_and(|v| v == "E_0273")
406        }))
407    }
408
409    /// [107] Wenn in diesem AJT DE1082 = E_0276
410    // REVIEW: Checks if any AJT segment has DE1082 (elements[1][0]) == 'E_0276'. Same pattern as condition 105. (medium confidence)
411    fn evaluate_107(&self, ctx: &EvaluationContext) -> ConditionResult {
412        let segs = ctx.find_segments("AJT");
413        if segs.is_empty() {
414            return ConditionResult::Unknown;
415        }
416        ConditionResult::from(segs.iter().any(|s| {
417            s.elements
418                .get(1)
419                .and_then(|e| e.first())
420                .is_some_and(|v| v == "E_0276")
421        }))
422    }
423
424    /// [108] Wenn in diesem AJT DE1082 = E_0277
425    // REVIEW: Checks if any AJT segment has DE1082 (elements[1][0]) == 'E_0277'. Same pattern as condition 105. (medium confidence)
426    fn evaluate_108(&self, ctx: &EvaluationContext) -> ConditionResult {
427        let segs = ctx.find_segments("AJT");
428        if segs.is_empty() {
429            return ConditionResult::Unknown;
430        }
431        ConditionResult::from(segs.iter().any(|s| {
432            s.elements
433                .get(1)
434                .and_then(|e| e.first())
435                .is_some_and(|v| v == "E_0277")
436        }))
437    }
438
439    /// [109] Wenn in dieser SG7 AJT DE4465 = A01/A21/A22/A23/A90/A96
440    fn evaluate_109(&self, ctx: &EvaluationContext) -> ConditionResult {
441        ctx.any_group_has_any_qualifier(
442            "AJT",
443            0,
444            &["A01", "A21", "A22", "A23", "A90", "A96"],
445            &["SG7"],
446        )
447    }
448
449    /// [110] Wenn in dieser SG7 AJT DE1082 = E_0270
450    fn evaluate_110(&self, ctx: &EvaluationContext) -> ConditionResult {
451        ctx.any_group_has_qualifier("AJT", 1, "E_0270", &["SG7"])
452    }
453
454    /// [111] Wenn in dieser SG7 AJT DE1082 = E_0273
455    fn evaluate_111(&self, ctx: &EvaluationContext) -> ConditionResult {
456        ctx.any_group_has_qualifier("AJT", 1, "E_0273", &["SG7"])
457    }
458
459    /// [112] Wenn in dieser SG7 AJT DE1082 = E_0276
460    fn evaluate_112(&self, ctx: &EvaluationContext) -> ConditionResult {
461        ctx.any_group_has_qualifier("AJT", 1, "E_0276", &["SG7"])
462    }
463
464    /// [113] Wenn in dieser SG7 AJT DE1082 = E_0277
465    fn evaluate_113(&self, ctx: &EvaluationContext) -> ConditionResult {
466        ctx.any_group_has_qualifier("AJT", 1, "E_0277", &["SG7"])
467    }
468
469    /// [114] Wenn in dieser SG12 AJT DE1082 = E_0270
470    fn evaluate_114(&self, ctx: &EvaluationContext) -> ConditionResult {
471        ctx.any_group_has_qualified_value("AJT", 1, "E_0270", 1, 0, &["E_0270"], &["SG5", "SG12"])
472    }
473
474    /// [115] Wenn in dieser SG12 AJT DE1082 = E_0273
475    fn evaluate_115(&self, ctx: &EvaluationContext) -> ConditionResult {
476        ctx.any_group_has_qualified_value("AJT", 1, "E_0273", 1, 0, &["E_0273"], &["SG5", "SG12"])
477    }
478
479    /// [116] Wenn in dieser SG12 AJT DE1082 = E_0276
480    fn evaluate_116(&self, ctx: &EvaluationContext) -> ConditionResult {
481        ctx.any_group_has_qualified_value("AJT", 1, "E_0276", 1, 0, &["E_0276"], &["SG5", "SG12"])
482    }
483
484    /// [117] Wenn in dieser SG12 AJT DE1082 = E_0277
485    fn evaluate_117(&self, ctx: &EvaluationContext) -> ConditionResult {
486        ctx.any_group_has_qualified_value("AJT", 1, "E_0277", 1, 0, &["E_0277"], &["SG5", "SG12"])
487    }
488
489    /// [118] Wenn SG7 AJT+A99+E_0272 vorhanden
490    fn evaluate_118(&self, ctx: &EvaluationContext) -> ConditionResult {
491        ctx.has_segment_matching_in_group("AJT", &[(0, 0, "A99"), (1, 0, "E_0272")], &["SG7"])
492    }
493
494    /// [119] Wenn SG7 AJT+A99+E_0275 vorhanden
495    fn evaluate_119(&self, ctx: &EvaluationContext) -> ConditionResult {
496        ctx.has_segment_matching_in_group("AJT", &[(0, 0, "A99"), (1, 0, "E_0275")], &["SG7"])
497    }
498
499    /// [120] Wenn in dieser SG7 AJT DE4465 = A01
500    fn evaluate_120(&self, ctx: &EvaluationContext) -> ConditionResult {
501        ctx.any_group_has_qualifier("AJT", 0, "A01", &["SG7"])
502    }
503
504    /// [544] Hinweis: Wenn in dieser SG7 AJT DE4465 = A21 vorhanden, dann darf in den DE4440 dieses FTX-Segments jeweils nur eine Positionsnummer genannt sein, welche aus dem bestätigten Angebot nicht in der R...
505    fn evaluate_544(&self, _ctx: &EvaluationContext) -> ConditionResult {
506        // Hinweis: Wenn AJT DE4465 = A21 vorhanden, dann darf in den DE4440 dieses FTX-Segments jeweils nur eine Positionsnummer genannt sein, welche aus dem bestätigten Angebot nicht in der Rechnung enthalten sind — informational note, always applies
507        ConditionResult::True
508    }
509
510    /// [2] Wenn SG7 AJT+28 vorhanden
511    fn evaluate_2(&self, ctx: &EvaluationContext) -> ConditionResult {
512        ctx.any_group_has_qualifier("AJT", 0, "28", &["SG7"])
513    }
514
515    /// [3] Bei SG5 DOC+389 / Z25 ist der Wert aus derselben SG5 MOA+9 mit (-1) multipliziert anzugeben.
516    fn evaluate_3(&self, _ctx: &EvaluationContext) -> ConditionResult {
517        // Hinweis: Bei SG5 DOC+389/Z25 ist der Wert aus derselben SG5 MOA+9 mit (-1) multipliziert anzugeben.
518        // Informational annotation describing the calculation rule for MOA+12 (Überweisungsbetrag).
519        ConditionResult::True
520    }
521
522    /// [4] Bei SG5 DOC+380 / 457 ist der Wert aus derselben SG5 MOA+9 unverändert anzugeben.
523    fn evaluate_4(&self, _ctx: &EvaluationContext) -> ConditionResult {
524        // Hinweis: Bei SG5 DOC+380/457 ist der Wert aus derselben SG5 MOA+9 unverändert anzugeben.
525        // Informational annotation describing that MOA+12 (Überweisungsbetrag) equals MOA+9 unchanged.
526        ConditionResult::True
527    }
528
529    /// [8] Wenn SG7 AJT+A01/A02+E_0505 vorhanden
530    fn evaluate_8(&self, ctx: &EvaluationContext) -> ConditionResult {
531        let ajts = ctx.find_segments("AJT");
532        let found = ajts.iter().any(|s| {
533            let elem0 = s
534                .elements
535                .first()
536                .and_then(|e| e.first())
537                .map(|s| s.as_str())
538                .unwrap_or("");
539            let elem1 = s
540                .elements
541                .get(1)
542                .and_then(|e| e.first())
543                .map(|s| s.as_str())
544                .unwrap_or("");
545            (elem0 == "A01" || elem0 == "A02") && elem1 == "E_0505"
546        });
547        ConditionResult::from(found)
548    }
549
550    /// [9] Wenn SG7 AJT+A32/A99+E_0503 vorhanden
551    fn evaluate_9(&self, ctx: &EvaluationContext) -> ConditionResult {
552        let ajts = ctx.find_segments("AJT");
553        let found = ajts.iter().any(|s| {
554            let elem0 = s
555                .elements
556                .first()
557                .and_then(|e| e.first())
558                .map(|s| s.as_str())
559                .unwrap_or("");
560            let elem1 = s
561                .elements
562                .get(1)
563                .and_then(|e| e.first())
564                .map(|s| s.as_str())
565                .unwrap_or("");
566            (elem0 == "A32" || elem0 == "A99") && elem1 == "E_0503"
567        });
568        ConditionResult::from(found)
569    }
570
571    /// [11] Wenn in diesem AJT DE1082 = E_0406
572    // REVIEW: Check if AJT has DE1082 (elements[1][0]) == E_0406. 'In diesem AJT' implies same-segment context; message-wide fallback via has_qualifier is the safe approximation without per-instance scoping. (medium confidence)
573    fn evaluate_11(&self, ctx: &EvaluationContext) -> ConditionResult {
574        ctx.has_qualifier("AJT", 1, "E_0406")
575    }
576
577    /// [12] Wenn in diesem AJT DE1082 = E_0407
578    // REVIEW: Check if AJT has DE1082 (elements[1][0]) == E_0407. Same pattern as condition 11. (medium confidence)
579    fn evaluate_12(&self, ctx: &EvaluationContext) -> ConditionResult {
580        ctx.has_qualifier("AJT", 1, "E_0407")
581    }
582
583    /// [14] A-Code aus Cluster Ablehnung auf Kopfebene
584    // HAND-EDITED: per-EBD cluster data (mako_prozesse).
585    fn evaluate_14(&self, ctx: &EvaluationContext) -> ConditionResult {
586        resolved_ajt_code_in_cluster(ctx, Cluster::is_ablehnung_kopfebene)
587    }
588
589    /// [15] A-Code aus Cluster Ablehnung auf Positionsebene
590    // HAND-EDITED: per-EBD cluster data (mako_prozesse).
591    fn evaluate_15(&self, ctx: &EvaluationContext) -> ConditionResult {
592        resolved_ajt_code_in_cluster(ctx, Cluster::is_ablehnung_positionsebene)
593    }
594
595    /// [16] A-Code aus Cluster Ablehnung auf Summenebene
596    // HAND-EDITED: per-EBD cluster data (mako_prozesse).
597    fn evaluate_16(&self, ctx: &EvaluationContext) -> ConditionResult {
598        resolved_ajt_code_in_cluster(ctx, Cluster::is_ablehnung_summenebene)
599    }
600
601    /// [18] Wenn in dieser SG7 AJT DE4465 = A74/A75/A76/AC5
602    fn evaluate_18(&self, ctx: &EvaluationContext) -> ConditionResult {
603        ctx.any_group_has_any_qualifier("AJT", 0, &["A74", "A75", "A76", "AC5"], &["SG7"])
604    }
605
606    /// [22] Wenn in dieser SG7 AJT DE4465 = A02/A06/A16/A66/A67/A68/A69/A78/A90/A95/A96/AC3/AC4
607    fn evaluate_22(&self, ctx: &EvaluationContext) -> ConditionResult {
608        ctx.any_group_has_any_qualifier(
609            "AJT",
610            0,
611            &[
612                "A02", "A06", "A16", "A66", "A67", "A68", "A69", "A78", "A90", "A95", "A96", "AC3",
613                "AC4",
614            ],
615            &["SG7"],
616        )
617    }
618
619    /// [26] Wenn in dieser SG12 AJT DE4465 = A51/A62/A82/AA1/AA6/AA7/AB8/AD6
620    fn evaluate_26(&self, ctx: &EvaluationContext) -> ConditionResult {
621        ctx.any_group_has_any_qualifier(
622            "AJT",
623            0,
624            &["A51", "A62", "A82", "AA1", "AA6", "AA7", "AB8", "AD6"],
625            &["SG12"],
626        )
627    }
628
629    /// [28] Wenn in dieser SG12 AJT DE4465 = A23/A26/A35/A36/A38/A46/A47/A48/A50/A58/A59/A61/A77/A84/A99
630    fn evaluate_28(&self, ctx: &EvaluationContext) -> ConditionResult {
631        ctx.any_group_has_any_qualifier(
632            "AJT",
633            0,
634            &[
635                "A23", "A26", "A35", "A36", "A38", "A46", "A47", "A48", "A50", "A58", "A59", "A61",
636                "A77", "A84", "A99",
637            ],
638            &["SG12"],
639        )
640    }
641
642    /// [33] Wenn in diesem AJT DE1082 = S_0103
643    // REVIEW: Check if AJT has DE1082 (elements[1][0]) == S_0103. 'In diesem AJT' scoping approximated by message-wide check via has_qualifier. (medium confidence)
644    fn evaluate_33(&self, ctx: &EvaluationContext) -> ConditionResult {
645        ctx.has_qualifier("AJT", 1, "S_0103")
646    }
647
648    /// [34] Wenn in diesem AJT DE1082 = S_0104
649    fn evaluate_34(&self, ctx: &EvaluationContext) -> ConditionResult {
650        ctx.has_qualifier("AJT", 1, "S_0104")
651    }
652
653    /// [35] Wenn in dieser SG12 AJT DE4465 = A34/A39/AA2/AB2
654    fn evaluate_35(&self, ctx: &EvaluationContext) -> ConditionResult {
655        ctx.any_group_has_any_qualifier("AJT", 0, &["A34", "A39", "AA2", "AB2"], &["SG12"])
656    }
657
658    /// [36] Wenn in dieser SG7 AJT DE4465 = A12/A75/A80/AE1
659    fn evaluate_36(&self, ctx: &EvaluationContext) -> ConditionResult {
660        ctx.any_group_has_any_qualifier("AJT", 0, &["A12", "A75", "A80", "AE1"], &["SG7"])
661    }
662
663    /// [39] Wenn in dieser SG7 AJT DE4465 = AC1
664    fn evaluate_39(&self, ctx: &EvaluationContext) -> ConditionResult {
665        ctx.any_group_has_qualifier("AJT", 0, "AC1", &["SG7"])
666    }
667
668    /// [40] Wenn in dieser SG7 AJT DE1082 = E_0406
669    fn evaluate_40(&self, ctx: &EvaluationContext) -> ConditionResult {
670        ctx.any_group_has_qualifier("AJT", 1, "E_0406", &["SG7"])
671    }
672
673    /// [41] Wenn in dieser SG7 AJT DE1082 = E_0407
674    fn evaluate_41(&self, ctx: &EvaluationContext) -> ConditionResult {
675        ctx.any_group_has_qualifier("AJT", 1, "E_0407", &["SG7"])
676    }
677
678    /// [42] Wenn in SG7 AJT DE1082 = E_0407/E_0568/E_0521/E_0517/E_0266
679    fn evaluate_42(&self, ctx: &EvaluationContext) -> ConditionResult {
680        ctx.any_group_has_any_qualifier(
681            "AJT",
682            1,
683            &["E_0407", "E_0568", "E_0521", "E_0517", "E_0266"],
684            &["SG7"],
685        )
686    }
687
688    /// [43] Wenn in SG12 AJT DE4465=28
689    fn evaluate_43(&self, ctx: &EvaluationContext) -> ConditionResult {
690        ctx.any_group_has_qualifier("AJT", 0, "28", &["SG12"])
691    }
692
693    /// [47] Wenn in diesem AJT DE1082 = E_0210
694    fn evaluate_47(&self, ctx: &EvaluationContext) -> ConditionResult {
695        ctx.has_qualifier("AJT", 1, "E_0210")
696    }
697
698    /// [48] Wenn in diesem AJT DE1082 = E_0259
699    fn evaluate_48(&self, ctx: &EvaluationContext) -> ConditionResult {
700        ctx.has_qualifier("AJT", 1, "E_0259")
701    }
702
703    /// [51] Wenn in dieser SG12 AJT DE1082 = E_0406
704    fn evaluate_51(&self, ctx: &EvaluationContext) -> ConditionResult {
705        ctx.any_group_has_qualifier("AJT", 1, "E_0406", &["SG12"])
706    }
707
708    /// [52] Wenn in dieser SG12 AJT DE1082 = E_0407
709    fn evaluate_52(&self, ctx: &EvaluationContext) -> ConditionResult {
710        ctx.any_group_has_qualifier("AJT", 1, "E_0407", &["SG12"])
711    }
712
713    /// [53] Wenn in dieser SG12 AJT DE4465 = A25/A31/A99/AF1
714    fn evaluate_53(&self, ctx: &EvaluationContext) -> ConditionResult {
715        ctx.any_group_has_any_qualifier("AJT", 0, &["A25", "A31", "A99", "AF1"], &["SG5", "SG12"])
716    }
717
718    /// [54] Wenn in dieser SG12 AJT DE1082 = E_0210
719    fn evaluate_54(&self, ctx: &EvaluationContext) -> ConditionResult {
720        ctx.any_group_has_qualifier("AJT", 1, "E_0210", &["SG5", "SG12"])
721    }
722
723    /// [55] Wenn in dieser SG12 AJT DE1082 = E_0259
724    fn evaluate_55(&self, ctx: &EvaluationContext) -> ConditionResult {
725        ctx.any_group_has_qualifier("AJT", 1, "E_0259", &["SG5", "SG12"])
726    }
727
728    /// [56] Wenn in dieser SG7 AJT DE4465 = A21
729    fn evaluate_56(&self, ctx: &EvaluationContext) -> ConditionResult {
730        ctx.any_group_has_qualifier("AJT", 0, "A21", &["SG5", "SG7"])
731    }
732
733    /// [57] Wenn in dieser SG7 AJT DE1082 = E_0210
734    fn evaluate_57(&self, ctx: &EvaluationContext) -> ConditionResult {
735        ctx.any_group_has_qualifier("AJT", 1, "E_0210", &["SG5", "SG7"])
736    }
737
738    /// [58] Wenn in dieser SG7 AJT DE1082 = E_0259
739    fn evaluate_58(&self, ctx: &EvaluationContext) -> ConditionResult {
740        ctx.any_group_has_qualifier("AJT", 1, "E_0259", &["SG5", "SG7"])
741    }
742
743    /// [60] Wenn SG7 AJT+A99+E_0243 vorhanden
744    fn evaluate_60(&self, ctx: &EvaluationContext) -> ConditionResult {
745        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0243"], &["SG5", "SG7"])
746    }
747
748    /// [61] Wenn SG7 AJT+A99+E_0261 vorhanden
749    fn evaluate_61(&self, ctx: &EvaluationContext) -> ConditionResult {
750        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0261"], &["SG5", "SG7"])
751    }
752
753    /// [62] Wenn SG7 AJT+A99+E_1007 vorhanden
754    fn evaluate_62(&self, ctx: &EvaluationContext) -> ConditionResult {
755        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_1007"], &["SG5", "SG7"])
756    }
757
758    /// [63] Wenn SG7 AJT+A01/A02+E_1009 vorhanden
759    fn evaluate_63(&self, ctx: &EvaluationContext) -> ConditionResult {
760        let a01 =
761            ctx.any_group_has_qualified_value("AJT", 0, "A01", 1, 0, &["E_1009"], &["SG5", "SG7"]);
762        let a02 =
763            ctx.any_group_has_qualified_value("AJT", 0, "A02", 1, 0, &["E_1009"], &["SG5", "SG7"]);
764        match (a01, a02) {
765            (ConditionResult::True, _) | (_, ConditionResult::True) => ConditionResult::True,
766            (ConditionResult::False, ConditionResult::False) => ConditionResult::False,
767            _ => ConditionResult::Unknown,
768        }
769    }
770
771    /// [64] Wenn in dieser SG12 AJT DE1082 = E_0264
772    fn evaluate_64(&self, ctx: &EvaluationContext) -> ConditionResult {
773        ctx.any_group_has_qualifier("AJT", 1, "E_0264", &["SG5", "SG12"])
774    }
775
776    /// [65] Wenn in dieser SG12 AJT DE1082 = E_0515
777    fn evaluate_65(&self, ctx: &EvaluationContext) -> ConditionResult {
778        ctx.any_group_has_qualifier("AJT", 1, "E_0515", &["SG5", "SG12"])
779    }
780
781    /// [66] Wenn in dieser SG12 AJT DE1082 = E_0519
782    fn evaluate_66(&self, ctx: &EvaluationContext) -> ConditionResult {
783        ctx.any_group_has_qualifier("AJT", 1, "E_0519", &["SG5", "SG12"])
784    }
785
786    /// [67] Wenn in dieser SG12 AJT DE1082 = E_0266
787    fn evaluate_67(&self, ctx: &EvaluationContext) -> ConditionResult {
788        ctx.any_group_has_qualifier("AJT", 1, "E_0266", &["SG5", "SG12"])
789    }
790
791    /// [68] Wenn in dieser SG12 AJT DE1082 = E_0517
792    fn evaluate_68(&self, ctx: &EvaluationContext) -> ConditionResult {
793        ctx.any_group_has_qualified_value("AJT", 1, "E_0517", 1, 0, &["E_0517"], &["SG12"])
794    }
795
796    /// [69] Wenn in dieser SG12 AJT DE1082 = E_0521
797    fn evaluate_69(&self, ctx: &EvaluationContext) -> ConditionResult {
798        ctx.any_group_has_qualified_value("AJT", 1, "E_0521", 1, 0, &["E_0521"], &["SG12"])
799    }
800
801    /// [70] Wenn in dieser SG12 AJT DE4465 = A15
802    fn evaluate_70(&self, ctx: &EvaluationContext) -> ConditionResult {
803        ctx.any_group_has_qualifier("AJT", 0, "A15", &["SG12"])
804    }
805
806    /// [71] Wenn in dieser SG12 AJT DE4465 = A99
807    fn evaluate_71(&self, ctx: &EvaluationContext) -> ConditionResult {
808        ctx.any_group_has_qualifier("AJT", 0, "A99", &["SG12"])
809    }
810
811    /// [72] Wenn SG7 AJT+A99+E_0518 vorhanden
812    fn evaluate_72(&self, ctx: &EvaluationContext) -> ConditionResult {
813        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0518"], &["SG7"])
814    }
815
816    /// [73] Wenn SG7 AJT+A99+E_0522 vorhanden
817    fn evaluate_73(&self, ctx: &EvaluationContext) -> ConditionResult {
818        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0522"], &["SG7"])
819    }
820
821    /// [74] Wenn SG7 AJT+A99+E_0267 vorhanden
822    fn evaluate_74(&self, ctx: &EvaluationContext) -> ConditionResult {
823        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0267"], &["SG7"])
824    }
825
826    /// [75] Wenn in diesem AJT DE1082 = E_0264
827    // REVIEW: 'In diesem AJT' means current segment context; approximated as message-wide AJT search. DE1082 at elements[1][0]. Redundant qual+val check correctly matches E_0264. (medium confidence)
828    fn evaluate_75(&self, ctx: &EvaluationContext) -> ConditionResult {
829        ctx.has_qualified_value("AJT", 1, "E_0264", 1, 0, &["E_0264"])
830    }
831
832    /// [76] Wenn in diesem AJT DE1082 = E_0266
833    // REVIEW: Same pattern as 75, checking DE1082=E_0266 in any AJT segment. (medium confidence)
834    fn evaluate_76(&self, ctx: &EvaluationContext) -> ConditionResult {
835        ctx.has_qualified_value("AJT", 1, "E_0266", 1, 0, &["E_0266"])
836    }
837
838    /// [77] Wenn in diesem AJT DE1082 = E_0515
839    // REVIEW: Same pattern as 75, checking DE1082=E_0515 in any AJT segment. (medium confidence)
840    fn evaluate_77(&self, ctx: &EvaluationContext) -> ConditionResult {
841        ctx.has_qualified_value("AJT", 1, "E_0515", 1, 0, &["E_0515"])
842    }
843
844    /// [78] Wenn in diesem AJT DE1082 = E_0517
845    // REVIEW: Same pattern as 75, checking DE1082=E_0517 in any AJT segment. (medium confidence)
846    fn evaluate_78(&self, ctx: &EvaluationContext) -> ConditionResult {
847        ctx.has_qualified_value("AJT", 1, "E_0517", 1, 0, &["E_0517"])
848    }
849
850    /// [79] Wenn in diesem AJT DE1082 = E_0519
851    // REVIEW: Same pattern as 75, checking DE1082=E_0519 in any AJT segment. (medium confidence)
852    fn evaluate_79(&self, ctx: &EvaluationContext) -> ConditionResult {
853        ctx.has_qualified_value("AJT", 1, "E_0519", 1, 0, &["E_0519"])
854    }
855
856    /// [80] Wenn in diesem AJT DE1082 = E_0521
857    // REVIEW: Same pattern as 75, checking DE1082=E_0521 in any AJT segment. (medium confidence)
858    fn evaluate_80(&self, ctx: &EvaluationContext) -> ConditionResult {
859        ctx.has_qualified_value("AJT", 1, "E_0521", 1, 0, &["E_0521"])
860    }
861
862    /// [81] Wenn in dieser SG7 AJT DE1082 = E_0264
863    fn evaluate_81(&self, ctx: &EvaluationContext) -> ConditionResult {
864        ctx.any_group_has_qualified_value("AJT", 1, "E_0264", 1, 0, &["E_0264"], &["SG7"])
865    }
866
867    /// [82] Wenn in dieser SG7 AJT DE1082 = E_0515
868    fn evaluate_82(&self, ctx: &EvaluationContext) -> ConditionResult {
869        ctx.any_group_has_qualified_value("AJT", 1, "E_0515", 1, 0, &["E_0515"], &["SG7"])
870    }
871
872    /// [83] Wenn in dieser SG7 AJT DE1082 = E_0519
873    fn evaluate_83(&self, ctx: &EvaluationContext) -> ConditionResult {
874        let values = ctx.collect_group_values("AJT", 1, 0, &["SG7"]);
875        ConditionResult::from(values.iter().any(|(_, v)| v == "E_0519"))
876    }
877
878    /// [84] Wenn in dieser SG7 AJT DE1082 = E_0266
879    fn evaluate_84(&self, ctx: &EvaluationContext) -> ConditionResult {
880        let values = ctx.collect_group_values("AJT", 1, 0, &["SG7"]);
881        ConditionResult::from(values.iter().any(|(_, v)| v == "E_0266"))
882    }
883
884    /// [85] Wenn in dieser SG7 AJT DE1082 = E_0517
885    fn evaluate_85(&self, ctx: &EvaluationContext) -> ConditionResult {
886        let values = ctx.collect_group_values("AJT", 1, 0, &["SG7"]);
887        ConditionResult::from(values.iter().any(|(_, v)| v == "E_0517"))
888    }
889
890    /// [86] Wenn in dieser SG7 AJT DE1082 = E_0521
891    fn evaluate_86(&self, ctx: &EvaluationContext) -> ConditionResult {
892        let values = ctx.collect_group_values("AJT", 1, 0, &["SG7"]);
893        ConditionResult::from(values.iter().any(|(_, v)| v == "E_0521"))
894    }
895
896    /// [87] Wenn in dieser SG7 AJT DE4465 = A05/A21/A22/A23/A90/A96/AE7
897    fn evaluate_87(&self, ctx: &EvaluationContext) -> ConditionResult {
898        ctx.any_group_has_any_qualifier(
899            "AJT",
900            0,
901            &["A05", "A21", "A22", "A23", "A90", "A96", "AE7"],
902            &["SG7"],
903        )
904    }
905
906    /// [88] Wenn in dieser SG7 AJT DE4465 = A25
907    fn evaluate_88(&self, ctx: &EvaluationContext) -> ConditionResult {
908        ctx.any_group_has_qualifier("AJT", 0, "A25", &["SG7"])
909    }
910
911    /// [89] wenn im DE3155 in demselben COM der Code EM vorhanden ist
912    fn evaluate_89(&self, ctx: &EvaluationContext) -> ConditionResult {
913        let segs = ctx.find_segments("COM");
914        ConditionResult::from(segs.iter().any(|s| {
915            s.elements
916                .first()
917                .and_then(|e| e.get(1))
918                .is_some_and(|v| v == "EM")
919        }))
920    }
921
922    /// [90] wenn im DE3155 in demselben COM der Code TE / FX / AJ / AL vorhanden ist
923    fn evaluate_90(&self, ctx: &EvaluationContext) -> ConditionResult {
924        let segs = ctx.find_segments("COM");
925        ConditionResult::from(segs.iter().any(|s| {
926            s.elements
927                .first()
928                .and_then(|e| e.get(1))
929                .is_some_and(|v| matches!(v.as_str(), "TE" | "FX" | "AJ" | "AL"))
930        }))
931    }
932
933    /// [91] Wenn in diesem AJT DE1082 = E_0566
934    fn evaluate_91(&self, ctx: &EvaluationContext) -> ConditionResult {
935        let segs = ctx.find_segments("AJT");
936        ConditionResult::from(segs.iter().any(|s| {
937            s.elements
938                .get(1)
939                .and_then(|e| e.first())
940                .is_some_and(|v| v == "E_0566")
941        }))
942    }
943
944    /// [92] Wenn in diesem AJT DE1082 = E_0568
945    fn evaluate_92(&self, ctx: &EvaluationContext) -> ConditionResult {
946        let segs = ctx.find_segments("AJT");
947        ConditionResult::from(segs.iter().any(|s| {
948            s.elements
949                .get(1)
950                .and_then(|e| e.first())
951                .is_some_and(|v| v == "E_0568")
952        }))
953    }
954
955    /// [93] Wenn SG7 AJT+A99+E_0804 vorhanden
956    fn evaluate_93(&self, ctx: &EvaluationContext) -> ConditionResult {
957        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0804"], &["SG7"])
958    }
959
960    /// [94] Wenn SG7 AJT+A99+E_0806 vorhanden
961    fn evaluate_94(&self, ctx: &EvaluationContext) -> ConditionResult {
962        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0806"], &["SG7"])
963    }
964
965    /// [95] Wenn SG7 AJT+A99+E_0569 vorhanden
966    fn evaluate_95(&self, ctx: &EvaluationContext) -> ConditionResult {
967        ctx.any_group_has_qualified_value("AJT", 0, "A99", 1, 0, &["E_0569"], &["SG7"])
968    }
969
970    /// [97] Wenn in dieser SG12 AJT DE4465 = A27
971    fn evaluate_97(&self, ctx: &EvaluationContext) -> ConditionResult {
972        ctx.any_group_has_qualifier("AJT", 0, "A27", &["SG12"])
973    }
974
975    /// [98] Wenn in SG12 AJT DE1082 = E_0407
976    fn evaluate_98(&self, ctx: &EvaluationContext) -> ConditionResult {
977        let values = ctx.collect_group_values("AJT", 1, 0, &["SG12"]);
978        ConditionResult::from(values.iter().any(|(_, v)| v == "E_0407"))
979    }
980
981    /// [99] Wenn in SG12 AJT DE1082 = E_0568
982    // REVIEW: Checks any AJT segment in the message where DE1082 (elements[1][0]) equals E_0568. No 'dieser' qualifier so message-wide search is appropriate. SG12 scoping not enforced due to API limitations without group path context. (medium confidence)
983    fn evaluate_99(&self, ctx: &EvaluationContext) -> ConditionResult {
984        ConditionResult::from(ctx.find_segments("AJT").iter().any(|s| {
985            s.elements
986                .get(1)
987                .and_then(|e| e.first())
988                .is_some_and(|v| v == "E_0568")
989        }))
990    }
991
992    /// [101] Wenn in dieser SG7 AJT DE1082 = E_0566
993    // REVIEW: Group-scoped check for AJT DE1082=E_0566 within SG7 (nested under SG5). Uses navigator to iterate SG7 instances; falls back to message-wide AJT scan when no navigator available. 'Dieser SG7' semantics best approximated by iterating all SG7 instances. (medium confidence)
994    fn evaluate_101(&self, ctx: &EvaluationContext) -> ConditionResult {
995        if let Some(nav) = ctx.navigator() {
996            let count = nav.group_instance_count(&["SG5", "SG7"]);
997            for i in 0..count {
998                let ajts = nav.find_segments_in_group("AJT", &["SG5", "SG7"], i);
999                if ajts.iter().any(|s| {
1000                    s.elements
1001                        .get(1)
1002                        .and_then(|e| e.first())
1003                        .is_some_and(|v| v == "E_0566")
1004                }) {
1005                    return ConditionResult::True;
1006                }
1007            }
1008            ConditionResult::False
1009        } else {
1010            ConditionResult::from(ctx.find_segments("AJT").iter().any(|s| {
1011                s.elements
1012                    .get(1)
1013                    .and_then(|e| e.first())
1014                    .is_some_and(|v| v == "E_0566")
1015            }))
1016        }
1017    }
1018
1019    /// [102] Wenn in dieser SG7 AJT DE1082 = E_0568
1020    // REVIEW: Group-scoped check for AJT DE1082=E_0568 within SG7 (nested under SG5). Same pattern as condition 101 but checking E_0568 instead of E_0566. (medium confidence)
1021    fn evaluate_102(&self, ctx: &EvaluationContext) -> ConditionResult {
1022        if let Some(nav) = ctx.navigator() {
1023            let count = nav.group_instance_count(&["SG5", "SG7"]);
1024            for i in 0..count {
1025                let ajts = nav.find_segments_in_group("AJT", &["SG5", "SG7"], i);
1026                if ajts.iter().any(|s| {
1027                    s.elements
1028                        .get(1)
1029                        .and_then(|e| e.first())
1030                        .is_some_and(|v| v == "E_0568")
1031                }) {
1032                    return ConditionResult::True;
1033                }
1034            }
1035            ConditionResult::False
1036        } else {
1037            ConditionResult::from(ctx.find_segments("AJT").iter().any(|s| {
1038                s.elements
1039                    .get(1)
1040                    .and_then(|e| e.first())
1041                    .is_some_and(|v| v == "E_0568")
1042            }))
1043        }
1044    }
1045
1046    /// [103] Wenn in dieser SG12 AJT DE1082 = E_0566
1047    // REVIEW: Group-scoped check for AJT DE1082=E_0566 within SG12 (nested under SG10 for line-item rejections). Uses navigator to iterate SG12 instances; falls back to message-wide scan. (medium confidence)
1048    fn evaluate_103(&self, ctx: &EvaluationContext) -> ConditionResult {
1049        if let Some(nav) = ctx.navigator() {
1050            let count = nav.group_instance_count(&["SG10", "SG12"]);
1051            for i in 0..count {
1052                let ajts = nav.find_segments_in_group("AJT", &["SG10", "SG12"], i);
1053                if ajts.iter().any(|s| {
1054                    s.elements
1055                        .get(1)
1056                        .and_then(|e| e.first())
1057                        .is_some_and(|v| v == "E_0566")
1058                }) {
1059                    return ConditionResult::True;
1060                }
1061            }
1062            ConditionResult::False
1063        } else {
1064            ConditionResult::from(ctx.find_segments("AJT").iter().any(|s| {
1065                s.elements
1066                    .get(1)
1067                    .and_then(|e| e.first())
1068                    .is_some_and(|v| v == "E_0566")
1069            }))
1070        }
1071    }
1072
1073    /// [104] Wenn in dieser SG12 AJT DE1082 = E_0568
1074    // REVIEW: Group-scoped check for AJT DE1082=E_0568 within SG12 (nested under SG10). Same pattern as condition 103 but checking E_0568. (medium confidence)
1075    fn evaluate_104(&self, ctx: &EvaluationContext) -> ConditionResult {
1076        if let Some(nav) = ctx.navigator() {
1077            let count = nav.group_instance_count(&["SG10", "SG12"]);
1078            for i in 0..count {
1079                let ajts = nav.find_segments_in_group("AJT", &["SG10", "SG12"], i);
1080                if ajts.iter().any(|s| {
1081                    s.elements
1082                        .get(1)
1083                        .and_then(|e| e.first())
1084                        .is_some_and(|v| v == "E_0568")
1085                }) {
1086                    return ConditionResult::True;
1087                }
1088            }
1089            ConditionResult::False
1090        } else {
1091            ConditionResult::from(ctx.find_segments("AJT").iter().any(|s| {
1092                s.elements
1093                    .get(1)
1094                    .and_then(|e| e.first())
1095                    .is_some_and(|v| v == "E_0568")
1096            }))
1097        }
1098    }
1099
1100    /// [492] Wenn MP-ID in NAD+MR (Nachrichtenempfänger) aus Sparte Strom
1101    /// EXTERNAL: Requires context from outside the message.
1102    fn evaluate_492(&self, ctx: &EvaluationContext) -> ConditionResult {
1103        ctx.external.evaluate("recipient_is_strom")
1104    }
1105
1106    /// [493] Wenn MP-ID in NAD+MR (Nachrichtenempfänger) aus Sparte Gas
1107    /// EXTERNAL: Requires context from outside the message.
1108    fn evaluate_493(&self, ctx: &EvaluationContext) -> ConditionResult {
1109        ctx.external.evaluate("recipient_is_gas")
1110    }
1111
1112    /// [501] Hinweis: An dieser Stelle ist der Betrag aus SG50 MOA+9 der zugrundeliegenden INVOIC zu übernehmen.
1113    fn evaluate_501(&self, _ctx: &EvaluationContext) -> ConditionResult {
1114        // Hinweis: An dieser Stelle ist der Betrag aus SG50 MOA+9 der zugrundeliegenden INVOIC zu übernehmen.
1115        // Informational note — always applies
1116        ConditionResult::True
1117    }
1118
1119    /// [502] Hinweis: Bei positivem Betrag ergibt sich eine Forderung des Rechnungsstellers. Bei negativem Betrag ergibt sich eine Forderung für den Rechnungsempfänger.
1120    fn evaluate_502(&self, _ctx: &EvaluationContext) -> ConditionResult {
1121        // Hinweis: Bei positivem Betrag ergibt sich eine Forderung des Rechnungsstellers.
1122        // Bei negativem Betrag ergibt sich eine Forderung für den Rechnungsempfänger.
1123        // Informational note — always applies
1124        ConditionResult::True
1125    }
1126
1127    /// [503] Hinweis: Empfohlen, um bei Abweisung Ansprechpartner für Rückfragen zu erreichen.
1128    fn evaluate_503(&self, _ctx: &EvaluationContext) -> ConditionResult {
1129        // Hinweis: Empfohlen, um bei Abweisung Ansprechpartner für Rückfragen zu erreichen.
1130        // Informational note — always applies
1131        ConditionResult::True
1132    }
1133
1134    /// [510] Hinweis: Bei Ablehnung einer vorherigen COMDIS
1135    fn evaluate_510(&self, _ctx: &EvaluationContext) -> ConditionResult {
1136        // Hinweis: Bei Ablehnung einer vorherigen COMDIS
1137        // Informational note — always applies
1138        ConditionResult::True
1139    }
1140
1141    /// [511] Hinweis: BGM DE1004 aus der abgelehnten INVOIC-Nachricht
1142    fn evaluate_511(&self, _ctx: &EvaluationContext) -> ConditionResult {
1143        // Hinweis: BGM DE1004 aus der abgelehnten INVOIC-Nachricht — informational note, always applies
1144        ConditionResult::True
1145    }
1146
1147    /// [512] Hinweis: BGM DE1004 aus der abgelehnten COMDIS-Nachricht
1148    fn evaluate_512(&self, _ctx: &EvaluationContext) -> ConditionResult {
1149        // Hinweis: BGM DE1004 aus der abgelehnten COMDIS-Nachricht — informational note, always applies
1150        ConditionResult::True
1151    }
1152
1153    /// [515] Hinweis: BGM DE1004 aus der bestätigten INVOIC- Nachricht
1154    fn evaluate_515(&self, _ctx: &EvaluationContext) -> ConditionResult {
1155        // Hinweis: BGM DE1004 aus der bestätigten INVOIC-Nachricht — informational note, always applies
1156        ConditionResult::True
1157    }
1158
1159    /// [517] Hinweis: Wenn in dieser SG5 in AJT DE4465 ein Code aus Cluster Ablehnung auf Summenebene verwendet wird, ist diese SG7 so oft zu wiederholen, bis alle Fehler der Summenebene genannt sind.
1160    // HAND-EDITED: per-EBD cluster data (mako_prozesse).
1161    fn evaluate_517(&self, ctx: &EvaluationContext) -> ConditionResult {
1162        any_scoped_ajt_in_cluster(ctx, &[], Cluster::is_ablehnung_summenebene)
1163    }
1164
1165    /// [518] Hinweis: Wenn in dieser SG5 in AJT DE4465 ein Code aus Cluster Ablehnung auf Kopfebene verwendet wird, der von A80 abweicht, ist diese SG7 genau einmal zu nutzen.
1166    // HAND-EDITED: per-EBD cluster data (mako_prozesse). A80 carve-out.
1167    fn evaluate_518(&self, ctx: &EvaluationContext) -> ConditionResult {
1168        any_scoped_ajt_in_cluster(ctx, &["A80"], Cluster::is_ablehnung_kopfebene)
1169    }
1170
1171    /// [519] Hinweis: Diese SG7 ist so oft mit AJT DE4465 = A74 zu wiederholen, bis alle Rechnungsnummern im RFF-Segment dieser SG7 genannt sind, die in der INVOIC fehlen, die in diesem SG5 DOC DE1004 genannt ist
1172    fn evaluate_519(&self, _ctx: &EvaluationContext) -> ConditionResult {
1173        // Hinweis: Diese SG7 ist so oft mit AJT DE4465 = A74 zu wiederholen, bis alle Rechnungsnummern im RFF-Segment dieser SG7 genannt sind, die in der INVOIC fehlen, die in diesem SG5 DOC DE1004 genannt ist
1174        // Informational note, always applies
1175        ConditionResult::True
1176    }
1177
1178    /// [520] Hinweis: Diese SG7 ist so oft mit AJT DE4465 = A75 zu wiederholen, bis alle Rechnungsnummern der Rechnungen genannt sind, die mindestens eine Abschlagsrechnung enthalten, die in der INVOIC abgerech...
1179    fn evaluate_520(&self, _ctx: &EvaluationContext) -> ConditionResult {
1180        // Hinweis: Diese SG7 ist so oft mit AJT DE4465 = A75 zu wiederholen, bis alle Rechnungsnummern der Rechnungen genannt sind, die mindestens eine Abschlagsrechnung enthalten, die in der INVOIC abgerechnet wurden, die in diesem SG5 DOC DE1004 genannt ist.
1181        // Informational note, always applies
1182        ConditionResult::True
1183    }
1184
1185    /// [521] Hinweis: Diese SG7 ist so oft mit AJT DE4465 = A76 zu wiederholen, bis alle Rechnungsnummern der Abschlagsrechnungen genannt sind, die in der INVOIC, die in diesem SG5 DOC DE1004 genannt ist, nicht...
1186    fn evaluate_521(&self, _ctx: &EvaluationContext) -> ConditionResult {
1187        // Hinweis: Diese SG7 ist so oft mit AJT DE4465 = A76 zu wiederholen, bis alle Rechnungsnummern der Abschlagsrechnungen genannt sind, die in der INVOIC, die in diesem SG5 DOC DE1004 genannt ist, nicht hätten berücksichtigt werden dürfen.
1188        // Informational note, always applies
1189        ConditionResult::True
1190    }
1191
1192    /// [523] Hinweis: Jede Rechnungsnummer einer Abschlagsrechnung muss in einem separaten DE4440 angegeben werden. Reichen die fünf DE4440 für die Rechnungsnummern aller anzugebenden Abschlagrechnungen nicht...
1193    fn evaluate_523(&self, _ctx: &EvaluationContext) -> ConditionResult {
1194        // Hinweis: Jede Rechnungsnummer einer Abschlagsrechnung muss in einem separaten DE4440 angegeben werden. Reichen die fünf DE4440 für die Rechnungsnummern aller anzugebenden Abschlagrechnungen nicht aus, ist das FTX+Z14 zu wiederholen.
1195        // Informational note, always applies
1196        ConditionResult::True
1197    }
1198
1199    /// [525] Hinweis: Diese SG10 ist so oft zu wiederholen, bis alle Fehler der Positionsebene genannt sind.
1200    fn evaluate_525(&self, _ctx: &EvaluationContext) -> ConditionResult {
1201        // Hinweis: Diese SG10 ist so oft zu wiederholen, bis alle Fehler der Positionsebene genannt sind.
1202        // Informational note, always applies
1203        ConditionResult::True
1204    }
1205
1206    /// [526] Hinweis: Wert aus DE1082 der SG26 in der sich der nachfolgende Fehler in der INVOIC befindet, die in diesem SG5 DOC DE1004 genannt ist.
1207    fn evaluate_526(&self, _ctx: &EvaluationContext) -> ConditionResult {
1208        // Hinweis: Wert aus DE1082 der SG26 in der sich der nachfolgende Fehler in der INVOIC befindet, die in diesem SG5 DOC DE1004 genannt ist.
1209        ConditionResult::True
1210    }
1211
1212    /// [529] Hinweis: Wenn in dieser SG7 AJT DE4465 = A75 vorhanden, dann dürfen in den DE4440 dieses FTX-Segments nur Abschlagsrechnungsnummern genannt sein, welche in der Rechnung enthalten sind, deren Numme...
1213    // REVIEW: The trigger 'Wenn in dieser SG7 AJT DE4465=A75 vorhanden' is evaluable via group-scoped qualifier check on SG5.SG7. The subsequent content constraint (FTX DE4440 must contain only installment invoice numbers that appear in the invoice referenced by RFF+AFL) requires cross-message business context not available in the EDIFACT message itself, so only the trigger condition is implemented. (medium confidence)
1214    fn evaluate_529(&self, ctx: &EvaluationContext) -> ConditionResult {
1215        // Check if this SG7 contains AJT DE4465=A75.
1216        // The content constraint on FTX DE4440 (only installment invoice numbers
1217        // from the referenced invoice) requires cross-message business context
1218        // and cannot be verified from EDIFACT structure alone.
1219        ctx.any_group_has_qualifier("AJT", 0, "A75", &["SG5", "SG7"])
1220    }
1221
1222    /// [533] Hinweis: Wenn in dieser SG12 AJT DE4465 = AA1/AA6/AA7/AB8/AD6, ist diese SG12 so oft mit AJT DE4465 = Code zu wiederholen, bis alle Rechnungsnummern im RFF-Segment dieser SG12 genannt sind.
1223    // REVIEW: The trigger condition 'Wenn in dieser SG12 AJT DE4465=AA1/AA6/AA7/AB8/AD6' is evaluable via group-scoped multi-qualifier check on SG12. AJT DE4465 is at elements[0][0]. The subsequent repetition rule (how many times to repeat SG12) is informational and not a boolean condition. (medium confidence)
1224    fn evaluate_533(&self, ctx: &EvaluationContext) -> ConditionResult {
1225        // Check if this SG12 contains AJT DE4465 with one of the specified codes.
1226        // When any of these codes is present, SG12 must be repeated until all
1227        // relevant invoice numbers are listed in RFF segments.
1228        ctx.any_group_has_any_qualifier("AJT", 0, &["AA1", "AA6", "AA7", "AB8", "AD6"], &["SG12"])
1229    }
1230
1231    /// [534] Hinweis: Wenn in dieser SG12 AJT DE4465 = A34/A39/AA2/AB2, ist diese SG12 ist so oft mit AJT DE4465 = Code zu wiederholen, bis alle Nummern der Reklamationen im RFF-Segment dieser SG12 genannt sind.
1232    // REVIEW: The trigger condition 'Wenn in dieser SG12 AJT DE4465=A34/A39/AA2/AB2' is evaluable via group-scoped multi-qualifier check on SG12. AJT DE4465 is at elements[0][0]. The subsequent repetition rule is informational. (medium confidence)
1233    fn evaluate_534(&self, ctx: &EvaluationContext) -> ConditionResult {
1234        // Check if this SG12 contains AJT DE4465 with one of the specified codes.
1235        // When any of these codes is present, SG12 must be repeated until all
1236        // relevant complaint/claim numbers are listed in RFF segments.
1237        ctx.any_group_has_any_qualifier("AJT", 0, &["A34", "A39", "AA2", "AB2"], &["SG12"])
1238    }
1239
1240    /// [535] Hinweis: Diese SG7 ist so oft mit AJT DE4465 = A80 zu wiederholen, bis die Rechnungsnummern der nicht stornierten Sonderrechnungen mit derselben Sonderrechnungsart wie sie in Sonderrechnung genannt...
1241    fn evaluate_535(&self, _ctx: &EvaluationContext) -> ConditionResult {
1242        // Hinweis: Diese SG7 ist so oft mit AJT DE4465 = A80 zu wiederholen, bis die Rechnungsnummern der nicht stornierten Sonderrechnungen... — informational note about repetition cardinality, always applies
1243        ConditionResult::True
1244    }
1245
1246    /// [536] Hinweis: Dieses DE darf keine Abschlagsrechnungsnummer enthalten
1247    fn evaluate_536(&self, _ctx: &EvaluationContext) -> ConditionResult {
1248        // Hinweis: Dieses DE darf keine Abschlagsrechnungsnummer enthalten — informational note about field usage restriction, always applies
1249        ConditionResult::True
1250    }
1251
1252    /// [537] Hinweis: Diese SG7 ist so oft mit AJT DE4465 = AC5 zu wiederholen, bis alle Rechnungsnummern im RFF Segment dieser SG7 genannt sind, die in der INVOIC berücksichtigt werden sollten, die in diesem ...
1253    fn evaluate_537(&self, _ctx: &EvaluationContext) -> ConditionResult {
1254        // Hinweis: Diese SG7 ist so oft mit AJT DE4465 = AC5 zu wiederholen, bis alle Rechnungsnummern im RFF Segment dieser SG7 genannt sind... — informational note about repetition cardinality, always applies
1255        ConditionResult::True
1256    }
1257
1258    /// [538] Hinweis: Jede Positionsnummer eines Angebotes muss in einem separaten DE4440 angegeben werden. Reichen die fünf DE4440 für die Positionsnummern aller anzugebenden Angebote nicht aus, ist das SG7 ...
1259    fn evaluate_538(&self, _ctx: &EvaluationContext) -> ConditionResult {
1260        // Hinweis: Jede Positionsnummer eines Angebotes muss in einem separaten DE4440 angegeben werden. Reichen die fünf DE4440 nicht aus, ist das SG7 FTX+Z16 zu wiederholen. — informational note about field usage, always applies
1261        ConditionResult::True
1262    }
1263
1264    /// [548] Hinweis: Die Befüllung des Datenelements ergibt sich aus dem zugehörigen EBD.
1265    fn evaluate_548(&self, _ctx: &EvaluationContext) -> ConditionResult {
1266        // Hinweis: Die Befüllung des Datenelements ergibt sich aus dem zugehörigen EBD.
1267        ConditionResult::True
1268    }
1269
1270    /// [549] Hinweis: Es darf nur eine Information im DE3148 übermittelt werden
1271    fn evaluate_549(&self, _ctx: &EvaluationContext) -> ConditionResult {
1272        // Hinweis: Es darf nur eine Information im DE3148 übermittelt werden — informational note, always applies
1273        ConditionResult::True
1274    }
1275
1276    /// [926] Format: Möglicher Wert: 0
1277    // REVIEW: Format condition checking that the value equals 0. Applied to MOA segment (monetary amount) which is the primary numeric field in REMADV. The segment is the most likely target for this constraint in REMADV context. (medium confidence)
1278    fn evaluate_926(&self, ctx: &EvaluationContext) -> ConditionResult {
1279        ctx.format_check("MOA", 0, 1, |val| validate_numeric(val, "==", 0.0))
1280    }
1281
1282    /// [930] Format: max. 2 Nachkommastellen
1283    // REVIEW: Format condition for maximum 2 decimal places. Applied to MOA segment value (element[0][1]) which is the primary numeric data element in REMADV messages. (medium confidence)
1284    fn evaluate_930(&self, ctx: &EvaluationContext) -> ConditionResult {
1285        ctx.format_check("MOA", 0, 1, |val| validate_max_decimal_places(val, 2))
1286    }
1287
1288    /// [931] Format: ZZZ = +00
1289    fn evaluate_931(&self, ctx: &EvaluationContext) -> ConditionResult {
1290        ctx.format_check("DTM", 0, 1, validate_timezone_utc)
1291    }
1292
1293    /// [939] Format: Die Zeichenkette muss die Zeichen @ und . enthalten
1294    fn evaluate_939(&self, ctx: &EvaluationContext) -> ConditionResult {
1295        ctx.format_check("COM", 0, 0, validate_email)
1296    }
1297
1298    /// [940] Format: Die Zeichenkette muss mit dem Zeichen + beginnen und danach dürfen nur noch Ziffern folgen
1299    fn evaluate_940(&self, ctx: &EvaluationContext) -> ConditionResult {
1300        ctx.format_check("COM", 0, 0, validate_phone)
1301    }
1302}