Skip to main content

automapper_validation/generated/fv2604/
remadv_conditions_fv2604.rs

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