automapper_validation/generated/fv2504/orders_conditions_fv2504.rs
1// <auto-generated>
2// Generated by automapper-generator generate-conditions
3// AHB: xml-migs-and-ahbs/FV2504/ORDERS_AHB_1_0a_Fehlerkorrektur_20250623.xml
4// Generated: 2026-03-12T10:26:58Z
5// </auto-generated>
6
7// LLM-produced bodies aren't idiomatic Rust — silence stylistic lints at
8// file scope so `cargo clippy -D warnings` stays green. Correctness,
9// suspicious, and perf categories stay on so real bugs still surface.
10#![allow(clippy::style, clippy::complexity)]
11
12#[allow(unused_imports)]
13use crate::eval::format_validators::*;
14use crate::eval::{ConditionEvaluator, ConditionResult, EvaluationContext};
15
16/// Generated condition evaluator for ORDERS FV2504.
17pub struct OrdersConditionEvaluatorFV2504 {
18 // External condition IDs that require runtime context.
19 external_conditions: std::collections::HashSet<u32>,
20}
21
22impl Default for OrdersConditionEvaluatorFV2504 {
23 fn default() -> Self {
24 let mut external_conditions = std::collections::HashSet::new();
25 external_conditions.insert(6);
26 external_conditions.insert(7);
27 external_conditions.insert(9);
28 external_conditions.insert(15);
29 external_conditions.insert(16);
30 external_conditions.insert(17);
31 external_conditions.insert(23);
32 external_conditions.insert(26);
33 external_conditions.insert(27);
34 external_conditions.insert(28);
35 external_conditions.insert(29);
36 external_conditions.insert(36);
37 external_conditions.insert(45);
38 external_conditions.insert(60);
39 external_conditions.insert(61);
40 external_conditions.insert(62);
41 external_conditions.insert(63);
42 external_conditions.insert(76);
43 external_conditions.insert(78);
44 external_conditions.insert(82);
45 external_conditions.insert(86);
46 external_conditions.insert(91);
47 external_conditions.insert(95);
48 external_conditions.insert(96);
49 external_conditions.insert(100);
50 external_conditions.insert(101);
51 external_conditions.insert(104);
52 external_conditions.insert(105);
53 external_conditions.insert(125);
54 external_conditions.insert(126);
55 external_conditions.insert(127);
56 external_conditions.insert(128);
57 external_conditions.insert(129);
58 external_conditions.insert(131);
59 external_conditions.insert(132);
60 external_conditions.insert(133);
61 external_conditions.insert(140);
62 external_conditions.insert(141);
63 external_conditions.insert(142);
64 external_conditions.insert(143);
65 external_conditions.insert(152);
66 external_conditions.insert(153);
67 external_conditions.insert(154);
68 external_conditions.insert(155);
69 external_conditions.insert(156);
70 external_conditions.insert(157);
71 external_conditions.insert(158);
72 external_conditions.insert(159);
73 external_conditions.insert(160);
74 external_conditions.insert(162);
75 external_conditions.insert(164);
76 external_conditions.insert(165);
77 external_conditions.insert(166);
78 external_conditions.insert(172);
79 external_conditions.insert(178);
80 external_conditions.insert(179);
81 external_conditions.insert(180);
82 external_conditions.insert(492);
83 external_conditions.insert(493);
84 external_conditions.insert(2001);
85 external_conditions.insert(2065);
86 Self {
87 external_conditions,
88 }
89 }
90}
91
92impl ConditionEvaluator for OrdersConditionEvaluatorFV2504 {
93 fn message_type(&self) -> &str {
94 "ORDERS"
95 }
96
97 fn format_version(&self) -> &str {
98 "FV2504"
99 }
100
101 fn evaluate(&self, condition: u32, ctx: &EvaluationContext) -> ConditionResult {
102 match condition {
103 1 => self.evaluate_1(ctx),
104 2 => self.evaluate_2(ctx),
105 6 => self.evaluate_6(ctx),
106 7 => self.evaluate_7(ctx),
107 9 => self.evaluate_9(ctx),
108 12 => self.evaluate_12(ctx),
109 13 => self.evaluate_13(ctx),
110 15 => self.evaluate_15(ctx),
111 16 => self.evaluate_16(ctx),
112 17 => self.evaluate_17(ctx),
113 18 => self.evaluate_18(ctx),
114 19 => self.evaluate_19(ctx),
115 21 => self.evaluate_21(ctx),
116 23 => self.evaluate_23(ctx),
117 24 => self.evaluate_24(ctx),
118 26 => self.evaluate_26(ctx),
119 27 => self.evaluate_27(ctx),
120 28 => self.evaluate_28(ctx),
121 29 => self.evaluate_29(ctx),
122 33 => self.evaluate_33(ctx),
123 34 => self.evaluate_34(ctx),
124 35 => self.evaluate_35(ctx),
125 36 => self.evaluate_36(ctx),
126 38 => self.evaluate_38(ctx),
127 45 => self.evaluate_45(ctx),
128 46 => self.evaluate_46(ctx),
129 47 => self.evaluate_47(ctx),
130 51 => self.evaluate_51(ctx),
131 54 => self.evaluate_54(ctx),
132 55 => self.evaluate_55(ctx),
133 56 => self.evaluate_56(ctx),
134 57 => self.evaluate_57(ctx),
135 60 => self.evaluate_60(ctx),
136 61 => self.evaluate_61(ctx),
137 62 => self.evaluate_62(ctx),
138 63 => self.evaluate_63(ctx),
139 64 => self.evaluate_64(ctx),
140 65 => self.evaluate_65(ctx),
141 67 => self.evaluate_67(ctx),
142 68 => self.evaluate_68(ctx),
143 69 => self.evaluate_69(ctx),
144 70 => self.evaluate_70(ctx),
145 76 => self.evaluate_76(ctx),
146 77 => self.evaluate_77(ctx),
147 78 => self.evaluate_78(ctx),
148 79 => self.evaluate_79(ctx),
149 80 => self.evaluate_80(ctx),
150 81 => self.evaluate_81(ctx),
151 82 => self.evaluate_82(ctx),
152 83 => self.evaluate_83(ctx),
153 84 => self.evaluate_84(ctx),
154 85 => self.evaluate_85(ctx),
155 86 => self.evaluate_86(ctx),
156 87 => self.evaluate_87(ctx),
157 91 => self.evaluate_91(ctx),
158 93 => self.evaluate_93(ctx),
159 94 => self.evaluate_94(ctx),
160 95 => self.evaluate_95(ctx),
161 96 => self.evaluate_96(ctx),
162 97 => self.evaluate_97(ctx),
163 99 => self.evaluate_99(ctx),
164 100 => self.evaluate_100(ctx),
165 101 => self.evaluate_101(ctx),
166 102 => self.evaluate_102(ctx),
167 103 => self.evaluate_103(ctx),
168 104 => self.evaluate_104(ctx),
169 105 => self.evaluate_105(ctx),
170 106 => self.evaluate_106(ctx),
171 107 => self.evaluate_107(ctx),
172 108 => self.evaluate_108(ctx),
173 109 => self.evaluate_109(ctx),
174 110 => self.evaluate_110(ctx),
175 112 => self.evaluate_112(ctx),
176 113 => self.evaluate_113(ctx),
177 114 => self.evaluate_114(ctx),
178 115 => self.evaluate_115(ctx),
179 117 => self.evaluate_117(ctx),
180 118 => self.evaluate_118(ctx),
181 119 => self.evaluate_119(ctx),
182 120 => self.evaluate_120(ctx),
183 121 => self.evaluate_121(ctx),
184 122 => self.evaluate_122(ctx),
185 123 => self.evaluate_123(ctx),
186 124 => self.evaluate_124(ctx),
187 125 => self.evaluate_125(ctx),
188 126 => self.evaluate_126(ctx),
189 127 => self.evaluate_127(ctx),
190 128 => self.evaluate_128(ctx),
191 129 => self.evaluate_129(ctx),
192 130 => self.evaluate_130(ctx),
193 131 => self.evaluate_131(ctx),
194 132 => self.evaluate_132(ctx),
195 133 => self.evaluate_133(ctx),
196 134 => self.evaluate_134(ctx),
197 135 => self.evaluate_135(ctx),
198 136 => self.evaluate_136(ctx),
199 137 => self.evaluate_137(ctx),
200 138 => self.evaluate_138(ctx),
201 139 => self.evaluate_139(ctx),
202 140 => self.evaluate_140(ctx),
203 141 => self.evaluate_141(ctx),
204 142 => self.evaluate_142(ctx),
205 143 => self.evaluate_143(ctx),
206 147 => self.evaluate_147(ctx),
207 148 => self.evaluate_148(ctx),
208 152 => self.evaluate_152(ctx),
209 153 => self.evaluate_153(ctx),
210 154 => self.evaluate_154(ctx),
211 155 => self.evaluate_155(ctx),
212 156 => self.evaluate_156(ctx),
213 157 => self.evaluate_157(ctx),
214 158 => self.evaluate_158(ctx),
215 159 => self.evaluate_159(ctx),
216 160 => self.evaluate_160(ctx),
217 161 => self.evaluate_161(ctx),
218 162 => self.evaluate_162(ctx),
219 163 => self.evaluate_163(ctx),
220 164 => self.evaluate_164(ctx),
221 165 => self.evaluate_165(ctx),
222 166 => self.evaluate_166(ctx),
223 167 => self.evaluate_167(ctx),
224 168 => self.evaluate_168(ctx),
225 169 => self.evaluate_169(ctx),
226 170 => self.evaluate_170(ctx),
227 171 => self.evaluate_171(ctx),
228 172 => self.evaluate_172(ctx),
229 173 => self.evaluate_173(ctx),
230 174 => self.evaluate_174(ctx),
231 175 => self.evaluate_175(ctx),
232 176 => self.evaluate_176(ctx),
233 177 => self.evaluate_177(ctx),
234 178 => self.evaluate_178(ctx),
235 179 => self.evaluate_179(ctx),
236 180 => self.evaluate_180(ctx),
237 490 => self.evaluate_490(ctx),
238 491 => self.evaluate_491(ctx),
239 492 => self.evaluate_492(ctx),
240 493 => self.evaluate_493(ctx),
241 494 => self.evaluate_494(ctx),
242 495 => self.evaluate_495(ctx),
243 500 => self.evaluate_500(ctx),
244 501 => self.evaluate_501(ctx),
245 503 => self.evaluate_503(ctx),
246 506 => self.evaluate_506(ctx),
247 507 => self.evaluate_507(ctx),
248 514 => self.evaluate_514(ctx),
249 515 => self.evaluate_515(ctx),
250 517 => self.evaluate_517(ctx),
251 518 => self.evaluate_518(ctx),
252 519 => self.evaluate_519(ctx),
253 521 => self.evaluate_521(ctx),
254 522 => self.evaluate_522(ctx),
255 523 => self.evaluate_523(ctx),
256 525 => self.evaluate_525(ctx),
257 527 => self.evaluate_527(ctx),
258 530 => self.evaluate_530(ctx),
259 531 => self.evaluate_531(ctx),
260 532 => self.evaluate_532(ctx),
261 533 => self.evaluate_533(ctx),
262 535 => self.evaluate_535(ctx),
263 536 => self.evaluate_536(ctx),
264 539 => self.evaluate_539(ctx),
265 540 => self.evaluate_540(ctx),
266 542 => self.evaluate_542(ctx),
267 543 => self.evaluate_543(ctx),
268 545 => self.evaluate_545(ctx),
269 547 => self.evaluate_547(ctx),
270 548 => self.evaluate_548(ctx),
271 549 => self.evaluate_549(ctx),
272 550 => self.evaluate_550(ctx),
273 551 => self.evaluate_551(ctx),
274 552 => self.evaluate_552(ctx),
275 553 => self.evaluate_553(ctx),
276 554 => self.evaluate_554(ctx),
277 555 => self.evaluate_555(ctx),
278 557 => self.evaluate_557(ctx),
279 558 => self.evaluate_558(ctx),
280 559 => self.evaluate_559(ctx),
281 560 => self.evaluate_560(ctx),
282 561 => self.evaluate_561(ctx),
283 562 => self.evaluate_562(ctx),
284 563 => self.evaluate_563(ctx),
285 564 => self.evaluate_564(ctx),
286 566 => self.evaluate_566(ctx),
287 567 => self.evaluate_567(ctx),
288 568 => self.evaluate_568(ctx),
289 569 => self.evaluate_569(ctx),
290 570 => self.evaluate_570(ctx),
291 571 => self.evaluate_571(ctx),
292 572 => self.evaluate_572(ctx),
293 573 => self.evaluate_573(ctx),
294 574 => self.evaluate_574(ctx),
295 575 => self.evaluate_575(ctx),
296 576 => self.evaluate_576(ctx),
297 903 => self.evaluate_903(ctx),
298 906 => self.evaluate_906(ctx),
299 911 => self.evaluate_911(ctx),
300 914 => self.evaluate_914(ctx),
301 922 => self.evaluate_922(ctx),
302 930 => self.evaluate_930(ctx),
303 931 => self.evaluate_931(ctx),
304 932 => self.evaluate_932(ctx),
305 933 => self.evaluate_933(ctx),
306 934 => self.evaluate_934(ctx),
307 935 => self.evaluate_935(ctx),
308 939 => self.evaluate_939(ctx),
309 940 => self.evaluate_940(ctx),
310 950 => self.evaluate_950(ctx),
311 951 => self.evaluate_951(ctx),
312 955 => self.evaluate_955(ctx),
313 960 => self.evaluate_960(ctx),
314 961 => self.evaluate_961(ctx),
315 962 => self.evaluate_962(ctx),
316 967 => self.evaluate_967(ctx),
317 2001 => self.evaluate_2001(ctx),
318 2002 => self.evaluate_2002(ctx),
319 2003 => self.evaluate_2003(ctx),
320 2004 => self.evaluate_2004(ctx),
321 2005 => self.evaluate_2005(ctx),
322 2006 => self.evaluate_2006(ctx),
323 2007 => self.evaluate_2007(ctx),
324 2044 => self.evaluate_2044(ctx),
325 2050 => self.evaluate_2050(ctx),
326 2060 => self.evaluate_2060(ctx),
327 2061 => self.evaluate_2061(ctx),
328 2062 => self.evaluate_2062(ctx),
329 2063 => self.evaluate_2063(ctx),
330 2064 => self.evaluate_2064(ctx),
331 2065 => self.evaluate_2065(ctx),
332 2066 => self.evaluate_2066(ctx),
333 2088 => self.evaluate_2088(ctx),
334 2089 => self.evaluate_2089(ctx),
335 2090 => self.evaluate_2090(ctx),
336 2092 => self.evaluate_2092(ctx),
337 2094 => self.evaluate_2094(ctx),
338 2095 => self.evaluate_2095(ctx),
339 2096 => self.evaluate_2096(ctx),
340 2097 => self.evaluate_2097(ctx),
341 2098 => self.evaluate_2098(ctx),
342 2099 => self.evaluate_2099(ctx),
343 _ => ConditionResult::Unknown,
344 }
345 }
346
347 fn is_external(&self, condition: u32) -> bool {
348 self.external_conditions.contains(&condition)
349 }
350 fn is_known(&self, condition: u32) -> bool {
351 matches!(
352 condition,
353 1 | 2
354 | 6
355 | 7
356 | 9
357 | 12
358 | 13
359 | 15
360 | 16
361 | 17
362 | 18
363 | 19
364 | 21
365 | 23
366 | 24
367 | 26
368 | 27
369 | 28
370 | 29
371 | 33
372 | 34
373 | 35
374 | 36
375 | 38
376 | 45
377 | 46
378 | 47
379 | 51
380 | 54
381 | 55
382 | 56
383 | 57
384 | 60
385 | 61
386 | 62
387 | 63
388 | 64
389 | 65
390 | 67
391 | 68
392 | 69
393 | 70
394 | 76
395 | 77
396 | 78
397 | 79
398 | 80
399 | 81
400 | 82
401 | 83
402 | 84
403 | 85
404 | 86
405 | 87
406 | 91
407 | 93
408 | 94
409 | 95
410 | 96
411 | 97
412 | 99
413 | 100
414 | 101
415 | 102
416 | 103
417 | 104
418 | 105
419 | 106
420 | 107
421 | 108
422 | 109
423 | 110
424 | 112
425 | 113
426 | 114
427 | 115
428 | 117
429 | 118
430 | 119
431 | 120
432 | 121
433 | 122
434 | 123
435 | 124
436 | 125
437 | 126
438 | 127
439 | 128
440 | 129
441 | 130
442 | 131
443 | 132
444 | 133
445 | 134
446 | 135
447 | 136
448 | 137
449 | 138
450 | 139
451 | 140
452 | 141
453 | 142
454 | 143
455 | 147
456 | 148
457 | 152
458 | 153
459 | 154
460 | 155
461 | 156
462 | 157
463 | 158
464 | 159
465 | 160
466 | 161
467 | 162
468 | 163
469 | 164
470 | 165
471 | 166
472 | 167
473 | 168
474 | 169
475 | 170
476 | 171
477 | 172
478 | 173
479 | 174
480 | 175
481 | 176
482 | 177
483 | 178
484 | 179
485 | 180
486 | 490
487 | 491
488 | 492
489 | 493
490 | 494
491 | 495
492 | 500
493 | 501
494 | 503
495 | 506
496 | 507
497 | 514
498 | 515
499 | 517
500 | 518
501 | 519
502 | 521
503 | 522
504 | 523
505 | 525
506 | 527
507 | 530
508 | 531
509 | 532
510 | 533
511 | 535
512 | 536
513 | 539
514 | 540
515 | 542
516 | 543
517 | 545
518 | 547
519 | 548
520 | 549
521 | 550
522 | 551
523 | 552
524 | 553
525 | 554
526 | 555
527 | 557
528 | 558
529 | 559
530 | 560
531 | 561
532 | 562
533 | 563
534 | 564
535 | 566
536 | 567
537 | 568
538 | 569
539 | 570
540 | 571
541 | 572
542 | 573
543 | 574
544 | 575
545 | 576
546 | 903
547 | 906
548 | 911
549 | 914
550 | 922
551 | 930
552 | 931
553 | 932
554 | 933
555 | 934
556 | 935
557 | 939
558 | 940
559 | 950
560 | 951
561 | 955
562 | 960
563 | 961
564 | 962
565 | 967
566 | 2001
567 | 2002
568 | 2003
569 | 2004
570 | 2005
571 | 2006
572 | 2007
573 | 2044
574 | 2050
575 | 2060
576 | 2061
577 | 2062
578 | 2063
579 | 2064
580 | 2065
581 | 2066
582 | 2088
583 | 2089
584 | 2090
585 | 2092
586 | 2094
587 | 2095
588 | 2096
589 | 2097
590 | 2098
591 | 2099
592 )
593 }
594}
595
596impl OrdersConditionEvaluatorFV2504 {
597 /// [16] Wenn eine untergeordnete SG vorhanden
598 /// EXTERNAL: Requires context from outside the message.
599 // REVIEW: Generic structural condition: 'if a subordinate SG is present'. Depends entirely on which child segment group is being checked in context — the condition number is reused across many segment rows with different child SGs. Cannot be resolved from the EDIFACT message content alone; requires the validation framework to supply structural position context. (medium confidence)
600 fn evaluate_16(&self, ctx: &EvaluationContext) -> ConditionResult {
601 ctx.external.evaluate("subordinate_sg_present")
602 }
603
604 /// [17] Wenn ein Segment innerhalb der SG vorhanden
605 /// EXTERNAL: Requires context from outside the message.
606 // REVIEW: Generic structural condition: 'if a segment within the SG is present'. Like [16], this condition number is reused across many rows and the specific segment being checked depends on the validation context. Cannot determine which segment to check without positional context supplied externally. (medium confidence)
607 fn evaluate_17(&self, ctx: &EvaluationContext) -> ConditionResult {
608 ctx.external.evaluate("segment_within_sg_present")
609 }
610
611 /// [78] Wenn in derselben SG29 mit Z55 in LIN DE1229 (Erforderliches Produkt der Netzlokation) das PIA+5 DE7140 mit einem Messprodukt aus Codeliste der Konfigurationen, Kapitel 2 „Codeliste der Standard-...
612 /// EXTERNAL: Requires context from outside the message.
613 // REVIEW: Requires checking PIA DE7140 against an external code list from 'Codeliste der Konfigurationen, Kapitel 2 – Codeliste der Standard-Messprodukt Strom für Werte nach Typ 1' filtered to those with the Werteigenschaft 'Blindarbeit'. The structural check (LIN Z55 + PIA+5 in same SG29) is possible via navigator, but the code list membership for 'Blindarbeit' products is an external reference that cannot be determined from the EDIFACT message alone. (medium confidence)
614 fn evaluate_78(&self, ctx: &EvaluationContext) -> ConditionResult {
615 ctx.external
616 .evaluate("pia_has_blindarbeit_product_netzlokation")
617 }
618
619 /// [82] Wenn eine andere SG29 mit Z54 in LIN DE1229 (Erforderliches Produkt der Marktlokation) mit PIA+5 DE7140 mit einem Messprodukt aus Codeliste der Konfigurationen, Kapitel 2.1.1 „Standard-Messproduk...
620 /// EXTERNAL: Requires context from outside the message.
621 // REVIEW: Requires: (1) finding ANOTHER SG29 (not the current one) where LIN DE1229 = Z54, (2) that SG29 also has PIA+5, and (3) PIA DE7140 is from 'Codeliste der Konfigurationen, Kapitel 2.1.1 – Standard-Messprodukt der Marktlokation mit der Wahlmöglichkeit der Zuordnung einer Zählzeit'. The code list membership is external and cannot be determined from the EDIFACT message alone. (medium confidence)
622 fn evaluate_82(&self, ctx: &EvaluationContext) -> ConditionResult {
623 ctx.external
624 .evaluate("other_sg29_z54_with_zaehlzeit_product")
625 }
626
627 /// [83] Wenn keine andere SG29 mit Z54 in LIN DE1229 (Erforderliches Produkt der Marktlokation) mit PIA+5 DE7140 mit einem Messprodukt aus Codeliste der Konfigurationen Kapitel 2.1.1 „Standard-Messproduk...
628 // REVIEW: Logical negation of condition [82]: 'wenn KEINE andere SG29 mit Z54 ... vorhanden ist'. Implemented by inverting the external result for [82]. Returns Unknown when the underlying external condition is Unknown (e.g., code list not available). (medium confidence)
629 fn evaluate_83(&self, ctx: &EvaluationContext) -> ConditionResult {
630 match ctx
631 .external
632 .evaluate("other_sg29_z54_with_zaehlzeit_product")
633 {
634 ConditionResult::True => ConditionResult::False,
635 ConditionResult::False => ConditionResult::True,
636 ConditionResult::Unknown => ConditionResult::Unknown,
637 }
638 }
639
640 /// [86] Wenn in derselben SG29 mit Z19 in LIN DE1229 (Erforderliches Produkt der Messlokation) das PIA+5 DE7140 mit einem Messprodukt aus Codeliste der Konfigurationen Kapitel 2.3.1 "Standard-Messprodukt d...
641 /// EXTERNAL: Requires context from outside the message.
642 fn evaluate_86(&self, ctx: &EvaluationContext) -> ConditionResult {
643 ctx.external
644 .evaluate("pia_z19_has_standard_messprodukt_with_zählzeit_wahlmöglichkeit")
645 }
646
647 /// [91] Wenn in diesem Datenelement kein anderes Paket zur Möglichkeit der Angabe von mindestens einem anderen Code führt.
648 /// EXTERNAL: Requires context from outside the message.
649 fn evaluate_91(&self, ctx: &EvaluationContext) -> ConditionResult {
650 ctx.external
651 .evaluate("no_other_package_enables_additional_code")
652 }
653
654 /// [126] Es sind nur die Konfigurations-Produkte erlaubt, die in der Codeliste der Konfigurationen im Kapitel 4.2 „Konfigurationsprodukte Leistungskurvendefinition“ enthalten sind.
655 /// EXTERNAL: Requires context from outside the message.
656 fn evaluate_126(&self, ctx: &EvaluationContext) -> ConditionResult {
657 ctx.external
658 .evaluate("product_in_konfigurationsprodukte_leistungskurvendefinition")
659 }
660
661 /// [127] Es sind nur die Konfigurations-Produkte erlaubt, die in der Codeliste der Konfigurationen im Kapitel 4.3 „Konfigurationsprodukte Ad-Hoc-Steuerkanal“ enthalten sind.
662 /// EXTERNAL: Requires context from outside the message.
663 fn evaluate_127(&self, ctx: &EvaluationContext) -> ConditionResult {
664 ctx.external
665 .evaluate("product_in_konfigurationsprodukte_ad_hoc_steuerkanal")
666 }
667
668 /// [128] Es sind nur die Messprodukte erlaubt, die in der Codeliste der Konfigurationen im Kapitel 4.5 „Messprodukte für Werte nach Typ 2 aus Backend für LF und NB“ enthalten sind.
669 /// EXTERNAL: Requires context from outside the message.
670 fn evaluate_128(&self, ctx: &EvaluationContext) -> ConditionResult {
671 ctx.external
672 .evaluate("product_in_messprodukte_typ2_backend_lf_nb")
673 }
674
675 /// [129] Es sind nur die Messprodukte erlaubt, die in der Codeliste der Konfigurationen im Kapitel 4.4 „Messprodukte mit Konfigurationserlaubnis für Werte nach Typ 2 aus SMGW“ enthalten sind.
676 /// EXTERNAL: Requires context from outside the message.
677 fn evaluate_129(&self, ctx: &EvaluationContext) -> ConditionResult {
678 ctx.external
679 .evaluate("product_in_smgw_typ2_konfiguration_codeliste")
680 }
681
682 /// [141] Es sind nur die Messprodukt-Position-Codes erlaubt, die in der Codeliste der Konfigurationen im Kapitel 4.7 „Art der Werte für Messprodukte nach Typ 2“ enthalten sind.
683 /// EXTERNAL: Requires context from outside the message.
684 fn evaluate_141(&self, ctx: &EvaluationContext) -> ConditionResult {
685 ctx.external
686 .evaluate("messprodukt_position_code_in_typ2_art_codeliste")
687 }
688
689 /// [142] Wenn innerhalb derselben SG29 LIN im PIA+5 DE7140 (Erforderliches Produkt Konfigurationserlaubnis für Werte nach Typ 2 aus SMGW) ein Produkt angegeben ist, das in der Codeliste der Konfigurationen...
690 /// EXTERNAL: Requires context from outside the message.
691 fn evaluate_142(&self, ctx: &EvaluationContext) -> ConditionResult {
692 ctx.external
693 .evaluate("smgw_product_triggers_on_threshold_crossing")
694 }
695
696 /// [143] Wenn in LOC+172 DE3225 (Meldepunkt) die ID einer Steuerbaren Ressource angegeben ist
697 /// EXTERNAL: Requires context from outside the message.
698 fn evaluate_143(&self, ctx: &EvaluationContext) -> ConditionResult {
699 ctx.external.evaluate("meldepunkt_is_steuerbare_ressource")
700 }
701
702 /// [152] Wenn in SG29 LIN (Erforderliches Produkt der Messlokation) das PIA+5 DE7140 mit einem Produkt-Code vorhanden ist der in der Codeliste der Konfigurationen im Kapitel 7 "Produkte zur Bestellung einer...
703 /// EXTERNAL: Requires context from outside the message.
704 fn evaluate_152(&self, ctx: &EvaluationContext) -> ConditionResult {
705 ctx.external
706 .evaluate("messlokation_product_is_weitere_energieflussrichtung")
707 }
708
709 /// [153] Es sind nur die Produkt-Codes erlaubt, die in der Codeliste der Konfigurationen im Kapitel 7 "Produkte zur Bestellung einer Änderung an einer Lokation" die in der Spalte "Ebene" mit dem Wert "Mess...
710 /// EXTERNAL: Requires context from outside the message.
711 fn evaluate_153(&self, ctx: &EvaluationContext) -> ConditionResult {
712 ctx.external.evaluate("product_code_level_messlokation")
713 }
714
715 /// [154] Es sind nur die Produkt-Codes erlaubt, die in der Codeliste der Konfigurationen im Kapitel 7 "Produkte zur Bestellung einer Änderung an einer Lokation" die in der Spalte "Ebene" mit dem Wert "Netz...
716 /// EXTERNAL: Requires context from outside the message.
717 fn evaluate_154(&self, ctx: &EvaluationContext) -> ConditionResult {
718 ctx.external.evaluate("product_code_level_netzlokation")
719 }
720
721 /// [155] Es sind nur die Produkt-Codes erlaubt, die in der Codeliste der Konfigurationen im Kapitel 7 "Produkte zur Bestellung einer Änderung an einer Lokation" die in der Spalte "Ebene" mit dem Wert "Steu...
722 /// EXTERNAL: Requires context from outside the message.
723 fn evaluate_155(&self, ctx: &EvaluationContext) -> ConditionResult {
724 ctx.external
725 .evaluate("product_code_level_steuerbare_ressource")
726 }
727
728 /// [156] Es sind weiterhin nur die Produkt-Codes erlaubt, die in der Codeliste der Konfigurationen im Kapitel 7 "Produkte zur Bestellung einer Änderung an einer Lokation" die in der Spalte "Produkt gegenü...
729 /// EXTERNAL: Requires context from outside the message.
730 fn evaluate_156(&self, ctx: &EvaluationContext) -> ConditionResult {
731 ctx.external.evaluate("product_code_orderable_by_nb")
732 }
733
734 /// [157] Es sind weiterhin nur die Produkt-Codes erlaubt, die in der Codeliste der Konfigurationen im Kapitel 7 "Produkte zur Bestellung einer Änderung an einer Lokation" die in der Spalte "Produkt gegenü...
735 /// EXTERNAL: Requires context from outside the message.
736 fn evaluate_157(&self, ctx: &EvaluationContext) -> ConditionResult {
737 ctx.external.evaluate("product_code_orderable_by_lf")
738 }
739
740 /// [158] Es sind nur die Produkt-Codes erlaubt, die in der Codeliste der Konfigurationen im Kapitel 6.2 "Produkte zur Bestellung einer Änderung von Abrechnungsdaten" genannt sind.
741 /// EXTERNAL: Requires context from outside the message.
742 fn evaluate_158(&self, ctx: &EvaluationContext) -> ConditionResult {
743 ctx.external
744 .evaluate("product_code_in_abrechnungsdaten_configuration_list")
745 }
746
747 /// [159] Wenn in derselben SG29 LIN im PIA+5 (Erforderliches Produkt Abrechnungsdaten) DE7140 ein Produkt-Code genannt ist, der in der Codeliste der Konfigurationen im Kapitel 6.2 "Produkte zur Bestellung e...
748 /// EXTERNAL: Requires context from outside the message.
749 fn evaluate_159(&self, ctx: &EvaluationContext) -> ConditionResult {
750 ctx.external
751 .evaluate("abrechnungsdaten_product_has_property_code_column")
752 }
753
754 /// [160] Es sind nur die Codes der Produkteigenschaft zu dem in derselben SG29 LIN im PIA+5 (Erforderliches Produkt Abrechnungsdaten) DE7140 erlaubt, die in der Codeliste der Konfigurationen im Kapitel 6.2 ...
755 /// EXTERNAL: Requires context from outside the message.
756 fn evaluate_160(&self, ctx: &EvaluationContext) -> ConditionResult {
757 ctx.external
758 .evaluate("abrechnungsdaten_property_code_matches_product_row")
759 }
760
761 /// [162] Es ist nur der Wertebereich erlaubt, der zu dem in derselben SG29 LIN im PIA+5 (Erforderliches Produkt Abrechnungsdaten) DE7140 genannten Produkt, das in der Codeliste der Konfigurationen im Kapite...
762 /// EXTERNAL: Requires context from outside the message.
763 fn evaluate_162(&self, ctx: &EvaluationContext) -> ConditionResult {
764 ctx.external
765 .evaluate("abrechnungsdaten_value_range_matches_product_row")
766 }
767
768 /// [164] Wenn die Konfiguration der in SG34 RFF+Z20 DE1154 (Referenz auf ID der Tranche) genannte Tranche innerhalb derselben SG29 LIN++Z16 (Erforderliches Produkt der Tranche) unverändert bestehen bleibt.
769 /// EXTERNAL: Requires context from outside the message.
770 fn evaluate_164(&self, ctx: &EvaluationContext) -> ConditionResult {
771 ctx.external.evaluate("tranche_configuration_unchanged")
772 }
773
774 /// [165] Wenn die Konfiguration der in SG34 RFF+Z20 DE1154 (Referenz auf ID der Tranche) genannte Tranche innerhalb derselben SG29 LIN++Z16 (Erforderliches Produkt der Tranche) aufgrund einer Zuordnung eine...
775 /// EXTERNAL: Requires context from outside the message.
776 fn evaluate_165(&self, ctx: &EvaluationContext) -> ConditionResult {
777 ctx.external
778 .evaluate("tranche_reconfiguration_by_lf_assignment")
779 }
780
781 /// [166] Wenn es sich um die Einrichtung der Konfigurationen aufgrund einer Zuordnung eines LF zu einer Tranche handelt
782 /// EXTERNAL: Requires context from outside the message.
783 fn evaluate_166(&self, ctx: &EvaluationContext) -> ConditionResult {
784 ctx.external
785 .evaluate("configuration_setup_by_lf_tranche_assignment")
786 }
787
788 /// [172] Wenn es sich bei der in SG2 LOC+172 DE3225 genannten Lokation um die Integration in eine Kundenanlage oder Herauslösung aus einer Kundenanlage nach §20 Abs.1d EnWG handelt. Details siehe UTILMD A...
789 /// EXTERNAL: Requires context from outside the message.
790 fn evaluate_172(&self, ctx: &EvaluationContext) -> ConditionResult {
791 ctx.external
792 .evaluate("location_is_kundenanlage_integration_or_removal")
793 }
794
795 /// [178] Wenn vom NB eine Abtretungserklärung vom Kunden gewünscht ist.
796 /// EXTERNAL: Requires context from outside the message.
797 fn evaluate_178(&self, ctx: &EvaluationContext) -> ConditionResult {
798 ctx.external.evaluate("nb_requires_assignment_declaration")
799 }
800
801 /// [179] Wenn in derselben SG29 LIN im PIA+5 (Erforderliches Produkt Abrechnungsdaten) DE7140 das Produkt "Empfänger der Vergütung zur Einspeisung" aus der Codeliste der Konfigurationen im Kapitel 6.2 "Pr...
802 /// EXTERNAL: Requires context from outside the message — codelist chapter 6.2 "Produkte zur Bestellung …" defines the product codes.
803 fn evaluate_179(&self, ctx: &EvaluationContext) -> ConditionResult {
804 ctx.external
805 .evaluate("empfaenger_verguetung_einspeisung_and_lieferant")
806 }
807
808 /// [180] Wenn in derselben SG29 LIN im PIA+5 (Erforderliches Produkt Abrechnungsdaten) DE7140 ein Produkt-Code genannt ist der in der Codeliste der Konfigurationen im Kapitel 6.2 "Produkte zur Bestellung ei...
809 /// EXTERNAL: Requires context from outside the message.
810 fn evaluate_180(&self, ctx: &EvaluationContext) -> ConditionResult {
811 ctx.external.evaluate("product_code_abrechnungsdaten_valid")
812 }
813
814 /// [490] wenn Wert in diesem DE, an der Stelle CCYYMMDDHHMM ein Zeitpunkt aus dem angegeben Zeitraum der Tabelle Kapitel 3.5 „Übersicht gesetzliche deutsche Sommerzeit (MESZ)“ der Spalten: „Sommerzei...
815 fn evaluate_490(&self, ctx: &EvaluationContext) -> ConditionResult {
816 match ctx.resolved_value {
817 Some(val) => is_mesz_utc(val),
818 None => ConditionResult::False,
819 }
820 }
821
822 /// [491] wenn Wert in diesem DE, an der Stelle CCYYMMDDHHMM ein Zeitpunkt aus dem angegeben Zeitraum der Tabelle Kapitel 3.6 „Übersicht gesetzliche deutsche Zeit (MEZ)“ der Spalten: „Winterzeit (MEZ)...
823 fn evaluate_491(&self, ctx: &EvaluationContext) -> ConditionResult {
824 match ctx.resolved_value {
825 Some(val) => is_mez_utc(val),
826 None => ConditionResult::False,
827 }
828 }
829
830 /// [967] Format: Zertifikatskörper gemäß X509.1, BSI TR-03109-4
831 fn evaluate_967(&self, ctx: &EvaluationContext) -> ConditionResult {
832 // Structural check on the certificate body (base64 charset + plausible
833 // length). Cryptographic validation (signature, CA, BSI profile) is
834 // out of scope for static AHB validation.
835 match ctx.resolved_value {
836 Some(val) => validate_x509_cert_body(val),
837 None => ConditionResult::Unknown,
838 }
839 }
840
841 /// [2001] Die SG29 ist so oft zu wiederholen, wie ab dem DTM+203 (Ausführungsdatum) Tranchen zu der in der SG2 genannten Marktlokation vorhanden sind.
842 /// EXTERNAL: Requires context from outside the message.
843 fn evaluate_2001(&self, ctx: &EvaluationContext) -> ConditionResult {
844 ctx.external.evaluate("sg29_tranche_count_matches")
845 }
846
847 /// [2003] Die SG29 ist so oft zu wiederholen, wie ab dem DTM+203 (Ausführungsdatum) Messlokationen zu der in der SG2 genannten Marktlokation vorhanden sind und für jede dieser Messlokationen müssen alle M...
848 fn evaluate_2003(&self, _ctx: &EvaluationContext) -> ConditionResult {
849 // Hinweis: SG29 repetition cardinality rule — informational annotation documenting that
850 // SG29 must repeat once per Messlokation associated with the Marktlokation from DTM+203,
851 // and all Messprodukte for each Messlokation (including Tranchen) must be listed.
852 // This is a structural cardinality guidance note, always applies.
853 ConditionResult::True
854 }
855
856 /// [2065] Diese SG30 ist so oft zu wiederholen, wie zu den unterschiedlichen Messprodukt-Position-Codes zu dem innerhalb derselben SG29 LIN im PIA+5 DE7140 (Erforderliches Produkt Konfigurationserlaubnis fü...
857 /// EXTERNAL: Requires context from outside the message.
858 fn evaluate_2065(&self, ctx: &EvaluationContext) -> ConditionResult {
859 ctx.external
860 .evaluate("sg30_configuration_threshold_product_cardinality")
861 }
862
863 /// [1] Wenn IMD+Z03 vorhanden
864 fn evaluate_1(&self, ctx: &EvaluationContext) -> ConditionResult {
865 ctx.has_qualifier("IMD", 0, "Z03")
866 }
867
868 /// [2] Wenn BGM+7 vorhanden
869 fn evaluate_2(&self, ctx: &EvaluationContext) -> ConditionResult {
870 ctx.has_qualifier("BGM", 0, "7")
871 }
872
873 /// [6] Wenn MP-ID in SG2 NAD+MS mit Rolle LF vorhanden
874 /// EXTERNAL: Requires context from outside the message.
875 fn evaluate_6(&self, ctx: &EvaluationContext) -> ConditionResult {
876 ctx.external.evaluate("sender_is_lf")
877 }
878
879 /// [7] Wenn MP-ID in SG2 NAD+MS mit Rolle NB vorhanden
880 /// EXTERNAL: Requires context from outside the message.
881 fn evaluate_7(&self, ctx: &EvaluationContext) -> ConditionResult {
882 ctx.external.evaluate("sender_is_nb")
883 }
884
885 /// [9] Wenn bekannt
886 /// EXTERNAL: Requires context from outside the message.
887 // REVIEW: 'Wenn bekannt' (when known) depends on whether a value is known in the business context — cannot be derived from EDIFACT segments alone. (medium confidence)
888 fn evaluate_9(&self, ctx: &EvaluationContext) -> ConditionResult {
889 ctx.external.evaluate("information_is_known")
890 }
891
892 /// [12] Wenn vorhanden
893 // REVIEW: Condition 12 'Wenn vorhanden' is a generic self-referential meta-condition indicating that the attached validation rule applies whenever the field is populated. The validator framework handles actual presence detection; this evaluator simply returns True to indicate the rule is always applicable when invoked. (medium confidence)
894 fn evaluate_12(&self, _ctx: &EvaluationContext) -> ConditionResult {
895 // Wenn vorhanden — generic 'when present' meta-condition
896 // In AHB context this means: validation applies whenever the field is populated.
897 // Returning True here defers the presence check to the validator framework itself.
898 ConditionResult::True
899 }
900
901 /// [13] Wenn SG2 LOC+172 nicht vorhanden
902 fn evaluate_13(&self, ctx: &EvaluationContext) -> ConditionResult {
903 ctx.lacks_qualifier("LOC", 0, "172")
904 }
905
906 /// [15] Wenn MP-ID in SG2 NAD+MS mit Rolle MSB vorhanden
907 /// EXTERNAL: Requires context from outside the message.
908 fn evaluate_15(&self, ctx: &EvaluationContext) -> ConditionResult {
909 ctx.external.evaluate("sender_is_msb")
910 }
911
912 /// [18] Wenn IMD++Z11 vorhanden
913 fn evaluate_18(&self, ctx: &EvaluationContext) -> ConditionResult {
914 let imds = ctx.find_segments("IMD");
915 ConditionResult::from(imds.iter().any(|s| {
916 s.elements
917 .get(1)
918 .and_then(|e| e.first())
919 .is_some_and(|v| v == "Z11")
920 }))
921 }
922
923 /// [19] Wenn IMD++Z12 vorhanden
924 fn evaluate_19(&self, ctx: &EvaluationContext) -> ConditionResult {
925 let imds = ctx.find_segments("IMD");
926 ConditionResult::from(imds.iter().any(|s| {
927 s.elements
928 .get(1)
929 .and_then(|e| e.first())
930 .is_some_and(|v| v == "Z12")
931 }))
932 }
933
934 /// [21] Wenn BGM+Z28 vorhanden
935 fn evaluate_21(&self, ctx: &EvaluationContext) -> ConditionResult {
936 ctx.has_qualifier("BGM", 0, "Z28")
937 }
938
939 /// [23] Wenn MP-ID in SG2 NAD+MR mit Rolle NB vorhanden
940 /// EXTERNAL: Requires context from outside the message.
941 fn evaluate_23(&self, ctx: &EvaluationContext) -> ConditionResult {
942 ctx.external.evaluate("recipient_is_nb")
943 }
944
945 /// [24] Wenn IMD++Z35 vorhanden
946 fn evaluate_24(&self, ctx: &EvaluationContext) -> ConditionResult {
947 let imds = ctx.find_segments("IMD");
948 ConditionResult::from(imds.iter().any(|s| {
949 s.elements
950 .get(1)
951 .and_then(|e| e.first())
952 .is_some_and(|v| v == "Z35")
953 }))
954 }
955
956 /// [26] Wenn MP-ID in SG2 NAD+MS mit Rolle ÜNB vorhanden
957 /// EXTERNAL: Requires context from outside the message.
958 // REVIEW: Whether the NAD+MS market participant holds the role ÜNB (Übertragungsnetzbetreiber) cannot be determined from the EDIFACT message content alone. The role is a business context attribute of the MP-ID that requires an external master data lookup (e.g. Marktstammdatenregister or internal role registry). Marked external with name 'sender_is_uenb'. (medium confidence)
959 fn evaluate_26(&self, ctx: &EvaluationContext) -> ConditionResult {
960 ctx.external.evaluate("sender_is_uenb")
961 }
962
963 /// [27] Wenn MP-ID in SG2 NAD+MR mit Rolle MSB vorhanden
964 /// EXTERNAL: Requires context from outside the message.
965 // REVIEW: Whether the NAD+MR market participant holds the role MSB (Messstellenbetreiber) cannot be determined from the EDIFACT message content alone. The role is a business context attribute of the MP-ID requiring external master data. Marked external with name 'recipient_is_msb'. (medium confidence)
966 fn evaluate_27(&self, ctx: &EvaluationContext) -> ConditionResult {
967 ctx.external.evaluate("recipient_is_msb")
968 }
969
970 /// [28] Wenn MP-ID in SG2 NAD+MR aus Sparte Strom
971 /// EXTERNAL: Requires context from outside the message.
972 fn evaluate_28(&self, ctx: &EvaluationContext) -> ConditionResult {
973 ctx.external.evaluate("recipient_market_sector_is_strom")
974 }
975
976 /// [29] Wenn MP-ID in SG2 NAD+MR aus Sparte Gas
977 /// EXTERNAL: Requires context from outside the message.
978 fn evaluate_29(&self, ctx: &EvaluationContext) -> ConditionResult {
979 ctx.external.evaluate("recipient_market_sector_is_gas")
980 }
981
982 /// [33] Wenn IMD+Z01 vorhanden
983 fn evaluate_33(&self, ctx: &EvaluationContext) -> ConditionResult {
984 ctx.has_qualifier("IMD", 1, "Z01")
985 }
986
987 /// [34] Wenn IMD+Z02 vorhanden
988 fn evaluate_34(&self, ctx: &EvaluationContext) -> ConditionResult {
989 ctx.has_qualifier("IMD", 1, "Z02")
990 }
991
992 /// [35] IMD++Z14+Z06 vorhanden
993 fn evaluate_35(&self, ctx: &EvaluationContext) -> ConditionResult {
994 let imds = ctx.find_segments("IMD");
995 let found = imds.iter().any(|s| {
996 let has_z14 = s
997 .elements
998 .get(1)
999 .and_then(|e| e.first())
1000 .is_some_and(|v| v == "Z14");
1001 let has_z06 = s
1002 .elements
1003 .get(2)
1004 .and_then(|e| e.first())
1005 .is_some_and(|v| v == "Z06");
1006 has_z14 && has_z06
1007 });
1008 ConditionResult::from(found)
1009 }
1010
1011 /// [36] Wenn MP-ID in SG2 NAD+MR mit Rolle NB nicht vorhanden
1012 /// EXTERNAL: Requires context from outside the message.
1013 fn evaluate_36(&self, ctx: &EvaluationContext) -> ConditionResult {
1014 ctx.external.evaluate("recipient_role_is_not_nb")
1015 }
1016
1017 /// [38] Wenn FTX+Z04/Z05 vorhanden
1018 fn evaluate_38(&self, ctx: &EvaluationContext) -> ConditionResult {
1019 let found = ctx.find_segments("FTX").iter().any(|s| {
1020 s.elements
1021 .first()
1022 .and_then(|e| e.first())
1023 .is_some_and(|v| v == "Z04" || v == "Z05")
1024 });
1025 ConditionResult::from(found)
1026 }
1027
1028 /// [45] Wenn MP-ID in SG2 NAD+MS mit Rolle MSB nicht vorhanden
1029 /// EXTERNAL: Requires context from outside the message.
1030 fn evaluate_45(&self, ctx: &EvaluationContext) -> ConditionResult {
1031 ctx.external.evaluate("sender_role_is_not_msb")
1032 }
1033
1034 /// [46] Wenn SG29 IMD++Z46 vorhanden
1035 fn evaluate_46(&self, ctx: &EvaluationContext) -> ConditionResult {
1036 ctx.has_qualifier("IMD", 1, "Z46")
1037 }
1038
1039 /// [47] Wenn SG29 IMD++Z46 nicht vorhanden
1040 fn evaluate_47(&self, ctx: &EvaluationContext) -> ConditionResult {
1041 ctx.lacks_qualifier("IMD", 1, "Z46")
1042 }
1043
1044 /// [51] Wenn BGM+Z48 vorhanden
1045 fn evaluate_51(&self, ctx: &EvaluationContext) -> ConditionResult {
1046 ctx.has_qualifier("BGM", 0, "Z48")
1047 }
1048
1049 /// [54] Wenn FTX+Z06 vorhanden
1050 fn evaluate_54(&self, ctx: &EvaluationContext) -> ConditionResult {
1051 ctx.has_qualifier("FTX", 0, "Z06")
1052 }
1053
1054 /// [55] Wenn DTM+469 (Beginn zum nächstmöglichen Termin) nicht vorhanden
1055 fn evaluate_55(&self, ctx: &EvaluationContext) -> ConditionResult {
1056 ctx.lacks_qualifier("DTM", 0, "469")
1057 }
1058
1059 /// [56] Wenn DTM+203 (Ausführungsdatum) nicht vorhanden
1060 fn evaluate_56(&self, ctx: &EvaluationContext) -> ConditionResult {
1061 ctx.lacks_qualifier("DTM", 0, "203")
1062 }
1063
1064 /// [57] Wenn im selben SG2 NAD DE3124 nicht vorhanden
1065 // REVIEW: Checks if any NAD segment in the message lacks DE3124 (C058 at elements[2][0]). 'Im selben SG2' requires group context; falls back to message-wide check. DE3124 is the first component of C058 (Zeile für Name und Anschrift / Zusatzinfo). (medium confidence)
1066 fn evaluate_57(&self, ctx: &EvaluationContext) -> ConditionResult {
1067 let nads = ctx.find_segments("NAD");
1068 if nads.is_empty() {
1069 return ConditionResult::Unknown;
1070 }
1071 let any_without = nads.iter().any(|nad| {
1072 nad.elements
1073 .get(2)
1074 .and_then(|e| e.first())
1075 .map(|v| v.is_empty())
1076 .unwrap_or(true)
1077 });
1078 ConditionResult::from(any_without)
1079 }
1080
1081 /// [60] MP-ID nur aus Sparte Gas
1082 /// EXTERNAL: Requires context from outside the message.
1083 fn evaluate_60(&self, ctx: &EvaluationContext) -> ConditionResult {
1084 ctx.external.evaluate("market_location_is_gas")
1085 }
1086
1087 /// [61] MP-ID nur aus Sparte Strom
1088 /// EXTERNAL: Requires context from outside the message.
1089 fn evaluate_61(&self, ctx: &EvaluationContext) -> ConditionResult {
1090 ctx.external.evaluate("market_location_is_electricity")
1091 }
1092
1093 /// [62] MP-ID mit Rolle MSB
1094 /// EXTERNAL: Requires context from outside the message.
1095 fn evaluate_62(&self, ctx: &EvaluationContext) -> ConditionResult {
1096 ctx.external.evaluate("sender_is_msb")
1097 }
1098
1099 /// [63] MP-ID mit Rolle NB
1100 /// EXTERNAL: Requires context from outside the message.
1101 fn evaluate_63(&self, ctx: &EvaluationContext) -> ConditionResult {
1102 ctx.external.evaluate("sender_is_nb")
1103 }
1104
1105 /// [64] Wenn SG2 NAD+Z03 nicht vorhanden
1106 fn evaluate_64(&self, ctx: &EvaluationContext) -> ConditionResult {
1107 ctx.lacks_qualifier("NAD", 0, "Z03")
1108 }
1109
1110 /// [65] Wenn FTX+Z08 vorhanden
1111 fn evaluate_65(&self, ctx: &EvaluationContext) -> ConditionResult {
1112 ctx.has_qualifier("FTX", 0, "Z08")
1113 }
1114
1115 /// [67] Wenn DTM+163 nicht vorhanden
1116 fn evaluate_67(&self, ctx: &EvaluationContext) -> ConditionResult {
1117 ctx.lacks_qualifier("DTM", 0, "163")
1118 }
1119
1120 /// [68] Wenn DTM+7 nicht vorhanden
1121 fn evaluate_68(&self, ctx: &EvaluationContext) -> ConditionResult {
1122 ctx.lacks_qualifier("DTM", 0, "7")
1123 }
1124
1125 /// [69] Wenn NAD+Z23 nicht vorhanden
1126 fn evaluate_69(&self, ctx: &EvaluationContext) -> ConditionResult {
1127 ctx.lacks_qualifier("NAD", 0, "Z23")
1128 }
1129
1130 /// [70] Wenn NAD+Z03 nicht vorhanden
1131 fn evaluate_70(&self, ctx: &EvaluationContext) -> ConditionResult {
1132 ctx.lacks_qualifier("NAD", 0, "Z03")
1133 }
1134
1135 /// [76] Wenn in derselben SG29 mit Z54 in LIN DE1229 (Erforderliches Produkt der Marktlokation) das PIA+5 DE7140 mit einem Messprodukt aus Codeliste der Konfigurationen Kapitel 2.1.1 "Standard-Messprodukt ...
1136 /// EXTERNAL: Requires context from outside the message.
1137 fn evaluate_76(&self, ctx: &EvaluationContext) -> ConditionResult {
1138 ctx.external
1139 .evaluate("pia_product_in_standard_messprodukt_wahlmoeglichkeit_list")
1140 }
1141
1142 /// [77] Wenn im selben CCI im DE7059 der Code Z39 (Code der Zählzeitdefinition) vorhanden ist
1143 // REVIEW: Checks if a CCI segment in the same SG29 group has DE7059 == 'Z39' (Code der Zählzeitdefinition). DE7059 is the class/type code at elements[0][0] in CCI. Group-scoped to SG29 with message-wide fallback. (medium confidence)
1144 fn evaluate_77(&self, ctx: &EvaluationContext) -> ConditionResult {
1145 ctx.any_group_has_qualifier("CCI", 0, "Z39", &["SG29"])
1146 }
1147
1148 /// [79] Wenn eine andere SG29 mit Z54 in LIN DE1229 (Erforderliches Produkt der Marktlokation) mit PIA+5+9991000000078:Z11 (für Wirkarbeit Lastgang 1/4 stündlich) vorhanden ist
1149 // REVIEW: Checks if any SG29 instance contains both LIN with Z54 at elements[1][0] and PIA with product code 9991000000078 at elements[1][0]. The 'another SG29' nuance is approximated as 'any SG29' since we have no current-group context. (medium confidence)
1150 fn evaluate_79(&self, ctx: &EvaluationContext) -> ConditionResult {
1151 ctx.any_group_has_co_occurrence(
1152 "LIN",
1153 1,
1154 &["Z54"],
1155 "PIA",
1156 1,
1157 0,
1158 &["9991000000078"],
1159 &["SG29"],
1160 )
1161 }
1162
1163 /// [80] Wenn keine andere SG29 mit Z54 in LIN DE1229 (Erforderliches Produkt der Marktlokation) mit PIA+5+9991000000078:Z11 (Wirkarbeit Lastgang 1/4 stündlich) vorhanden ist
1164 // REVIEW: Negation of condition 79 — no SG29 with LIN+Z54 AND PIA product 9991000000078. (medium confidence)
1165 fn evaluate_80(&self, ctx: &EvaluationContext) -> ConditionResult {
1166 match ctx.any_group_has_co_occurrence(
1167 "LIN",
1168 1,
1169 &["Z54"],
1170 "PIA",
1171 1,
1172 0,
1173 &["9991000000078"],
1174 &["SG29"],
1175 ) {
1176 ConditionResult::True => ConditionResult::False,
1177 ConditionResult::False => ConditionResult::True,
1178 ConditionResult::Unknown => ConditionResult::Unknown,
1179 }
1180 }
1181
1182 /// [81] Wenn in derselben SG29 mit Z54 in LIN DE1229 (Erforderliches Produkt der Marktlokation), das PIA+5+9991000000078:Z11 (Wirkarbeit Lastgang 1/4 stündlich) vorhanden ist
1183 // REVIEW: Group-scoped co-occurrence in the same SG29: LIN with Z54 at elements[1][0] AND PIA with product code 9991000000078 at elements[1][0]. Functionally equivalent to condition 79 since the API checks within the same group instance. (medium confidence)
1184 fn evaluate_81(&self, ctx: &EvaluationContext) -> ConditionResult {
1185 ctx.any_group_has_co_occurrence(
1186 "LIN",
1187 1,
1188 &["Z54"],
1189 "PIA",
1190 1,
1191 0,
1192 &["9991000000078"],
1193 &["SG29"],
1194 )
1195 }
1196
1197 /// [84] IMD++Z14+Z07 vorhanden
1198 // REVIEW: Checks for IMD segment where elements[1][0]='Z14' (item characteristic) and elements[2][0]='Z07' (item description code). IMD++Z14+Z07 maps directly to these positions. (medium confidence)
1199 fn evaluate_84(&self, ctx: &EvaluationContext) -> ConditionResult {
1200 {
1201 let segments = ctx.find_segments("IMD");
1202 ConditionResult::from(segments.iter().any(|s| {
1203 s.elements
1204 .get(1)
1205 .and_then(|e| e.first())
1206 .is_some_and(|v| v == "Z14")
1207 && s.elements
1208 .get(2)
1209 .and_then(|e| e.first())
1210 .is_some_and(|v| v == "Z07")
1211 }))
1212 }
1213 }
1214
1215 /// [85] Wenn in derselben SG29 mit Z54 in LIN DE1229 (Erforderliches Produkt der Marktlokation), das PIA+5+9991000000086:Z11 (Wirkarbeit höchste 1/4 Stunde im Monat) vorhanden ist
1216 // REVIEW: Group-scoped co-occurrence in SG29: LIN with Z54 at elements[1][0] AND PIA with product code 9991000000086 (Wirkarbeit höchste 1/4 Stunde im Monat) at elements[1][0]. (medium confidence)
1217 fn evaluate_85(&self, ctx: &EvaluationContext) -> ConditionResult {
1218 ctx.any_group_has_co_occurrence(
1219 "LIN",
1220 1,
1221 &["Z54"],
1222 "PIA",
1223 1,
1224 0,
1225 &["9991000000086"],
1226 &["SG29"],
1227 )
1228 }
1229
1230 /// [87] Wenn FTX+Z09/Z10 vorhanden
1231 fn evaluate_87(&self, ctx: &EvaluationContext) -> ConditionResult {
1232 {
1233 let segs = ctx.find_segments("FTX");
1234 ConditionResult::from(segs.iter().any(|s| {
1235 s.elements
1236 .first()
1237 .and_then(|e| e.first())
1238 .is_some_and(|v| v == "Z09" || v == "Z10")
1239 }))
1240 }
1241 }
1242
1243 /// [93] Wenn in derselben Nachricht eine SG29 mit Z16 in LIN DE1229 (Erforderliches Produkt der Tranche) nicht vorhanden
1244 fn evaluate_93(&self, ctx: &EvaluationContext) -> ConditionResult {
1245 ctx.lacks_qualifier("LIN", 1, "Z16")
1246 }
1247
1248 /// [94] Wenn in derselben Nachricht eine SG29 mit Z54 in LIN DE1229 (Erforderliches Produkt der Marktlokation) nicht vorhanden
1249 fn evaluate_94(&self, ctx: &EvaluationContext) -> ConditionResult {
1250 ctx.lacks_qualifier("LIN", 1, "Z54")
1251 }
1252
1253 /// [95] Messprodukt-Code aus dem Kapitel 2.1 "Standard-Messprodukte der Marktlokation" der Codeliste der Konfigurationen
1254 /// EXTERNAL: Requires context from outside the message.
1255 fn evaluate_95(&self, ctx: &EvaluationContext) -> ConditionResult {
1256 ctx.external.evaluate("messprodukt_standard_marktlokation")
1257 }
1258
1259 /// [96] Messprodukt-Code aus dem Kapitel 2.2 "Standard-Messprodukte der Tranche" der Codeliste der Konfigurationen
1260 /// EXTERNAL: Requires context from outside the message.
1261 fn evaluate_96(&self, ctx: &EvaluationContext) -> ConditionResult {
1262 ctx.external.evaluate("messprodukt_standard_tranche")
1263 }
1264
1265 /// [97] Wenn FTX+Z10 vorhanden
1266 fn evaluate_97(&self, ctx: &EvaluationContext) -> ConditionResult {
1267 ctx.has_qualifier("FTX", 0, "Z10")
1268 }
1269
1270 /// [99] Wenn FTX+Z08/Z10 vorhanden
1271 fn evaluate_99(&self, ctx: &EvaluationContext) -> ConditionResult {
1272 ctx.any_group_has_any_qualifier("FTX", 0, &["Z08", "Z10"], &["SG29"])
1273 }
1274
1275 /// [100] Messprodukt-Code aus dem Kapitel 2.3 "Standard-Messprodukte der Messlokation" der Codeliste der Konfigurationen
1276 /// EXTERNAL: Requires context from outside the message.
1277 fn evaluate_100(&self, ctx: &EvaluationContext) -> ConditionResult {
1278 ctx.external.evaluate("messprodukt_standard_messlokation")
1279 }
1280
1281 /// [101] Wenn MP-ID in SG2 NAD+MR mit Rolle MSB in der Sparte Gas nicht vorhanden
1282 /// EXTERNAL: Requires context from outside the message.
1283 // REVIEW: Checking whether the NAD+MR recipient has role MSB in Sparte Gas requires external business context about market participant roles — not determinable from message content alone. (medium confidence)
1284 fn evaluate_101(&self, ctx: &EvaluationContext) -> ConditionResult {
1285 ctx.external.evaluate("recipient_is_msb_gas")
1286 }
1287
1288 /// [102] Wenn in derselben SG29 LIN das CCI+++Z25 (Geräteart Wandler) vorhanden
1289 fn evaluate_102(&self, ctx: &EvaluationContext) -> ConditionResult {
1290 // HAND-EDITED: "in dieser/derselben SG29" — scoped to the enclosing group.
1291 ctx.this_group_has_qualifier("CCI", 2, "Z25", &["SG29"])
1292 }
1293
1294 /// [103] Wenn in derselben SG29 LIN das CCI+++Z25 (Geräteart Wandler) nicht vorhanden
1295 fn evaluate_103(&self, ctx: &EvaluationContext) -> ConditionResult {
1296 // HAND-EDITED: "in dieser/derselben SG29" — scoped to the enclosing group.
1297 match ctx.this_group_has_qualifier("CCI", 2, "Z25", &["SG29"]) {
1298 ConditionResult::True => ConditionResult::False,
1299 ConditionResult::False => ConditionResult::True,
1300 ConditionResult::Unknown => ConditionResult::Unknown,
1301 }
1302 }
1303
1304 /// [104] Wenn MP-ID in SG2 NAD+VY mit Rolle LF vorhanden
1305 /// EXTERNAL: Requires context from outside the message.
1306 // REVIEW: Checking whether the NAD+VY party has role LF requires external market participant role context — cannot be determined from the EDIFACT message alone. (medium confidence)
1307 fn evaluate_104(&self, ctx: &EvaluationContext) -> ConditionResult {
1308 ctx.external.evaluate("nad_vy_is_lf")
1309 }
1310
1311 /// [105] Wenn die bisherige Konfiguration mit Zählzeiten des LF vom LF beendet werden soll
1312 /// EXTERNAL: Requires context from outside the message.
1313 fn evaluate_105(&self, ctx: &EvaluationContext) -> ConditionResult {
1314 ctx.external
1315 .evaluate("bisherige_konfiguration_zaehltzeiten_lf_beenden")
1316 }
1317
1318 /// [106] wenn IMD++Z60 (Abbestellung Messprodukt mit Zählzeitdefinition des LF) nicht vorhanden
1319 fn evaluate_106(&self, ctx: &EvaluationContext) -> ConditionResult {
1320 ctx.lacks_qualifier("IMD", 1, "Z60")
1321 }
1322
1323 /// [107] Wenn IMD++Z57 (Abbestellung Zählzeitdefinition) nicht vorhanden
1324 fn evaluate_107(&self, ctx: &EvaluationContext) -> ConditionResult {
1325 ctx.lacks_qualifier("IMD", 1, "Z57")
1326 }
1327
1328 /// [108] Wenn RFF+AGK (Konfigurations-ID) nicht vorhanden
1329 fn evaluate_108(&self, ctx: &EvaluationContext) -> ConditionResult {
1330 ctx.lacks_qualifier("RFF", 0, "AGK")
1331 }
1332
1333 /// [109] Wenn LOC+172 (Meldepunkt) nicht vorhanden
1334 fn evaluate_109(&self, ctx: &EvaluationContext) -> ConditionResult {
1335 ctx.lacks_qualifier("LOC", 0, "172")
1336 }
1337
1338 /// [110] wenn DTM+163 (Beginn Zeitraum für Wertanfrage) vorhanden
1339 fn evaluate_110(&self, ctx: &EvaluationContext) -> ConditionResult {
1340 ctx.has_qualifier("DTM", 0, "163")
1341 }
1342
1343 /// [112] Wenn in derselben SG29 LIN++Z54 (Erforderliches Produkt der Marktlokation), das PIA+5+9991000000078: Z11 (Wirkarbeit Lastgang 1/4 stündlich) vorhanden ist
1344 // REVIEW: In same SG29: LIN with elements[1][0]=Z54 (Erforderliches Produkt der Marktlokation) co-occurs with PIA where elements[1][0]=9991000000078 (Wirkarbeit Lastgang 1/4h, product code from C212.DE7140). Co-occurrence check scoped to SG29. (medium confidence)
1345 fn evaluate_112(&self, ctx: &EvaluationContext) -> ConditionResult {
1346 ctx.any_group_has_co_occurrence(
1347 "LIN",
1348 1,
1349 &["Z54"],
1350 "PIA",
1351 1,
1352 0,
1353 &["9991000000078"],
1354 &["SG29"],
1355 )
1356 }
1357
1358 /// [113] Wenn LIN DE1229 mit Code Z42 (Zählzeitdefinition) vorhanden
1359 fn evaluate_113(&self, ctx: &EvaluationContext) -> ConditionResult {
1360 ctx.has_qualifier("LIN", 1, "Z42")
1361 }
1362
1363 /// [114] Wenn LIN DE1229 mit Code Z69 (Schaltzeitdefinition) vorhanden
1364 fn evaluate_114(&self, ctx: &EvaluationContext) -> ConditionResult {
1365 ctx.has_qualifier("LIN", 1, "Z69")
1366 }
1367
1368 /// [115] Wenn LIN DE1229 mit Code Z70 (Leistungskurvendefinition) vorhanden
1369 fn evaluate_115(&self, ctx: &EvaluationContext) -> ConditionResult {
1370 ctx.has_qualifier("LIN", 1, "Z70")
1371 }
1372
1373 /// [117] Wenn SG29 LIN++Z64 (Erforderliches Produkt Schaltzeitdefinitionen) vorhanden
1374 fn evaluate_117(&self, ctx: &EvaluationContext) -> ConditionResult {
1375 ctx.has_qualifier("LIN", 1, "Z64")
1376 }
1377
1378 /// [118] Wenn SG29 LIN++Z65 (Erforderliches Produkt Leistungskurvendefinitionen) vorhanden
1379 fn evaluate_118(&self, ctx: &EvaluationContext) -> ConditionResult {
1380 ctx.has_qualifier("LIN", 1, "Z65")
1381 }
1382
1383 /// [119] Wenn SG29 LIN++Z66 (Erforderliches Produkt Ad-hoc-Steuerkanal) vorhanden
1384 fn evaluate_119(&self, ctx: &EvaluationContext) -> ConditionResult {
1385 ctx.has_qualifier("LIN", 1, "Z66")
1386 }
1387
1388 /// [120] Wenn SG29 LIN++Z67 (Erforderliches Messprodukt für Werte nach Typ 2 aus Backend) vorhanden
1389 fn evaluate_120(&self, ctx: &EvaluationContext) -> ConditionResult {
1390 ctx.has_qualifier("LIN", 1, "Z67")
1391 }
1392
1393 /// [121] Wenn SG29 LIN++Z68 (Erforderliches Produkt Konfigurationserlaubnis für Werte nach Typ 2 aus SMGW) vorhanden
1394 fn evaluate_121(&self, ctx: &EvaluationContext) -> ConditionResult {
1395 ctx.has_qualifier("LIN", 1, "Z68")
1396 }
1397
1398 /// [122] Wenn SG1 RFF+Z41 (Referenznummer des Vorgangs der Anmeldung nach WiM) nicht vorhanden
1399 fn evaluate_122(&self, ctx: &EvaluationContext) -> ConditionResult {
1400 ctx.lacks_qualifier("RFF", 0, "Z41")
1401 }
1402
1403 /// [123] Wenn DTM+203 (Ausführungsdatum) nicht vorhanden
1404 fn evaluate_123(&self, ctx: &EvaluationContext) -> ConditionResult {
1405 ctx.lacks_qualifier("DTM", 0, "203")
1406 }
1407
1408 /// [124] Wenn SG1 RFF+Z41 (Referenznummer des Vorgangs der Anmeldung nach WiM) vorhanden
1409 fn evaluate_124(&self, ctx: &EvaluationContext) -> ConditionResult {
1410 ctx.has_qualifier("RFF", 0, "Z41")
1411 }
1412
1413 /// [125] Es sind nur die Konfigurations-Produkte erlaubt, die in der Codeliste der Konfigurationen im Kapitel 4.1 „Konfigurationsprodukte Schaltzeitdefinition“ enthalten sind.
1414 /// EXTERNAL: Requires context from outside the message.
1415 fn evaluate_125(&self, ctx: &EvaluationContext) -> ConditionResult {
1416 ctx.external
1417 .evaluate("konfigurationsprodukt_schaltzeitdefinition")
1418 }
1419
1420 /// [130] Wenn in LOC+172 DE3225 (Meldepunkt) die ID einer Marktlokation angegeben ist
1421 fn evaluate_130(&self, ctx: &EvaluationContext) -> ConditionResult {
1422 // Wenn in LOC+172 DE3225 (Meldepunkt) die ID einer Marktlokation angegeben ist
1423 // LOC Meldepunkt: elements[0][0]=="172", elements[1][0]==DE3225 (Identifikator)
1424 let locs = ctx.find_segments_with_qualifier("LOC", 0, "172");
1425 match locs
1426 .first()
1427 .and_then(|s| s.elements.get(1))
1428 .and_then(|e| e.first())
1429 {
1430 Some(val) if !val.is_empty() => validate_malo_id(val),
1431 Some(_) => ConditionResult::False,
1432 None => ConditionResult::False, // segment absent → condition not applicable
1433 }
1434 }
1435
1436 /// [131] Wenn in LOC+172 DE3225 (Meldepunkt) die ID einer Messlokation angegeben ist
1437 /// EXTERNAL: Requires context from outside the message.
1438 fn evaluate_131(&self, ctx: &EvaluationContext) -> ConditionResult {
1439 ctx.external.evaluate("meldepunkt_is_messlokation_id")
1440 }
1441
1442 /// [132] Wenn in LOC+172 DE3225 (Meldepunkt) die ID einer Netzlokation angegeben ist
1443 /// EXTERNAL: Requires context from outside the message.
1444 fn evaluate_132(&self, ctx: &EvaluationContext) -> ConditionResult {
1445 ctx.external.evaluate("meldepunkt_is_netzlokation_id")
1446 }
1447
1448 /// [133] Wenn in LOC+172 DE3225 (Meldepunkt) die ID einer Steuerbaren Ressource angegeben ist
1449 /// EXTERNAL: Requires context from outside the message.
1450 fn evaluate_133(&self, ctx: &EvaluationContext) -> ConditionResult {
1451 ctx.external
1452 .evaluate("meldepunkt_is_steuerbare_ressource_id")
1453 }
1454
1455 /// [134] Wenn die Position in der ursprünglichen Antwort auf die Bestellung aus SG1 RFF+Z42 vorhanden war und reklamiert werden soll
1456 // REVIEW: RFF+Z42 in SG1 (elements[0][0]=="Z42") references the original order response position. Presence of this segment in the current message indicates the reclaim scenario. The 'reklamiert werden soll' clause is implied by the reference existing. (medium confidence)
1457 fn evaluate_134(&self, ctx: &EvaluationContext) -> ConditionResult {
1458 ctx.has_qualifier("RFF", 0, "Z42")
1459 }
1460
1461 /// [135] Wenn SG29 LIN++Z64 (Erforderliches Produkt Schaltzeitdefinitionen) nicht vorhanden
1462 fn evaluate_135(&self, ctx: &EvaluationContext) -> ConditionResult {
1463 ctx.lacks_qualifier("LIN", 1, "Z64")
1464 }
1465
1466 /// [136] Wenn SG29 LIN++Z65 (Erforderliches Produkt Leistungskurvendefinitionen) nicht vorhanden
1467 fn evaluate_136(&self, ctx: &EvaluationContext) -> ConditionResult {
1468 ctx.lacks_qualifier("LIN", 1, "Z65")
1469 }
1470
1471 /// [137] Wenn SG29 LIN++Z66 (Erforderliches Produkt Ad-hoc-Steuerkanal) nicht vorhanden
1472 fn evaluate_137(&self, ctx: &EvaluationContext) -> ConditionResult {
1473 ctx.lacks_qualifier("LIN", 1, "Z66")
1474 }
1475
1476 /// [138] Wenn SG29 LIN++Z67 (Erforderliches Messprodukt für Werte nach Typ 2 aus Backend) nicht vorhanden
1477 fn evaluate_138(&self, ctx: &EvaluationContext) -> ConditionResult {
1478 ctx.lacks_qualifier("LIN", 1, "Z67")
1479 }
1480
1481 /// [139] Wenn SG29 LIN++Z68 (Erforderliches Produkt Konfigurationserlaubnis für Werte nach Typ 2 aus SMGW) nicht vorhanden
1482 fn evaluate_139(&self, ctx: &EvaluationContext) -> ConditionResult {
1483 ctx.lacks_qualifier("LIN", 1, "Z68")
1484 }
1485
1486 /// [140] Messprodukt-Code aus dem Kapitel 2.4 "Standard-Messprodukte der Netzlokation" der Codeliste der Konfigurationen
1487 /// EXTERNAL: Requires context from outside the message.
1488 fn evaluate_140(&self, ctx: &EvaluationContext) -> ConditionResult {
1489 ctx.external
1490 .evaluate("is_standard_messprodukt_netzlokation_code")
1491 }
1492
1493 /// [147] wenn im DE3155 in demselben COM der Code EM vorhanden ist
1494 fn evaluate_147(&self, ctx: &EvaluationContext) -> ConditionResult {
1495 let com_segments = ctx.find_segments("COM");
1496 ConditionResult::from(com_segments.iter().any(|s| {
1497 s.elements
1498 .first()
1499 .and_then(|e| e.get(1))
1500 .is_some_and(|v| v == "EM")
1501 }))
1502 }
1503
1504 /// [148] wenn im DE3155 in demselben COM der Code TE / FX / AJ / AL vorhanden ist
1505 fn evaluate_148(&self, ctx: &EvaluationContext) -> ConditionResult {
1506 let com_segments = ctx.find_segments("COM");
1507 ConditionResult::from(com_segments.iter().any(|s| {
1508 s.elements
1509 .first()
1510 .and_then(|e| e.get(1))
1511 .is_some_and(|v| matches!(v.as_str(), "TE" | "FX" | "AJ" | "AL"))
1512 }))
1513 }
1514
1515 /// [161] Wenn in derselben SG29 LIN (Erforderliches Produkt Abrechnungsdaten) das SG30 CAV+ZH9 (Code der Produkteigenschaft) nicht vorhanden ist.
1516 fn evaluate_161(&self, ctx: &EvaluationContext) -> ConditionResult {
1517 ctx.any_group_has_qualifier_without("PIA", 0, "5", "CAV", 0, "ZH9", &["SG4", "SG29"])
1518 }
1519
1520 /// [163] Wenn innerhalb der Nachricht eine SG30 CCI+++ZA9 (Messprodukt für Übertragungsnetzbetreiber relevant) vorhanden ist.
1521 fn evaluate_163(&self, ctx: &EvaluationContext) -> ConditionResult {
1522 ctx.has_qualifier("CCI", 2, "ZA9")
1523 }
1524
1525 /// [167] Wenn SG2 NAD+DP (Meldepunkt), SG3 RFF+Z20 (Referenz auf ID der Tranche) vorhanden
1526 fn evaluate_167(&self, ctx: &EvaluationContext) -> ConditionResult {
1527 match (
1528 ctx.has_qualifier("NAD", 0, "DP"),
1529 ctx.has_qualifier("RFF", 0, "Z20"),
1530 ) {
1531 (ConditionResult::True, ConditionResult::True) => ConditionResult::True,
1532 (ConditionResult::False, _) | (_, ConditionResult::False) => ConditionResult::False,
1533 _ => ConditionResult::Unknown,
1534 }
1535 }
1536
1537 /// [168] Wenn SG2 NAD+DP (Meldepunkt), SG3 RFF+Z20 (Referenz auf ID der Tranche) nicht vorhanden
1538 fn evaluate_168(&self, ctx: &EvaluationContext) -> ConditionResult {
1539 match ctx.has_qualifier("NAD", 0, "DP") {
1540 ConditionResult::True => ctx.lacks_qualifier("RFF", 0, "Z20"),
1541 other => other,
1542 }
1543 }
1544
1545 /// [169] Wenn in SG29 LIN++Z19 (Erforderliches Produkt der Messlokation) in SG30 CCI (Zugeordnete Zählzeitdefinition im DE7059 der Code Z39 (Code der Zählzeitdefinition) vorhanden ist
1546 fn evaluate_169(&self, ctx: &EvaluationContext) -> ConditionResult {
1547 ctx.any_group_has_co_occurrence("LIN", 1, &["Z19"], "CCI", 0, 0, &["Z39"], &["SG29"])
1548 }
1549
1550 /// [170] Wenn in derselben SG29 LIN die SG30 CCI+Z37++ZD1 (Basis zur Bildung der Tranchengröße) (Prozentual) vorhanden
1551 fn evaluate_170(&self, ctx: &EvaluationContext) -> ConditionResult {
1552 // HAND-EDITED: "in dieser/derselben SG29" — scoped to the enclosing group.
1553 ctx.this_group_has_qualified_value("CCI", 0, "Z37", 2, 0, &["ZD1"], &["SG29"])
1554 }
1555
1556 /// [171] Wenn in derselben SG29 LIN (Erforderliches Produkt der Tranche) das IMD+++Z64 (Leistungsbeschreibung Konfiguration) (Neukonfiguration) vorhanden ist
1557 fn evaluate_171(&self, ctx: &EvaluationContext) -> ConditionResult {
1558 // HAND-EDITED: "in dieser/derselben SG29" — scoped to the enclosing group.
1559 ctx.this_group_has_qualifier("IMD", 2, "Z64", &["SG29"])
1560 }
1561
1562 /// [173] Wenn IMD++Z66 (Beendigung Konfiguration aufgrund Überführung der Marktlokation zu ruhender Marktlokation) vorhanden
1563 fn evaluate_173(&self, ctx: &EvaluationContext) -> ConditionResult {
1564 ctx.has_qualifier("IMD", 1, "Z66")
1565 }
1566
1567 /// [174] Wenn IMD++Z67 (Aktivierung Konfiguration in der derzeit ruhenden Marktlokation) vorhanden
1568 fn evaluate_174(&self, ctx: &EvaluationContext) -> ConditionResult {
1569 ctx.has_qualifier("IMD", 1, "Z67")
1570 }
1571
1572 /// [175] Wenn SG2 NAD+DP (Meldepunkt), SG3 RFF+Z59 (Referenz auf die ID der Marktlokation der Kundenanlage) vorhanden
1573 fn evaluate_175(&self, ctx: &EvaluationContext) -> ConditionResult {
1574 match (
1575 ctx.has_qualifier("NAD", 0, "DP"),
1576 ctx.has_qualifier("RFF", 0, "Z59"),
1577 ) {
1578 (ConditionResult::True, ConditionResult::True) => ConditionResult::True,
1579 (ConditionResult::False, _) | (_, ConditionResult::False) => ConditionResult::False,
1580 _ => ConditionResult::Unknown,
1581 }
1582 }
1583
1584 /// [176] Wenn SG2 NAD+DP (Meldepunkt), SG3 RFF+Z59 (Referenz auf die ID der Marktlokation der Kundenanlage) nicht vorhanden
1585 fn evaluate_176(&self, ctx: &EvaluationContext) -> ConditionResult {
1586 match ctx.has_qualifier("NAD", 0, "DP") {
1587 ConditionResult::True => ctx.lacks_qualifier("RFF", 0, "Z59"),
1588 other => other,
1589 }
1590 }
1591
1592 /// [177] Wenn IMD++Z66 (Beendigung Konfiguration aufgrund Überführung der Marktlokation zu ruhender Marktlokation) nicht vorhanden
1593 fn evaluate_177(&self, ctx: &EvaluationContext) -> ConditionResult {
1594 ctx.lacks_qualifier("IMD", 1, "Z66")
1595 }
1596
1597 /// [492] wenn MP-ID in NAD+MR aus Sparte Strom
1598 /// EXTERNAL: Requires context from outside the message.
1599 // REVIEW: Whether the MP-ID in NAD+MR belongs to the Strom (electricity) sector cannot be determined from the EDIFACT message alone — it requires a market participant registry lookup. (medium confidence)
1600 fn evaluate_492(&self, ctx: &EvaluationContext) -> ConditionResult {
1601 ctx.external.evaluate("recipient_is_strom")
1602 }
1603
1604 /// [493] wenn MP-ID in NAD+MR aus Sparte Gas
1605 /// EXTERNAL: Requires context from outside the message.
1606 // REVIEW: Whether the MP-ID in NAD+MR belongs to the Gas sector cannot be determined from the EDIFACT message alone — it requires a market participant registry lookup. (medium confidence)
1607 fn evaluate_493(&self, ctx: &EvaluationContext) -> ConditionResult {
1608 ctx.external.evaluate("recipient_is_gas")
1609 }
1610
1611 /// [494] Das hier genannte Datum muss der Zeitpunkt sein, zu dem das Dokument erstellt wurde, oder ein Zeitpunkt, der davor liegt.
1612 // REVIEW: States that the date in this DE must be the document creation time or earlier, i.e. <= DTM+137 Nachrichtendatum. Applied to DTM+203 (Ausführungsdatum) as the most logical target in ORDERS. Lexicographic string comparison is valid for CCYYMMDDHHMM (format 303) values since they are zero-padded fixed-width. (medium confidence)
1613 fn evaluate_494(&self, ctx: &EvaluationContext) -> ConditionResult {
1614 // The date here must be the document creation time (DTM+137 Nachrichtendatum) or earlier.
1615 // DTM+137: elements[0][0]=qualifier(137), elements[0][1]=DE2380 (actual value), elements[0][2]=format(303)
1616 // Applied to Ausführungsdatum (DTM+203) as the most likely subject in ORDERS.
1617 let dtm137_segs = ctx.find_segments_with_qualifier("DTM", 0, "137");
1618 let dtm203_segs = ctx.find_segments_with_qualifier("DTM", 0, "203");
1619 let ref_val = dtm137_segs
1620 .first()
1621 .and_then(|s| s.elements.first())
1622 .and_then(|e| e.get(1));
1623 let cmp_val = dtm203_segs
1624 .first()
1625 .and_then(|s| s.elements.first())
1626 .and_then(|e| e.get(1));
1627 match (cmp_val, ref_val) {
1628 (Some(cv), Some(rv)) => ConditionResult::from(cv.as_str() <= rv.as_str()),
1629 _ => ConditionResult::Unknown,
1630 }
1631 }
1632
1633 /// [495] Der Zeitpunkt muss ≤ dem Wert im DE2380 des DTM+137 sein
1634 // REVIEW: Explicitly requires the subject timestamp to be <= DE2380 of DTM+137 (Nachrichtendatum). Notation resolved: DTM+137 elements[0][1] is DE2380 per the MIG segment structure reference. Applied to DTM+203 (Ausführungsdatum) as the primary date field requiring this constraint in ORDERS. String comparison is valid for fixed-width CCYYMMDDHHMM format 303. (medium confidence)
1635 fn evaluate_495(&self, ctx: &EvaluationContext) -> ConditionResult {
1636 // The point in time must be <= DE2380 of DTM+137 (Nachrichtendatum).
1637 // DTM element layout per MIG: elements[0][0]=qualifier, elements[0][1]=DE2380 value, elements[0][2]=format code.
1638 // Applied to Ausführungsdatum (DTM+203) as the most relevant cross-date check in ORDERS.
1639 let dtm137_segs = ctx.find_segments_with_qualifier("DTM", 0, "137");
1640 let dtm203_segs = ctx.find_segments_with_qualifier("DTM", 0, "203");
1641 let ref_val = dtm137_segs
1642 .first()
1643 .and_then(|s| s.elements.first())
1644 .and_then(|e| e.get(1));
1645 let cmp_val = dtm203_segs
1646 .first()
1647 .and_then(|s| s.elements.first())
1648 .and_then(|e| e.get(1));
1649 match (cmp_val, ref_val) {
1650 (Some(cv), Some(rv)) => ConditionResult::from(cv.as_str() <= rv.as_str()),
1651 _ => ConditionResult::Unknown,
1652 }
1653 }
1654
1655 /// [500] Hinweis: Zählpunkt der BAS
1656 fn evaluate_500(&self, _ctx: &EvaluationContext) -> ConditionResult {
1657 ConditionResult::Unknown
1658 }
1659
1660 /// [501] Hinweis: Zählpunkt der DZR
1661 fn evaluate_501(&self, _ctx: &EvaluationContext) -> ConditionResult {
1662 ConditionResult::Unknown
1663 }
1664
1665 /// [503] Hinweis: Angabe eines technischen Ansprechpartners für die Geräteübernahme
1666 fn evaluate_503(&self, _ctx: &EvaluationContext) -> ConditionResult {
1667 ConditionResult::Unknown
1668 }
1669
1670 /// [506] Hinweis: Datum, bis zu dem der MSBA zur Fortführung verpflichtet wird
1671 fn evaluate_506(&self, _ctx: &EvaluationContext) -> ConditionResult {
1672 ConditionResult::Unknown
1673 }
1674
1675 /// [507] Hinweis: Es müssen alle nach Durchführung der Messlokationsänderung eingesetzten/genutzten OBIS- Kennzahlen übermittelt werden (wird eine "Erweiterung" des Messumfangs beauftragt, sind auch die...
1676 fn evaluate_507(&self, _ctx: &EvaluationContext) -> ConditionResult {
1677 ConditionResult::Unknown
1678 }
1679
1680 /// [514] Hinweis: Das Abonnement kann frühestens ab dem aktuellen Liefermonat beim Netzbetreiber gestartet werden.
1681 fn evaluate_514(&self, _ctx: &EvaluationContext) -> ConditionResult {
1682 ConditionResult::Unknown
1683 }
1684
1685 /// [515] Hinweis: Das angegebene Betrachtungszeitintervall bestimmt beim Start Abo bzw. Ende Abo ab bzw. bis wann (einschließlich) das Abo laufen soll.
1686 fn evaluate_515(&self, _ctx: &EvaluationContext) -> ConditionResult {
1687 ConditionResult::Unknown
1688 }
1689
1690 /// [517] Hinweis: Zählpunkt der LF-AASZR
1691 fn evaluate_517(&self, _ctx: &EvaluationContext) -> ConditionResult {
1692 ConditionResult::Unknown
1693 }
1694
1695 /// [518] Hinweis: Das angegebene Ausführungsdatum bestimmt beim Start Abo bzw. Ende Abo ab bzw. bis wann (einschließlich) das Abo laufen soll.
1696 fn evaluate_518(&self, _ctx: &EvaluationContext) -> ConditionResult {
1697 ConditionResult::Unknown
1698 }
1699
1700 /// [519] Hinweis: Bei Gas bezieht sich die Anforderung immer sowohl auf die vorläufigen Profilwerte als auch auf die endgültigen Profilwerte, falls diese bereits vorliegen.
1701 fn evaluate_519(&self, _ctx: &EvaluationContext) -> ConditionResult {
1702 ConditionResult::Unknown
1703 }
1704
1705 /// [521] Hinweis: Verwendung der ID der Marktlokation
1706 fn evaluate_521(&self, _ctx: &EvaluationContext) -> ConditionResult {
1707 // Hinweis: Verwendung der ID der Marktlokation — informational note, always applies
1708 ConditionResult::True
1709 }
1710
1711 /// [522] Hinweis: Verwendung der ID der Messlokation
1712 fn evaluate_522(&self, _ctx: &EvaluationContext) -> ConditionResult {
1713 // Hinweis: Verwendung der ID der Messlokation — informational note, always applies
1714 ConditionResult::True
1715 }
1716
1717 /// [523] Hinweis: Verwendung der ID der Tranche
1718 fn evaluate_523(&self, _ctx: &EvaluationContext) -> ConditionResult {
1719 // Hinweis: Verwendung der ID der Tranche — informational note, always applies
1720 ConditionResult::True
1721 }
1722
1723 /// [525] Hinweis: Wert aus BGM DE1004 der MSCONS
1724 fn evaluate_525(&self, _ctx: &EvaluationContext) -> ConditionResult {
1725 // Hinweis: Wert aus BGM DE1004 der MSCONS — informational note, always applies
1726 ConditionResult::True
1727 }
1728
1729 /// [527] Hinweis: Zählpunkt der BG-SZR (Kategorie B)
1730 fn evaluate_527(&self, _ctx: &EvaluationContext) -> ConditionResult {
1731 // Hinweis: Zählpunkt der BG-SZR (Kategorie B) — informational note, always applies
1732 ConditionResult::True
1733 }
1734
1735 /// [530] Hinweis: Wert aus BGM+310 DE1004 der QUOTES mit der das Angebot erfolgt ist.
1736 fn evaluate_530(&self, _ctx: &EvaluationContext) -> ConditionResult {
1737 // Hinweis: Wert aus BGM+310 DE1004 der QUOTES mit der das Angebot erfolgt ist — informational note, always applies
1738 ConditionResult::True
1739 }
1740
1741 /// [531] Hinweis: Wert aus LIN DE1082 der QUOTES, mit der das Angebot erfolgt ist
1742 fn evaluate_531(&self, _ctx: &EvaluationContext) -> ConditionResult {
1743 // Hinweis: Wert aus LIN DE1082 der QUOTES, mit der das Angebot erfolgt ist — informational note, always applies
1744 ConditionResult::True
1745 }
1746
1747 /// [532] Hinweis: Wert aus BGM+Z29 DE1004 der QUOTES, mit der das Angebot zur Abrechnung des Messstellenbetriebs erfolgt ist.
1748 fn evaluate_532(&self, _ctx: &EvaluationContext) -> ConditionResult {
1749 // Hinweis: Wert aus BGM+Z29 DE1004 der QUOTES, mit der das Angebot zur Abrechnung des Messstellenbetriebs erfolgt ist — informational note, always applies
1750 ConditionResult::True
1751 }
1752
1753 /// [533] Hinweis: Gerichtsvollzieher hat Termin vorgegeben
1754 fn evaluate_533(&self, _ctx: &EvaluationContext) -> ConditionResult {
1755 // Hinweis: Gerichtsvollzieher hat Termin vorgegeben — informational note, always applies
1756 ConditionResult::True
1757 }
1758
1759 /// [535] Hinweis: Verwendung der ID der Messlokation der Sparte Strom
1760 fn evaluate_535(&self, _ctx: &EvaluationContext) -> ConditionResult {
1761 // Hinweis: Verwendung der ID der Messlokation der Sparte Strom — informational note, always applies
1762 ConditionResult::True
1763 }
1764
1765 /// [536] Hinweis: Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z59
1766 fn evaluate_536(&self, _ctx: &EvaluationContext) -> ConditionResult {
1767 // Hinweis: Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z59 — informational note, always applies
1768 ConditionResult::True
1769 }
1770
1771 /// [539] Hinweis: Es sind nur Codes von Zählzeiten aus Liste des NB anzugeben
1772 fn evaluate_539(&self, _ctx: &EvaluationContext) -> ConditionResult {
1773 // Hinweis: Es sind nur Codes von Zählzeiten aus Liste des NB anzugeben — informational note, always applies
1774 ConditionResult::True
1775 }
1776
1777 /// [540] Hinweis: Es sind nur Codes von Zählzeiten aus Liste des LF anzugeben
1778 fn evaluate_540(&self, _ctx: &EvaluationContext) -> ConditionResult {
1779 // Hinweis: Es sind nur Codes von Zählzeiten aus Liste des LF anzugeben — informational note, always applies
1780 ConditionResult::True
1781 }
1782
1783 /// [542] Hinweis: Wert aus BGM+Z57 DE1004 der QUOTES mit der das Angebot erfolgt ist.
1784 fn evaluate_542(&self, _ctx: &EvaluationContext) -> ConditionResult {
1785 // Hinweis: Wert aus BGM+Z57 DE1004 der QUOTES mit der das Angebot erfolgt ist — informational note, always applies
1786 ConditionResult::True
1787 }
1788
1789 /// [543] Hinweis: Wert aus BGM+Z57 DE1004 der ORDERS mit der die Bestellung der Werte erfolgt ist.
1790 fn evaluate_543(&self, _ctx: &EvaluationContext) -> ConditionResult {
1791 // Hinweis: Wert aus BGM+Z57 DE1004 der ORDERS mit der die Bestellung der Werte erfolgt ist — informational note, always applies
1792 ConditionResult::True
1793 }
1794
1795 /// [545] Hinweis: Es werden nur die Messprodukte der Messlokationen angegeben, die für die in der SG2 genannte Marktlokation bzw. deren Tranchen erforderlich sind. Messprodukte an der Messlokation für wei...
1796 fn evaluate_545(&self, _ctx: &EvaluationContext) -> ConditionResult {
1797 // Hinweis: Es werden nur die Messprodukte der Messlokationen angegeben... — informational note, always applies
1798 ConditionResult::True
1799 }
1800
1801 /// [547] Hinweis: Dokumentennummer aus BGM+Z60 DE1004 der UTILTS
1802 fn evaluate_547(&self, _ctx: &EvaluationContext) -> ConditionResult {
1803 // Hinweis: Dokumentennummer aus BGM+Z60 DE1004 der UTILTS — informational note, always applies
1804 ConditionResult::True
1805 }
1806
1807 /// [548] Hinweis: Wenn die Änderung der Gerätekonfiguration mit einer Zählzeit übermittelt wird, ist hier die MP-ID des Eigentümers der Liste der Zählzeit einzutragen. Wenn anstatt der bisherigen Zäh...
1808 fn evaluate_548(&self, _ctx: &EvaluationContext) -> ConditionResult {
1809 // Hinweis: MP-ID des Eigentümers der Zählzeitliste — informational note, always applies
1810 ConditionResult::True
1811 }
1812
1813 /// [549] Hinweis: Findet bei der Reklamation von Zählerständen immer Anwendung. Einzige Ausnahme ist, wenn es sich um die Reklamation eines fehlenden Zählerstandes aufgrund einer Turnusablesung handelt, ...
1814 fn evaluate_549(&self, _ctx: &EvaluationContext) -> ConditionResult {
1815 // Hinweis: Reklamation von Zählerständen — Zeitpunktangabe vs. Zeitintervall — informational note, always applies
1816 ConditionResult::True
1817 }
1818
1819 /// [550] Hinweis: Findet nur dann Anwendung, wenn es sich um die Reklamation eines fehlenden Zählerstandes aufgrund einer Turnusablesung handelt, bei welcher der MSB am Objekt der Marktlokation die Informa...
1820 fn evaluate_550(&self, _ctx: &EvaluationContext) -> ConditionResult {
1821 // Hinweis: Reklamation fehlender Zählerstand bei Turnusablesung — informational note, always applies
1822 ConditionResult::True
1823 }
1824
1825 /// [551] Hinweis: Die SG29 ist so oft zu wiederholen, dass alle Messprodukte und Zählzeiten genannt werden, die ab dem in DTM+203 genannten Zeitpunkt auf der Messlokation durch den MSB konfiguriert werden ...
1826 fn evaluate_551(&self, _ctx: &EvaluationContext) -> ConditionResult {
1827 // Hinweis: SG29 Wiederholung für alle Messprodukte und Zählzeiten — informational note, always applies
1828 ConditionResult::True
1829 }
1830
1831 /// [552] Hinweis: Verwendung der ID der Netzlokation
1832 fn evaluate_552(&self, _ctx: &EvaluationContext) -> ConditionResult {
1833 // Hinweis: Verwendung der ID der Netzlokation — informational note, always applies
1834 ConditionResult::True
1835 }
1836
1837 /// [553] Hinweis: Verwendung der ID der Steuerbaren Ressource
1838 fn evaluate_553(&self, _ctx: &EvaluationContext) -> ConditionResult {
1839 // Hinweis: Verwendung der ID der Steuerbaren Ressource — informational note, always applies
1840 ConditionResult::True
1841 }
1842
1843 /// [554] Hinweis: Wert aus BGM+Z74 DE1004 der QUOTES mit der das Angebot erfolgt ist.
1844 fn evaluate_554(&self, _ctx: &EvaluationContext) -> ConditionResult {
1845 // Hinweis: Wert aus BGM+Z74 DE1004 der QUOTES — informational note about value origin, always applies
1846 ConditionResult::True
1847 }
1848
1849 /// [555] Hinweis: Vorgangsnummer aus SG4 IDE+24 DE7402 der UTILMD mit BGM+E01 mit der die Anmeldung des MSB-Wechsels erfolgt ist.
1850 fn evaluate_555(&self, _ctx: &EvaluationContext) -> ConditionResult {
1851 // Hinweis: Vorgangsnummer aus SG4 IDE+24 DE7402 der UTILMD — informational note about value origin, always applies
1852 ConditionResult::True
1853 }
1854
1855 /// [557] Hinweis: Es werden nur die Messprodukte der Messlokationen angegeben, die für die in der SG2 genannte Netzlokation erforderlich sind. Messprodukte an der Messlokation für weitere Netzlokationen o...
1856 fn evaluate_557(&self, _ctx: &EvaluationContext) -> ConditionResult {
1857 // Hinweis: Only Messprodukte for Messlokationen required for the named Netzlokation are specified — informational note, always applies
1858 ConditionResult::True
1859 }
1860
1861 /// [558] Hinweis: Dokumentennummer aus BGM+Z78 DE1004 der UTILTS
1862 fn evaluate_558(&self, _ctx: &EvaluationContext) -> ConditionResult {
1863 // Hinweis: Dokumentennummer aus BGM+Z78 DE1004 der UTILTS — informational note, always applies
1864 ConditionResult::True
1865 }
1866
1867 /// [559] Hinweis: Dokumentennummer aus BGM+Z79 DE1004 der UTILTS
1868 fn evaluate_559(&self, _ctx: &EvaluationContext) -> ConditionResult {
1869 // Hinweis: Dokumentennummer aus BGM+Z79 DE1004 der UTILTS — informational note, always applies
1870 ConditionResult::True
1871 }
1872
1873 /// [560] Hinweis: Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z80
1874 fn evaluate_560(&self, _ctx: &EvaluationContext) -> ConditionResult {
1875 // Hinweis: Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z80 — informational note, always applies
1876 ConditionResult::True
1877 }
1878
1879 /// [561] Hinweis: Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z81
1880 fn evaluate_561(&self, _ctx: &EvaluationContext) -> ConditionResult {
1881 // Hinweis: Vorgangsnummer aus IDE DE7402 der UTILTS mit BGM+Z81 — informational note, always applies
1882 ConditionResult::True
1883 }
1884
1885 /// [562] Hinweis: Wert aus BGM+Z73 DE1004 der IFTSTA mit der die Antwort auf die Bestellung der Konfiguration übermittelt wurde
1886 fn evaluate_562(&self, _ctx: &EvaluationContext) -> ConditionResult {
1887 // Hinweis: Wert aus BGM+Z73 DE1004 der IFTSTA — informational note, always applies
1888 ConditionResult::True
1889 }
1890
1891 /// [563] Hinweis: Vorgangsnummer aus CNI DE1490 der IFTSTA mit BGM+Z73 mit der die Antwort auf die Bestellung der Konfiguration übermittelt wurde
1892 fn evaluate_563(&self, _ctx: &EvaluationContext) -> ConditionResult {
1893 // Hinweis: Vorgangsnummer aus CNI DE1490 der IFTSTA mit BGM+Z73 mit der die Antwort auf die Bestellung der Konfiguration übermittelt wurde — informational note, always applies
1894 ConditionResult::True
1895 }
1896
1897 /// [564] Hinweis: Für den Empfang der Werte nach Typ 2 aus dem SMGW.
1898 fn evaluate_564(&self, _ctx: &EvaluationContext) -> ConditionResult {
1899 // Hinweis: Für den Empfang der Werte nach Typ 2 aus dem SMGW — informational note, always applies
1900 ConditionResult::True
1901 }
1902
1903 /// [566] Hinweis: Verwendung der ID der Technischen Ressource
1904 fn evaluate_566(&self, _ctx: &EvaluationContext) -> ConditionResult {
1905 // Hinweis: Verwendung der ID der Technischen Ressource — informational note, always applies
1906 ConditionResult::True
1907 }
1908
1909 /// [567] Hinweis: Es darf nur eine Information im DE3148 übermittelt werden
1910 fn evaluate_567(&self, _ctx: &EvaluationContext) -> ConditionResult {
1911 // Hinweis: Es darf nur eine Information im DE3148 übermittelt werden — informational note, always applies
1912 ConditionResult::True
1913 }
1914
1915 /// [568] Hinweis: Wenn die Einrichtung der Konfiguration mit einer Zählzeit übermittelt wird, ist hier die MP-ID des NB als Eigentümer der Liste der Zählzeit einzutragen.
1916 fn evaluate_568(&self, _ctx: &EvaluationContext) -> ConditionResult {
1917 // Hinweis: Wenn die Einrichtung der Konfiguration mit einer Zählzeit übermittelt wird, ist hier die MP-ID des NB als Eigentümer der Liste der Zählzeit einzutragen — informational note, always applies
1918 ConditionResult::True
1919 }
1920
1921 /// [569] Hinweis: MaBiS-Zählpunkt der LF-SZR
1922 fn evaluate_569(&self, _ctx: &EvaluationContext) -> ConditionResult {
1923 // Hinweis: MaBiS-Zählpunkt der LF-SZR — informational note, always applies
1924 ConditionResult::True
1925 }
1926
1927 /// [570] Hinweis: zur Angabe von Kontaktdaten des Kunden des Lieferanten um die Änderung an der Technik zu vereinfachen.
1928 fn evaluate_570(&self, _ctx: &EvaluationContext) -> ConditionResult {
1929 // Hinweis: zur Angabe von Kontaktdaten des Kunden des Lieferanten um die Änderung an der Technik zu vereinfachen — informational note, always applies
1930 ConditionResult::True
1931 }
1932
1933 /// [571] Hinweis: MSB der Marktlokation, an den die Werte der weiteren Energieflussrichtung der Messlokation zu übermitteln sind.
1934 fn evaluate_571(&self, _ctx: &EvaluationContext) -> ConditionResult {
1935 // Hinweis: MSB der Marktlokation, an den die Werte der weiteren Energieflussrichtung der Messlokation zu übermitteln sind — informational note, always applies
1936 ConditionResult::True
1937 }
1938
1939 /// [572] Hinweis: MSB der Marktlokation der Kundenanlage, in der die betroffene Lokation integriert wird.
1940 fn evaluate_572(&self, _ctx: &EvaluationContext) -> ConditionResult {
1941 // Hinweis: MSB der Marktlokation der Kundenanlage, in der die betroffene Lokation integriert wird — informational note, always applies
1942 ConditionResult::True
1943 }
1944
1945 /// [573] Hinweis: Es ist eine URI IPv4 für die Bereitstellung der Werte anzugeben.
1946 fn evaluate_573(&self, _ctx: &EvaluationContext) -> ConditionResult {
1947 // Hinweis: Es ist eine URI IPv4 für die Bereitstellung der Werte anzugeben — informational note, always applies
1948 ConditionResult::True
1949 }
1950
1951 /// [574] Hinweis: Es ist eine URI IPv6 für die Bereitstellung der Werte anzugeben.
1952 fn evaluate_574(&self, _ctx: &EvaluationContext) -> ConditionResult {
1953 // Hinweis: Es ist eine URI IPv6 für die Bereitstellung der Werte anzugeben.
1954 ConditionResult::True
1955 }
1956
1957 /// [575] Hinweis: Wenn der gewünschte Änderungszeitpunkt ein fixer Zeitpunkt ist.
1958 fn evaluate_575(&self, _ctx: &EvaluationContext) -> ConditionResult {
1959 // Hinweis: Wenn der gewünschte Änderungszeitpunkt ein fixer Zeitpunkt ist.
1960 ConditionResult::True
1961 }
1962
1963 /// [576] Hinweis: Wenn der gewünschte Änderungszeitpunkt ein nächst möglicher Termin zum oder nach dem angegebenen Zeitpunkt ist.
1964 fn evaluate_576(&self, _ctx: &EvaluationContext) -> ConditionResult {
1965 // Hinweis: Wenn der gewünschte Änderungszeitpunkt ein nächst möglicher Termin zum oder nach dem angegebenen Zeitpunkt ist.
1966 ConditionResult::True
1967 }
1968
1969 /// [903] Format: Möglicher Wert: 1
1970 fn evaluate_903(&self, _ctx: &EvaluationContext) -> ConditionResult {
1971 ConditionResult::True
1972 }
1973
1974 /// [906] Format: max. 3 Nachkommastellen
1975 fn evaluate_906(&self, ctx: &EvaluationContext) -> ConditionResult {
1976 ctx.format_check("QTY", 0, 1, |val| validate_max_decimal_places(val, 3))
1977 }
1978
1979 /// [911] Format: Mögliche Werte: 1 bis n, je Nachricht oder Segmentgruppe bei 1 beginnend und fortlaufend aufsteigend
1980 fn evaluate_911(&self, _ctx: &EvaluationContext) -> ConditionResult {
1981 // Hinweis: Mögliche Werte: 1 bis n, je Nachricht oder Segmentgruppe bei 1 beginnend und fortlaufend aufsteigend
1982 // This is a cardinality/sequencing annotation — informational, always applies
1983 ConditionResult::True
1984 }
1985
1986 /// [914] Format: Möglicher Wert: >0
1987 fn evaluate_914(&self, ctx: &EvaluationContext) -> ConditionResult {
1988 ctx.format_check("QTY", 0, 1, |val| validate_numeric(val, ">", 0.0))
1989 }
1990
1991 /// [922] Format: TR-ID
1992 // REVIEW: TR-ID (Transaktionsreferenz-ID) format. In ORDERS the transaction reference ID appears in BGM C106. The exact segment context depends on the AHB field definition — implemented as max-length-35 check on BGM, consistent with EDIFACT AN..35 data element constraints. Medium confidence because the target segment may differ by AHB row. (medium confidence)
1993 fn evaluate_922(&self, ctx: &EvaluationContext) -> ConditionResult {
1994 // Format: TR-ID — Transaktionsreferenz-ID, max 35 alphanumeric characters
1995 // In ORDERS, TR-ID typically appears in BGM element 1 (C106 document identifier)
1996 let segs = ctx.find_segments("BGM");
1997 match segs
1998 .first()
1999 .and_then(|s| s.elements.get(1))
2000 .and_then(|e| e.first())
2001 {
2002 Some(val) if !val.is_empty() => validate_max_length(val, 35),
2003 Some(_) => ConditionResult::False,
2004 None => ConditionResult::False, // segment absent → condition not applicable
2005 }
2006 }
2007
2008 /// [930] Format: max. 2 Nachkommastellen
2009 fn evaluate_930(&self, ctx: &EvaluationContext) -> ConditionResult {
2010 ctx.format_check("QTY", 0, 1, |val| validate_max_decimal_places(val, 2))
2011 }
2012
2013 /// [931] Format: ZZZ = +00
2014 fn evaluate_931(&self, ctx: &EvaluationContext) -> ConditionResult {
2015 ctx.format_check("DTM", 0, 1, validate_timezone_utc)
2016 }
2017
2018 /// [932] Format: HHMM = 2200
2019 // REVIEW: HHMM = 2200 time constraint on DTM. In ORDERS FV2504, delivery period end (qualifier 163) must terminate at 22:00 UTC, matching the standard German grid day-end convention. Medium confidence because the target DTM qualifier may differ for the specific AHB row — 163 is the most likely candidate for an end-of-period constraint. (medium confidence)
2020 fn evaluate_932(&self, ctx: &EvaluationContext) -> ConditionResult {
2021 ctx.format_check_qualified("DTM", 0, "163", 0, 1, |val| {
2022 validate_hhmm_equals(val, "2200")
2023 })
2024 }
2025
2026 /// [933] Format: HHMM = 2300
2027 fn evaluate_933(&self, ctx: &EvaluationContext) -> ConditionResult {
2028 ctx.format_check("DTM", 0, 1, |val| validate_hhmm_equals(val, "2300"))
2029 }
2030
2031 /// [934] Format: HHMM = 0400
2032 fn evaluate_934(&self, ctx: &EvaluationContext) -> ConditionResult {
2033 ctx.format_check("DTM", 0, 1, |val| validate_hhmm_equals(val, "0400"))
2034 }
2035
2036 /// [935] Format: HHMM = 0500
2037 fn evaluate_935(&self, ctx: &EvaluationContext) -> ConditionResult {
2038 ctx.format_check("DTM", 0, 1, |val| validate_hhmm_equals(val, "0500"))
2039 }
2040
2041 /// [939] Format: Die Zeichenkette muss die Zeichen @ und . enthalten
2042 fn evaluate_939(&self, ctx: &EvaluationContext) -> ConditionResult {
2043 ctx.format_check("COM", 0, 0, validate_email)
2044 }
2045
2046 /// [940] Format: Die Zeichenkette muss mit dem Zeichen + beginnen und danach dürfen nur noch Ziffern folgen
2047 fn evaluate_940(&self, ctx: &EvaluationContext) -> ConditionResult {
2048 ctx.format_check("COM", 0, 0, validate_phone)
2049 }
2050
2051 /// [950] Format: Marktlokations-ID
2052 fn evaluate_950(&self, ctx: &EvaluationContext) -> ConditionResult {
2053 ctx.format_check_qualified("LOC", 0, "Z16", 1, 0, validate_malo_id)
2054 }
2055
2056 /// [951] Format: Zählpunktbezeichnung
2057 fn evaluate_951(&self, ctx: &EvaluationContext) -> ConditionResult {
2058 ctx.format_check_qualified("LOC", 0, "Z17", 1, 0, validate_zahlpunkt)
2059 }
2060
2061 /// [955] Format: Möglicher Wert: <100
2062 // REVIEW: Format: Möglicher Wert: <100 — numeric value must be less than 100. Most likely applies to a QTY quantity value (C186.D6060, elements[0][1]). validate_numeric with "<" and threshold 100.0 covers this. Medium confidence because the exact segment context (QTY vs PRI vs PCT) is not specified — QTY is the most common numeric value carrier in ORDERS. (medium confidence)
2063 fn evaluate_955(&self, ctx: &EvaluationContext) -> ConditionResult {
2064 ctx.format_check("QTY", 0, 1, |val| validate_numeric(val, "<", 100.0))
2065 }
2066
2067 /// [960] Format: Netzlokations-ID
2068 // HAND-EDITED: a Netzlokations-ID is "E" + ten alphanumerics (`E1688117482`),
2069 // not MaLo-shaped; `validate_malo_id` rejected every real one (#173).
2070 fn evaluate_960(&self, ctx: &EvaluationContext) -> ConditionResult {
2071 ctx.format_check_qualified("LOC", 0, "Z18", 1, 0, validate_nelo_id)
2072 }
2073
2074 /// [961] Format: SR-ID
2075 fn evaluate_961(&self, ctx: &EvaluationContext) -> ConditionResult {
2076 ctx.format_check_qualified("LOC", 0, "Z19", 1, 0, validate_malo_id)
2077 }
2078
2079 /// [962] Format: max. 6 Vorkommastellen
2080 // REVIEW: Format: max 6 integer digits (Vorkommastellen). Applied to QTY element[0][1] as the most common numeric data field in ORDERS requiring integer-part validation. Uses validate_max_integer_digits helper. Confidence medium because the target segment is inferred from context rather than explicitly stated. (medium confidence)
2081 fn evaluate_962(&self, ctx: &EvaluationContext) -> ConditionResult {
2082 ctx.format_check("QTY", 0, 1, |val| validate_max_integer_digits(val, 6))
2083 }
2084
2085 /// [2002] Ist mindestens zwei Mal anzugeben
2086 // REVIEW: Must be specified at least twice. Counts DTM+203 (Ausführungsdatum, qualifier at elements[0][0]) occurrences as a proxy for SG29 group instance count since each SG29 contains exactly one DTM+203. Condition is True when count >= 2. (medium confidence)
2087 fn evaluate_2002(&self, ctx: &EvaluationContext) -> ConditionResult {
2088 // "Ist mindestens zwei Mal anzugeben" — SG29 must appear at least twice.
2089 // DTM+203 (Ausführungsdatum) occurs exactly once per SG29 instance,
2090 // so counting DTM+203 segments gives the SG29 repetition count.
2091 let count = ctx.find_segments_with_qualifier("DTM", 0, "203").len();
2092 ConditionResult::from(count >= 2)
2093 }
2094
2095 /// [2004] Die SG29 ist so oft zu wiederholen, dass alle Geräte der betroffenen Geräteart die im Rahmen des Gerätewechsels aufgrund MSB-Wechsel getauscht werden sollen genannt sind.
2096 fn evaluate_2004(&self, _ctx: &EvaluationContext) -> ConditionResult {
2097 // Hinweis: Die SG29 ist so oft zu wiederholen, dass alle Geräte der betroffenen Geräteart
2098 // die im Rahmen des Gerätewechsels aufgrund MSB-Wechsel getauscht werden sollen, genannt sind.
2099 // Informational cardinality note — always applies.
2100 ConditionResult::True
2101 }
2102
2103 /// [2005] Pro SG29 LIN ist die SG34 RFF+Z09 (Gerätenummer) genau einmal anzugeben
2104 // REVIEW: Per SG29 LIN, RFF+Z09 (Gerätenummer) must appear exactly once. We check that there is exactly one RFF segment with qualifier Z09 in the message context. This is a cardinality constraint evaluated at message level via segment counting. (medium confidence)
2105 fn evaluate_2005(&self, ctx: &EvaluationContext) -> ConditionResult {
2106 {
2107 let rffs = ctx.find_segments_with_qualifier("RFF", 0, "Z09");
2108 ConditionResult::from(rffs.len() == 1)
2109 }
2110 }
2111
2112 /// [2006] Pro SG29 LIN ist die SG34 RFF+Z09 (Gerätenummer) bis zu dreimal anzugeben
2113 // REVIEW: Per SG29 LIN, RFF+Z09 (Gerätenummer) may appear up to three times. We verify that at most 3 RFF segments with qualifier Z09 exist in the message context. (medium confidence)
2114 fn evaluate_2006(&self, ctx: &EvaluationContext) -> ConditionResult {
2115 {
2116 let rffs = ctx.find_segments_with_qualifier("RFF", 0, "Z09");
2117 ConditionResult::from(rffs.len() <= 3)
2118 }
2119 }
2120
2121 /// [2007] Die SG29 ist so oft zu wiederholen, wie ab dem DTM+203 (Ausführungsdatum) Messlokationen zu der in der SG2 genannten Netzlokation vorhanden sind und für jede dieser Messlokationen müssen alle Me...
2122 fn evaluate_2007(&self, _ctx: &EvaluationContext) -> ConditionResult {
2123 // Hinweis: Die SG29 ist so oft zu wiederholen, wie ab dem DTM+203 (Ausführungsdatum)
2124 // Messlokationen zu der in der SG2 genannten Netzlokation vorhanden sind und für jede
2125 // dieser Messlokationen müssen alle Messprodukte genannt sein, die ab dem DTM+203
2126 // (Ausführungsdatum) in der SG2 genannten Netzlokation vorhanden sind.
2127 // Informational cardinality note — always applies.
2128 ConditionResult::True
2129 }
2130
2131 /// [2044] Pro SG29 LIN ist die SG29 PIA genau einmal anzugeben
2132 // REVIEW: Per SG29 LIN, the SG29 PIA segment must appear exactly once. We count PIA segments in the message and check for exactly one occurrence. This is a structural cardinality check on the PIA segment. (medium confidence)
2133 fn evaluate_2044(&self, ctx: &EvaluationContext) -> ConditionResult {
2134 {
2135 let pias = ctx.find_segments("PIA");
2136 ConditionResult::from(pias.len() == 1)
2137 }
2138 }
2139
2140 /// [2050] Pro Nachricht ist die SG29 genau einmal anzugeben
2141 // REVIEW: Per message, SG29 (identified by its entry segment LIN) must appear exactly once. We count all LIN segments in the message and check for exactly one occurrence. (medium confidence)
2142 fn evaluate_2050(&self, ctx: &EvaluationContext) -> ConditionResult {
2143 {
2144 let lins = ctx.find_segments("LIN");
2145 ConditionResult::from(lins.len() == 1)
2146 }
2147 }
2148
2149 /// [2060] Pro Nachricht ist die SG29 LIN+Z64 (Erforderliches Produkt Schaltzeitdefinitionen) maximal einmal anzugeben
2150 fn evaluate_2060(&self, ctx: &EvaluationContext) -> ConditionResult {
2151 {
2152 let lins = ctx.find_segments("LIN");
2153 let count = lins
2154 .iter()
2155 .filter(|s| {
2156 s.elements
2157 .get(1)
2158 .and_then(|e| e.first())
2159 .is_some_and(|v| v == "Z64")
2160 })
2161 .count();
2162 ConditionResult::from(count <= 1)
2163 }
2164 }
2165
2166 /// [2061] Pro Nachricht ist die SG29 LIN++Z65 (Erforderliches Produkt Leistungskurvendefinitionen) maximal einmal anzugeben
2167 fn evaluate_2061(&self, ctx: &EvaluationContext) -> ConditionResult {
2168 {
2169 let lins = ctx.find_segments("LIN");
2170 let count = lins
2171 .iter()
2172 .filter(|s| {
2173 s.elements
2174 .get(1)
2175 .and_then(|e| e.first())
2176 .is_some_and(|v| v == "Z65")
2177 })
2178 .count();
2179 ConditionResult::from(count <= 1)
2180 }
2181 }
2182
2183 /// [2062] Pro Nachricht ist die SG29 LIN++Z66 (Erforderliches Produkt Ad-hoc-Steuerkanal) maximal einmal anzugeben
2184 // REVIEW: Count LIN segments where elements[1][0]=="Z66" (LIN++Z66, ad-hoc Steuerkanal). Condition is True when at most one such SG29 line item is present per message. (medium confidence)
2185 fn evaluate_2062(&self, ctx: &EvaluationContext) -> ConditionResult {
2186 let count = ctx
2187 .find_segments("LIN")
2188 .iter()
2189 .filter(|s| {
2190 s.elements
2191 .get(1)
2192 .and_then(|e| e.first())
2193 .is_some_and(|v| v == "Z66")
2194 })
2195 .count();
2196 ConditionResult::from(count <= 1)
2197 }
2198
2199 /// [2063] Pro Nachricht ist die SG29 LIN++Z67 (Erforderliches Messprodukt für Werte nach Typ 2 aus Backend) maximal einmal anzugeben
2200 // REVIEW: Count LIN segments where elements[1][0]=="Z67" (LIN++Z67, Messprodukt Typ 2 Backend). Condition is True when at most one such SG29 line item is present per message. (medium confidence)
2201 fn evaluate_2063(&self, ctx: &EvaluationContext) -> ConditionResult {
2202 let count = ctx
2203 .find_segments("LIN")
2204 .iter()
2205 .filter(|s| {
2206 s.elements
2207 .get(1)
2208 .and_then(|e| e.first())
2209 .is_some_and(|v| v == "Z67")
2210 })
2211 .count();
2212 ConditionResult::from(count <= 1)
2213 }
2214
2215 /// [2064] Pro Nachricht ist die SG29 LIN++Z68 (Erforderliches Produkt Konfigurationserlaubnis für Werte nach Typ 2 aus SMGW) maximal einmal anzugeben
2216 // REVIEW: Count LIN segments where elements[1][0]=="Z68" (LIN++Z68, Konfigurationserlaubnis Typ 2 SMGW). Condition is True when at most one such SG29 line item is present per message. (medium confidence)
2217 fn evaluate_2064(&self, ctx: &EvaluationContext) -> ConditionResult {
2218 let count = ctx
2219 .find_segments("LIN")
2220 .iter()
2221 .filter(|s| {
2222 s.elements
2223 .get(1)
2224 .and_then(|e| e.first())
2225 .is_some_and(|v| v == "Z68")
2226 })
2227 .count();
2228 ConditionResult::from(count <= 1)
2229 }
2230
2231 /// [2066] Die SG3 RFF+Z37 Referenz auf ID der Technischen Ressource ist so oft zu wiederholen, bis alle IDs der Technischen Ressourcen angegeben sind, die der Steuerbaren Ressource in LOC+172 DE3225 (Meldepu...
2232 fn evaluate_2066(&self, _ctx: &EvaluationContext) -> ConditionResult {
2233 // Hinweis: Die SG3 RFF+Z37 ist so oft zu wiederholen, bis alle IDs der Technischen
2234 // Ressourcen angegeben sind, die der Steuerbaren Ressource in LOC+172 DE3225 (Meldepunkt)
2235 // mit diesem Vorgang zugeordnet werden sollen.
2236 // Informational cardinality note — always applies.
2237 ConditionResult::True
2238 }
2239
2240 /// [2088] Die SG29 ist so oft zu wiederholen, dass alle Messprodukte ab dem DTM+203 (Ausführungsdatum) zu der in der SG2 genannten Netzlokation genannt sind.
2241 fn evaluate_2088(&self, _ctx: &EvaluationContext) -> ConditionResult {
2242 // Hinweis: Die SG29 ist so oft zu wiederholen, dass alle Messprodukte ab dem DTM+203
2243 // (Ausführungsdatum) zu der in der SG2 genannten Netzlokation genannt sind.
2244 // Informational cardinality note — always applies.
2245 ConditionResult::True
2246 }
2247
2248 /// [2089] Die SG29 ist so oft zu wiederholen, dass alle Messprodukte ab dem DTM+203 (Ausführungsdatum) zu der in der SG2 genannten Marktlokation genannt sind.
2249 fn evaluate_2089(&self, _ctx: &EvaluationContext) -> ConditionResult {
2250 // Hinweis: Die SG29 ist so oft zu wiederholen, dass alle Messprodukte ab dem DTM+203
2251 // (Ausführungsdatum) zu der in der SG2 genannten Marktlokation genannt sind.
2252 // Informational cardinality note about SG29 repetition count — always applies.
2253 ConditionResult::True
2254 }
2255
2256 /// [2090] Für 33-stellige ID im SG2 LOC+172 (Meldepunkt) DE3225 mindestens einmal anzugeben
2257 fn evaluate_2090(&self, ctx: &EvaluationContext) -> ConditionResult {
2258 let locs = ctx.find_segments_with_qualifier("LOC", 0, "172");
2259 ConditionResult::from(locs.iter().any(|s| {
2260 s.elements
2261 .get(1)
2262 .and_then(|e| e.first())
2263 .is_some_and(|v| v.len() == 33)
2264 }))
2265 }
2266
2267 /// [2092] Pro Nachricht ist die SG29 maximal einmal anzugeben
2268 // REVIEW: SG29 is initiated by the LIN segment. Count all LIN segments in the message and verify there is at most one, making the condition True when the cardinality constraint is satisfied. (medium confidence)
2269 fn evaluate_2092(&self, ctx: &EvaluationContext) -> ConditionResult {
2270 ConditionResult::from(ctx.find_segments("LIN").len() <= 1)
2271 }
2272
2273 /// [2094] Pro Nachricht ist die SG29 LIN (Positionsdaten) so oft anzugeben, wie Positionen aus dem Angebot, welches in SG1 RFF+AAG (Referenz Nachrichtennummer), DE1154 angegeben ist, bestellt werden sollen.
2274 fn evaluate_2094(&self, _ctx: &EvaluationContext) -> ConditionResult {
2275 // Hinweis: Pro Nachricht ist die SG29 LIN (Positionsdaten) so oft anzugeben, wie
2276 // Positionen aus dem Angebot (referenziert in SG1 RFF+AAG DE1154) bestellt werden sollen.
2277 // Informational cardinality note — the required repetition count depends on an external
2278 // offer document that cannot be inspected from within this EDIFACT message.
2279 ConditionResult::True
2280 }
2281
2282 /// [2095] Diese SG29 ist so oft zu wiederholen, dass alle Produkte zur Lokation die ab dem DTM+203 (Ausführungsdatum) gewünscht sind und deren Kombination gemäß Codeliste der Konfigurationen Kapitel 7 "P...
2283 fn evaluate_2095(&self, _ctx: &EvaluationContext) -> ConditionResult {
2284 // Hinweis: Diese SG29 ist so oft zu wiederholen, dass alle Produkte zur Lokation
2285 // ab dem DTM+203 (Ausführungsdatum) genannt sind, deren Kombination gemäß
2286 // Codeliste der Konfigurationen Kapitel 7 möglich sind.
2287 // Informational cardinality note — valid combinations are defined by an external
2288 // code list (Kapitel 7) and cannot be validated from EDIFACT content alone.
2289 ConditionResult::True
2290 }
2291
2292 /// [2096] Die SG3 Referenz auf die ID der Tranche ist so oft zu wiederholen, wie ab dem DTM+203 (Ausführungsdatum) Tranchen zu der in der SG2 genannten Marktlokation vorhanden sind.
2293 fn evaluate_2096(&self, _ctx: &EvaluationContext) -> ConditionResult {
2294 // Hinweis: Die SG3 Referenz auf die ID der Tranche ist so oft zu wiederholen, wie
2295 // ab dem DTM+203 (Ausführungsdatum) Tranchen zu der in der SG2 genannten
2296 // Marktlokation vorhanden sind.
2297 // Informational cardinality note — the number of Tranchen for a Marktlokation is
2298 // business context that cannot be determined from the EDIFACT message alone.
2299 ConditionResult::True
2300 }
2301
2302 /// [2097] Die SG29 ist so oft zu wiederholen, dass für alle in SG3 Referenz auf ID der Tranche genannten Tranchen mindestens eine SG29 vorhanden ist.
2303 fn evaluate_2097(&self, _ctx: &EvaluationContext) -> ConditionResult {
2304 // Hinweis: Die SG29 ist so oft zu wiederholen, dass für alle in SG3 RFF+Z20
2305 // (Referenz auf ID der Tranche) genannten Tranchen mindestens eine SG29 vorhanden ist.
2306 // Informational completeness note — each Tranche referenced in SG3 must have
2307 // at least one corresponding SG29. Documents structural pairing requirements.
2308 ConditionResult::True
2309 }
2310
2311 /// [2098] Die SG2 Lieferant an der Lokation ist so oft zu wiederholen, dass für alle in SG3 Referenz auf ID der Tranche genannten Tranchen genau eine SG2 Lieferant der Lokation vorhanden ist.
2312 // REVIEW: Cardinality rule: SG2 repetition count must equal the number of SG3 tranche references. Implemented by comparing count_in_group for both groups within SG29. Medium confidence because exact group paths and SG3 RFF qualifier for 'Tranche ID' are not confirmed without the full MIG segment structure reference — the paths &["SG29", "SG2"] and &["SG29", "SG3"] are based on standard ORDERS tx_group conventions from project memory. (medium confidence)
2313 fn evaluate_2098(&self, ctx: &EvaluationContext) -> ConditionResult {
2314 // SG2 Lieferant an der Lokation must repeat once per SG3 tranche reference.
2315 // Count SG2 group instances (NAD as entry segment) and SG3 RFF tranche references.
2316 // Both counts must be equal and non-zero for the condition to be satisfied.
2317 let sg2_count = ctx.count_in_group("NAD", &["SG29", "SG2"]);
2318 let sg3_count = ctx.count_in_group("RFF", &["SG29", "SG3"]);
2319 if sg2_count == 0 || sg3_count == 0 {
2320 return ConditionResult::Unknown;
2321 }
2322 ConditionResult::from(sg2_count == sg3_count)
2323 }
2324
2325 /// [2099] Die SG2 Lieferant an der Lokation ist genau einmal anzugeben.
2326 // REVIEW: Simple cardinality check: SG2 must appear exactly once (genau einmal). Implemented using count_in_group on NAD (the entry segment of SG2) within SG29. Returns Unknown when no SG2 is found at all (not yet present), False when count > 1, True when exactly 1. Medium confidence due to unconfirmed group path without the full EDIFACT Segment Structure Reference for this PID. (medium confidence)
2327 fn evaluate_2099(&self, ctx: &EvaluationContext) -> ConditionResult {
2328 // SG2 Lieferant an der Lokation must appear exactly once.
2329 // Count NAD segments (entry segment of SG2) within the SG29 SG2 group path.
2330 let count = ctx.count_in_group("NAD", &["SG29", "SG2"]);
2331 if count == 0 {
2332 return ConditionResult::Unknown;
2333 }
2334 ConditionResult::from(count == 1)
2335 }
2336}