Skip to main content

automapper_validation/generated/fv2504/
remadv_conditions_fv2504.rs

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