x12-types 0.4.0

Bindings for the ANSI X12 EDI definitions
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
//! v004010 repesents all entities of the 004010 specification.

use serde::{Deserialize, Serialize};
use serde_x12::Path;
use serde_x12::PathItem;
use serde_x12::PathOperation;
use serde_x12::Reflect;
use std::fmt::Debug;
mod segment;
pub use segment::*;

#[cfg(test)]
mod test;

#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq)]
pub struct Transmission<T> {
    pub isa: ISA,
    pub functional_group: Vec<FunctionalGroup<T>>,
    pub iea: IEA,
}

impl<T: Reflect> Reflect for Transmission<T> {
    fn get_path(current_path: &Path, next_segment: &str, last_path: &Path) -> Path {
        match next_segment {
            "ISA" => Path {
                elem: vec![PathItem {
                    name: "isa".to_string(),
                    ..Default::default()
                }],
                ..Default::default()
            },
            "IEA" => Path {
                elem: vec![PathItem {
                    name: "iea".to_string(),
                    ..Default::default()
                }],
                ..Default::default()
            },
            "GS" => current_path
                .push("functional_group".to_string(), Some(0), false)
                .push("gs".to_string(), None, true)
                .next_op(PathOperation::Push(PathItem {
                    name: "segments".to_string(),
                    vec_position: Some(0),
                    leaf: false,
                })),
            "GE" => current_path.pop().push("ge".to_string(), None, true),
            _ => T::get_path(current_path, next_segment, last_path),
        }
    }

    fn get_type_name() -> String {
        "Transmission".to_string()
    }
}

#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq)]
pub struct FunctionalGroup<T> {
    pub gs: GS,
    pub segments: Vec<T>,
    pub ge: GE,
}

/// 204 - Motor Carrier Load Tender
///
/// This Draft Standard for Trial Use contains the format and establishes the data contents of the Motor Carrier Load Tender Transaction Set (204) for use within the context of an Electronic Data Interchange (EDI) environment. This transaction set can be used to allow shippers or other interested parties to offer (tender) a shipment to a full load (truckload) motor carrier including detailed scheduling, equipment requirements, commodities, and shipping instructions pertinent to a load tender. It is not to be used to provide a motor carrier with data relative to a Less-than-Truckload bill of lading, pick-up notification, or manifest.
///
/// POS | ID | NAME | REQ | MAX | REPEAT
/// ----|----|------|-----|-----|-------
/// 0010 | ST | Transaction Set Header | M | 1
/// 0020 | B2 | Beginning Segment for Shipment Information Transaction | M | 1
/// 0030 | B2A | Set Purpose | M | 1
/// 0080 | L11 | Business Instructions and Reference Number | O | 50
/// 0090 | G62 | Date/Time | O | 1
/// 0100 | MS3 | Interline Information | O | 1
/// 0110 | AT5 | Bill of Lading Handling Requirements | O | 6
/// 0120 | PLD | Pallet Information | O | 1
/// 0125 | LH6 | Hazardous Certification | O | 6
/// 0130 | NTE | Note/Special Instruction | O | 10
/// LOOP ID - 0100 | 5
/// 0100 -> 0140 | N1 | Name | O | 1
/// 0100 -> 0150 | N2 | Additional Name Information | O | 1
/// 0100 -> 0160 | N3 | Address Information | O | 2
/// 0100 -> 0170 | N4 | Geographic Location | O | 1
/// 0100 -> 0180 | L11 | Business Instructions and Reference Number | O | 1
/// 0100 -> 0190 | G61 | Contact | O | 3
/// LOOP ID - 0200 | 10
/// 0200 -> 0200 | N7 | Equipment Details | O | 1
/// 0200 -> 0203 | N7A | Accessorial Equipment Details | O | 1
/// 0200 -> 0205 | N7B | Additional Equipment Details | O | 1
/// 0200 -> 0208 | MEA | Measurements | O | 1
/// 0200 -> 0210 | M7 | Seal Numbers | O | 2
/// LOOP ID - 0300 | 999
/// 0300 -> 0010 | S5 | Stop Off Details | M | 1
/// 0300 -> 0020 | L11 | Business Instructions and Reference Number | O | 50
/// 0300 -> 0030 | G62 | Date/Time | O | 2
/// 0300 -> 0040 | AT8 | Shipment Weight, Packaging and Quantity Data | O | 1
/// 0300 -> 0050 | LAD | Lading Detail | O | 999
/// 0300 -> 0060 | AT5 | Bill of Lading Handling Requirements | O | 6
/// 0300 -> 0063 | PLD | Pallet Information | O | 1
/// 0300 -> 0065 | NTE | Note/Special Instruction | O | 20
/// 0300 -> LOOP ID - 0310 | 1 |  
/// 0300 -> 0310 -> 0070 | N1 | Name | O | 1
/// 0300 -> 0310 -> 0080 | N2 | Additional Name Information | O | 1
/// 0300 -> 0310 -> 0090 | N3 | Address Information | O | 2
/// 0300 -> 0310 -> 0100 | N4 | Geographic Location | O | 1
/// 0300 -> 0310 -> 0120 | G61 | Contact | O | 3
/// 0300 -> LOOP ID - 0320 | 99 |  
/// 0300 -> 0320 -> 0130 | L5 | Description, Marks and Numbers | O | 1
/// 0300 -> 0320 -> 0135 | AT8 | Shipment Weight, Packaging and Quantity Data | O | 1
/// 0300 -> 0320 -> LOOP ID - 0325 | 99 |   |  
/// 0300 -> 0320 -> 0325 -> 0140 | G61 | Contact | O | 1
/// 0300 -> 0320 -> 0325 -> 0141 | L11 | Business Instructions and Reference Number | O | 5
/// 0300 -> 0320 -> 0325 -> 0142 | LH6 | Hazardous Certification | O | 6
/// 0300 -> 0320 -> 0325 -> LOOP ID - 0330 | 25 |   |   |  
/// 0300 -> 0320 -> 0325 -> 0330 -> 0143 | LH1 | Hazardous Identification Information | O | 1
/// 0300 -> 0320 -> 0325 -> 0330 -> 0144 | LH2 | Hazardous Classification Information | O | 4
/// 0300 -> 0320 -> 0325 -> 0330 -> 0145 | LH3 | Hazardous Material Shipping Name | O | 10
/// 0300 -> 0320 -> 0325 -> 0330 -> 0146 | LFH | Freeform Hazardous Material Information | O | 20
/// 0300 -> 0320 -> 0325 -> 0330 -> 0147 | LEP | EPA Required Data | O | 3
/// 0300 -> 0320 -> 0325 -> 0330 -> 0148 | LH4 | Canadian Dangerous Requirements | O | 1
/// 0300 -> 0320 -> 0325 -> 0330 -> 0149 | LHT | Transborder Hazardous Requirements | O | 3
/// 0300 -> LOOP ID - 0350 | 999 |  
/// 0300 -> 0350 -> 0150 | OID | Order Identification Detail | O | 1
/// 0300 -> 0350 -> 0160 | G62 | Date/Time | O | 2
/// 0300 -> 0350 -> 0180 | LAD | Lading Detail | O | 999
/// 0300 -> 0350 -> LOOP ID - 0360 | 99 |   |  
/// 0300 -> 0350 -> 0360 -> 0190 | L5 | Description, Marks and Numbers | O | 1
/// 0300 -> 0350 -> 0360 -> 0195 | AT8 | Shipment Weight, Packaging and Quantity Data | O | 1
/// 0300 -> 0350 -> 0360 -> LOOP ID - 0365 | 99 |   |   |  
/// 0300 -> 0350 -> 0360 -> 0365 -> 0200 | G61 | Contact | O | 1
/// 0300 -> 0350 -> 0360 -> 0365 -> 0201 | L11 | Business Instructions and Reference Number | O | 5
/// 0300 -> 0350 -> 0360 -> 0365 -> 0202 | LH6 | Hazardous Certification | O | 6
/// 0300 -> 0350 -> 0360 -> 0365 -> LOOP ID - 0370 | 25 |   |   |   |  
/// 0300 -> 0350 -> 0360 -> 0365 -> 0370 -> 0203 | LH1 | Hazardous Identification Information | O | 1
/// 0300 -> 0350 -> 0360 -> 0365 -> 0370 -> 0204 | LH2 | Hazardous Classification Information | O | 4
/// 0300 -> 0350 -> 0360 -> 0365 -> 0370 -> 0205 | LH3 | Hazardous Material Shipping Name | O | 10
/// 0300 -> 0350 -> 0360 -> 0365 -> 0370 -> 0206 | LFH | Freeform Hazardous Material Information | O | 20
/// 0300 -> 0350 -> 0360 -> 0365 -> 0370 -> 0207 | LEP | EPA Required Data | O | 3
/// 0300 -> 0350 -> 0360 -> 0365 -> 0370 -> 0208 | LH4 | Canadian Dangerous Requirements | O | 1
/// 0300 -> 0350 -> 0360 -> 0365 -> 0370 -> 0209 | LHT | Transborder Hazardous Requirements | O | 3
/// 0300 -> LOOP ID - 0380 | 10 |  
/// 0300 -> 0380 -> 0210 | N7 | Equipment Details | O | 1
/// 0300 -> 0380 -> 0220 | N7A | Accessorial Equipment Details | O | 1
/// 0300 -> 0380 -> 0230 | N7B | Additional Equipment Details | O | 1
/// 0300 -> 0380 -> 0240 | MEA | Measurements | O | 1
/// 0300 -> 0380 -> 0250 | M7 | Seal Numbers | O | 2
/// 9010 | L3 | Total Weight and Charges | O | 1
/// 9020 | SE | Transaction Set Trailer | M | 1
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _204 {
    pub st: ST,
    pub b2: B2,
    pub b2a: B2A,
    pub l11: Option<L11>,
    pub g62: Option<G62>,
    pub ms3: Option<MS3>,
    pub at5: Option<AT5>,
    pub pld: Option<PLD>,
    pub lh6: Option<LH6>,
    pub nte: Option<NTE>,
    pub loop_100: Vec<_204Loop100>,
    pub loop_200: Vec<_204Loop200>,
    pub loop_300: Vec<_204Loop300>,
    pub l3: Option<L3>,
    pub se: SE,
}

#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _204Loop100 {
    pub n1: Option<N1>,
    pub n2: Option<N2>,
    pub n3: Vec<N3>,
    pub n4: Option<N4>,
    pub l11: Option<L11>,
    pub g61: Vec<G61>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _204Loop200 {
    pub n7: Option<N7>,
    pub n7a: Option<N7A>,
    pub n7b: Option<N7B>,
    pub mea: Option<MEA>,
    pub m7: Option<M7>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _204Loop300 {
    pub s5: S5,
    pub l11: Vec<L11>,
    pub g62: Vec<G62>,
    pub at8: Option<AT8>,
    pub lad: Vec<LAD>,
    pub at5: Vec<AT5>,
    pub pld: Option<PLD>,
    pub nte: Vec<NTE>,
    pub loop_310: Vec<_204Loop310>,
    pub loop_320: Vec<_204Loop320>,
    pub loop_350: Vec<_204Loop350>,
    pub loop_380: Vec<_204Loop380>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _204Loop310 {
    pub n1: Option<N1>,
    pub n2: Option<N2>,
    pub n3: Vec<N3>,
    pub n4: Option<N4>,
    pub g61: Vec<G61>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _204Loop320 {
    pub l5: Option<L5>,
    pub at8: Option<AT8>,
    pub loop_325: Vec<_204Loop325>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _204Loop325 {
    pub g61: Option<G61>,
    pub l11: Vec<L11>,
    pub lh6: Option<LH6>,
    pub loop_330: Vec<_204Loop330>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _204Loop330 {
    pub lh1: Option<LH1>,
    pub lh2: Vec<LH2>,
    pub lh3: Vec<LH3>,
    pub lfh: Option<LFH>,
    pub lep: Vec<LEP>,
    pub lh4: Option<LH4>,
    pub lht: Vec<LHT>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _204Loop350 {
    pub oid: Option<OID>,
    pub g62: Vec<G62>,
    pub lad: Vec<LAD>,
    pub loop_360: Vec<_204Loop360>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _204Loop360 {
    pub l5: Option<L5>,
    pub at8: Option<AT8>,
    pub loop_365: Vec<_204Loop365>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _204Loop365 {
    pub g61: Option<G61>,
    pub l11: Vec<L11>,
    pub lh6: Vec<LH6>,
    pub loop_370: Vec<_204Loop370>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _204Loop370 {
    pub lh1: Option<LH1>,
    pub lh2: Vec<LH2>,
    pub lh3: Vec<LH3>,
    pub lfh: Vec<LFH>,
    pub lep: Vec<LEP>,
    pub lh4: Option<LH4>,
    pub lht: Vec<LHT>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _204Loop380 {
    pub n7: Option<N7>,
    pub n7a: Option<N7A>,
    pub n7b: Option<N7B>,
    pub mea: Option<MEA>,
    pub m7: Option<M7>,
}

/// 214 - Transportation Carrier Shipment Status Message
///
/// This Draft Standard for Trial Use contains the format and establishes the data contents of the Transportation Carrier Shipment Status Message Transaction Set (214) for use within the context of an Electronic Data Interchange (EDI) environment. This transaction set can be used by a transportation carrier to provide shippers, consignees, and their agents with the status of shipments in terms of dates, times, locations, route, identifying numbers, and conveyance.
///
/// POS	ID	NAME	REQ	MAX	REPEAT
/// 0010	ST	Transaction Set Header	M	1
/// 0020	B10	Beginning Segment for Transportation Carrier Shipment Status Message	M	1
/// 0030	L11	Business Instructions and Reference Number	O	300
/// 0035	MAN	Marks and Numbers	O	9999
/// 0040	K1	Remarks	O	10
/// LOOP ID - 0100	10
/// 0100 -> 0050	N1	Name	O	1
/// 0100 -> 0060	N2	Additional Name Information	O	1
/// 0100 -> 0070	N3	Address Information	O	2
/// 0100 -> 0080	N4	Geographic Location	O	1
/// 0100 -> 0090	G61	Contact	O	1
/// 0100 -> 0100	G62	Date/Time	O	1
/// 0100 -> 0110	L11	Business Instructions and Reference Number	O	10
/// 0120	MS3	Interline Information	O	12
/// LOOP ID - 0200	999999
/// 0200 -> 0130	LX	Assigned Number	O	1
/// 0200 -> LOOP ID - 0205	10
/// 0200 -> 0205 -> 0140	AT7	Shipment Status Details	O	1
/// 0200 -> 0205 -> 0143	MS1	Equipment, Shipment, or Real Property Location	O	1
/// 0200 -> 0205 -> 0146	MS2	Equipment or Container Owner and Type	O	1
/// 0200 -> 0150	L11	Business Instructions and Reference Number	O	10
/// 0200 -> 0155	MAN	Marks and Numbers	O	9999
/// 0200 -> 0160	Q7	Lading Exception Code	O	10
/// 0200 -> 0170	K1	Remarks	O	10
/// 0200 -> 0180	AT5	Bill of Lading Handling Requirements	O	10
/// 0200 -> 0200	AT8	Shipment Weight, Packaging and Quantity Data	O	10
/// 0200 -> LOOP ID - 0210	999999
/// 0200 -> 0210 -> 0210	CD3	Carton (Package) Detail	O	1
/// 0200 -> 0210 -> 0220	L11	Business Instructions and Reference Number	O	20
/// 0200 -> 0210 -> LOOP ID - 0215	10
/// 0200 -> 0210 -> 0215 -> 0230	AT7	Shipment Status Details	O	1
/// 0200 -> 0210 -> 0215 -> 0233	MS1	Equipment, Shipment, or Real Property Location	O	1
/// 0200 -> 0210 -> 0215 -> 0236	MS2	Equipment or Container Owner and Type	O	1
/// 0200 -> 0210 -> 0240	NM1	Individual or Organizational Name	O	1
/// 0200 -> 0210 -> 0250	Q7	Lading Exception Code	O	10
/// 0200 -> 0210 -> 0260	AT8	Shipment Weight, Packaging and Quantity Data	O	1
/// 0200 -> 0210 -> 0265	MAN	Marks and Numbers	O	9999
/// 0200 -> 0210 -> LOOP ID - 0220	999999
/// 0200 -> 0210 -> 0220 -> 0270	N1	Name	O	1
/// 0200 -> 0210 -> 0220 -> 0280	N2	Additional Name Information	O	1
/// 0200 -> 0210 -> 0220 -> 0290	N3	Address Information	O	3
/// 0200 -> 0210 -> 0220 -> 0300	N4	Geographic Location	O	1
/// 0200 -> 0210 -> 0220 -> 0310	L11	Business Instructions and Reference Number	O	10
/// 0200 -> LOOP ID - 0230	999999
/// 0200 -> 0230 -> 0320	PRF	Purchase Order Reference	O	1
/// 0200 -> 0230 -> LOOP ID - 0231	999999
/// 0200 -> 0230 -> 0231 -> 0330	N1	Name	O	1
/// 0200 -> 0230 -> 0231 -> 0340	N2	Additional Name Information	O	1
/// 0200 -> 0230 -> 0231 -> 0350	N3	Address Information	O	2
/// 0200 -> 0230 -> 0231 -> 0360	N4	Geographic Location	O	1
/// 0200 -> 0230 -> 0231 -> 0370	L11	Business Instructions and Reference Number	O	10
/// 0200 -> 0230 -> LOOP ID - 0233	999999
/// 0200 -> 0230 -> 0233 -> 0380	CD3	Carton (Package) Detail	O	1
/// 0200 -> 0230 -> 0233 -> 0390	L11	Business Instructions and Reference Number	O	20
/// 0200 -> 0230 -> 0233 -> LOOP ID - 0240	10
/// 0200 -> 0230 -> 0233 -> 0240 -> 0400	AT7	Shipment Status Details	O	1
/// 0200 -> 0230 -> 0233 -> 0240 -> 0402	MS1	Equipment, Shipment, or Real Property Location	O	1
/// 0200 -> 0230 -> 0233 -> 0240 -> 0404	MS2	Equipment or Container Owner and Type	O	1
/// 0200 -> 0230 -> 0233 -> 0405	MAN	Marks and Numbers	O	9999
/// 0200 -> LOOP ID - 0250	999999
/// 0200 -> 0250 -> 0410	SPO	Shipment Purchase Order Detail	O	1
/// 0200 -> 0250 -> 0420	SDQ	Destination Quantity	O	10
/// 0200 -> LOOP ID - 0260	>1
/// 0200 -> 0260 -> 0423	EFI	Electronic Format Identification	O	1
/// 0200 -> 0260 -> 0426	BIN	Binary Data	M	1
/// 0610	SE	Transaction Set Trailer	M	1
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _214 {
    pub st: ST,
    pub b10: B10,
    pub l11: Vec<L11>,
    pub man: Vec<MAN>,
    pub k1: Vec<K1>,
    pub loop_0100: Vec<_214Loop0100>,
    pub ms3: Vec<MS3>,
    pub loop_0200: Vec<_214Loop0200>,
    pub se: SE,
}

#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _214Loop0100 {
    pub n1: Option<N1>,
    pub n2: Option<N2>,
    pub n3: Vec<N3>,
    pub n4: Option<N4>,
    pub g61: Option<G61>,
    pub g62: Option<G62>,
    pub l11: Vec<L11>,
}

#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _214Loop0200 {
    pub lx: Option<LX>,
    pub loop_0205: Vec<_214Loop0200Loop0205>,
    pub l11: Vec<L11>,
    pub man: Vec<MAN>,
    pub q7: Vec<Q7>,
    pub k1: Vec<K1>,
    pub at5: Vec<AT5>,
    pub at8: Vec<AT8>,
    pub loop_0210: Vec<_214Loop0200Loop0210>,
    pub loop_0230: Vec<_214Loop0200Loop0230>,
    pub loop_0250: Vec<_214Loop0200Loop0250>,
    pub loop_0260: Vec<_214Loop0200Loop0260>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _214Loop0200Loop0205 {
    pub at7: Option<AT7>,
    pub ms1: Option<MS1>,
    pub ms2: Option<MS2>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _214Loop0200Loop0210 {
    pub cd3: Option<CD3>,
    pub l11: Vec<L11>,
    pub loop_0215: Vec<_214Loop0200Loop0210Loop0215>,
    pub nm1: Option<NM1>,
    pub q7: Vec<Q7>,
    pub at8: Option<AT8>,
    pub man: Vec<MAN>,
    pub loop_0220: Vec<_214Loop0200Loop0210Loop0220>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _214Loop0200Loop0210Loop0215 {
    pub at7: Option<AT7>,
    pub ms1: Option<MS1>,
    pub ms2: Option<MS2>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _214Loop0200Loop0210Loop0220 {
    pub n1: Option<N1>,
    pub n2: Option<N2>,
    pub n3: Vec<N3>,
    pub n4: Option<N4>,
    pub l11: Vec<L11>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _214Loop0200Loop0230 {
    pub prf: Option<PRF>,
    pub loop_0231: Vec<_214Loop0200Loop0230Loop0231>,
    pub loop_0233: Vec<_214Loop0200Loop0230Loop0233>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _214Loop0200Loop0230Loop0231 {
    pub n1: Option<N1>,
    pub n2: Option<N2>,
    pub n3: Vec<N3>,
    pub n4: Option<N4>,
    pub l11: Vec<L11>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _214Loop0200Loop0230Loop0233 {
    pub cd3: Option<CD3>,
    pub l11: Vec<L11>,
    pub loop_0240: Vec<_214Loop0200Loop0230Loop0233Loop0240>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _214Loop0200Loop0230Loop0233Loop0240 {
    pub at7: Option<AT7>,
    pub ms1: Option<MS1>,
    pub ms2: Option<MS2>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _214Loop0200Loop0250 {
    pub spo: Option<SPO>,
    pub sdq: Option<SDQ>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _214Loop0200Loop0260 {
    pub efi: Option<EFI>,
    pub bin: BIN,
}

/// 315 - Status Details (Ocean)
///
/// This Draft Standard for Trial Use contains the format and establishes the data contents of the Status Details (Ocean) Transaction Set (315) for use within the context of an Electronic Data Interchange (EDI) environment. The transaction set can be used to provide all the information necessary to report status or event details for selected shipments or containers. It is intended to accommodate the details for one status or event associated with many shipments or containers, as well as more than one status or event for one shipment or container.
/// POS | ID | NAME | REQ | MAX | REPEAT
/// ----|----|------|-----|-----|-------
/// 0010 | ST | Transaction Set Header | M | 1
/// 0020 | B4 | Beginning Segment for Inquiry or Reply | M | 1
/// 0030 | N9 | Reference Identification | O | 30
/// 0040 | Q2 | Status Details (Ocean) | O | 1
/// 0050 | SG | Shipment Status | O | 15
/// LOOP ID - R4 | 20
/// R4 -> 0060 | R4 | Port or Terminal | M | 1
/// R4 -> 0070 | DTM | Date/Time Reference | O | 15
/// 0080 | V9 | Event Detail | O | 10
/// 0090 | SE | Transaction Set Trailer | M | 1
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq)]
pub struct _315 {
    pub st: ST,
    pub b4: B4,
    #[serde(default)]
    pub n9: Vec<N9>,
    pub q2: Option<Q2>,
    #[serde(default)]
    pub sg: Vec<SG>,
    #[serde(default)]
    pub loop_r4: Vec<_315LoopR4>,
    pub v9: Option<V9>,
    pub se: SE,
}

impl Reflect for _315 {
    fn get_path(current_path: &Path, next_segment: &str, last_path: &Path) -> Path {
        match next_segment {
            "ST" => current_path.push("st".to_string(), None, true),
            "B4" => current_path.push("b4".to_string(), None, true),
            "N9" => {
                // let last = last_path.elem.last();
                // println!("N9: last: {:?}",last);
                let counter = match last_path.elem.last().unwrap().vec_position {
                    Some(count) => count + 1,
                    None => 0,
                };
                println!("N9: {current_path} {last_path} {counter}");
                current_path.push("n9".to_string(), Some(counter), true)
            }
            "Q2" => current_path.push("q2".to_string(), None, true),
            "SG" => current_path.push("sg".to_string(), Some(0), true),
            // "R4" => current_path.push("r4".to_string(), None, true),
            "V9" => current_path.push("v9".to_string(), None, true),
            "SE" => current_path.push("se".to_string(), None, true),
            _ => {
                //must be part of _315LoopR4 loop
                let v = last_path.pop();
                let last_elem = v.elem.last().unwrap();
                let counter = if last_elem.name == "loop_r4" {
                    match last_path.pop().elem.last().unwrap().vec_position {
                        Some(count) => count + 1,
                        None => 0,
                    }
                } else {
                    0
                };
                println!("_315LoopR4: {current_path} {last_path} {counter}");
                let new_path = current_path.push("loop_r4".to_string(), Some(counter), false);
                let x = _315LoopR4::get_path(&new_path, next_segment, last_path);
                x.next_op(PathOperation::Pop)
            }
        }
    }

    fn get_type_name() -> String {
        "_315".to_string()
    }
}

#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq)]
pub struct _315LoopR4 {
    pub r4: R4,
    pub dtm: Option<DTM>,
}

impl Reflect for _315LoopR4 {
    fn get_type_name() -> String {
        "_315LoopR4".to_string()
    }
    fn get_path(current_path: &Path, next_segment: &str, last_path: &Path) -> Path {
        match next_segment {
            "R4" => current_path.push("r4".to_string(), None, true),
            "DTM" => current_path.push("dtm".to_string(), None, true),
            _ => Path::default(),
        }
    }
}

/// 322 - Terminal Operations and Intermodal Ramp Activity
///
/// This Draft Standard for Trial Use contains the format and establishes the data contents of the Terminal Operations and Intermodal Ramp Activity Transaction Set (322) for use within the context of an Electronic Data Interchange (EDI) environment. The transaction set can be used to provide all the information necessary for a terminal operation, port authority or intermodal ramp to communicate terminal and intermodal ramp activities (e.g., "ingates" and "outgates") to authorized parties to a shipment.
///
/// POS | ID | NAME | REQ | MAX | REPEAT
/// ----|----|------|-----|-----|-------
/// 0010 | ST | Transaction Set Header | M | 1 |   |  
/// 0015 | ZC1 | Beginning Segment For Data Correction Or Change | O | 1 |   |  
/// 0016 | Q5 | Status Details | M | 1 |   |  
/// LOOP ID - N7 | 1000
/// N7 -> 0020 | N7 | Equipment Details | M | 1 |   |  
/// N7 -> 0030 | V4 | Cargo Location Reference | O | 1 |   |  
/// N7 -> 0040 | DTM | Date/Time Reference | O | 2 |   |  
/// N7 -> 0050 | M7 | Seal Numbers | O | 5 |   |  
/// N7 -> 0060 | W09 | Equipment and Temperature | O | 1 |   |  
/// N7 -> 0070 | W2 | Equipment Identification | O | 1 |   |  
/// N7 -> 0080 | NA | Cross-Reference Equipment | O | 30 |   |  
/// N7 -> 0085 | GR5 | Loading Details | O | 10 |   |  
/// N7 -> 0100 | Y7 | Priority | O | 1 |   |  
/// N7 -> 0110 | V1 | Vessel Identification | O | 1 |   |  
/// N7 -> LOOP ID - R4 | 20 |  
/// N7 -> R4 -> 0120 | R4 | Port or Terminal | M | 1 |   |  
/// N7 -> R4 -> 0130 | DTM | Date/Time Reference | O | 15 |   |  
/// N7 -> 0140 | H3 | Special Handling Instructions | O | 6 |   |  
/// N7 -> LOOP ID - N1 | 10 |  
/// N7 -> N1 -> 0150 | N1 | Name | O | 1 |   |  
/// N7 -> N1 -> 0153 | N3 | Address Information | O | 2 |   |  
/// N7 -> N1 -> 0156 | N4 | Geographic Location | O | 1 |   |  
/// N7 -> 0160 | K1 | Remarks | O | 2 |   |  
/// N7 -> 0170 | N9 | Reference Identification | O | 10 |   |  
/// N7 -> LOOP ID - L0 | 999 |  
/// N7 -> L0 -> 0180 | L0 | Line Item - Quantity and Weight | O | 1 |   |  
/// N7 -> L0 -> 0190 | L5 | Description, Marks and Numbers | O | 1 |   |  
/// N7 -> L0 -> 0200 | H1 | Hazardous Material | O | 3 |   |  
/// N7 -> 0210 | L3 | Total Weight and Charges | O | 2 |   |  
/// 0220 | SE | Transaction Set Trailer | M | 1 |   |
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
pub struct _322 {
    pub st: ST,
    pub zc1: Option<ZC1>,
    pub q5: Q5,
    pub loop_n7: Vec<_322LoopN7>,
    pub se: SE,
}

#[derive(Serialize, Deserialize, Clone, Default, Debug)]
pub struct _322LoopN7 {
    pub n7: N7,
    pub v4: Option<V4>,
    pub dtm: Option<DTM>,
    pub m7: Option<M7>,
    pub w09: Option<W09>,
    pub w2: Option<W2>,
    pub na: Option<NA>,
    pub gr5: Option<GR5>,
    pub y7: Option<Y7>,
    pub v1: Option<V1>,
    pub loop_r4: Vec<_322LoopR4>,
    pub h3: Vec<H3>,
    pub loop_n1: Vec<_322LoopN1>,
    pub k1: Vec<K1>,
    pub n9: Vec<N9>,
    pub loop_l0: Vec<_322LoopL0>,
    pub l3: Vec<L3>,
}

#[derive(Serialize, Deserialize, Clone, Default, Debug)]
pub struct _322LoopR4 {
    r4: R4,
    dtm: Vec<DTM>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
pub struct _322LoopN1 {
    n1: Option<N1>,
    n3: Vec<N3>,
    n4: Option<N4>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
pub struct _322LoopL0 {
    l0: Option<L0>,
    l5: Option<L5>,
    h1: Vec<H1>,
}

/// 404 - Rail Carrier Shipment Information
///
/// This Draft Standard for Trial Use contains the format and establishes the data contents of the Rail Carrier Shipment Information Transaction Set (404) for use within the context of an Electronic Data Interchange (EDI) environment. The transaction set can be used to transmit rail-carrier-specific bill of lading information to a railroad. It is the initial tender of a shipment between a consignor and a rail carrier and can be used as notification of equipment release and/or a legal bill of lading.
///
/// POS | ID | NAME | REQ | MAX | REPEAT
/// ----|----|------|-----|-----|-------
/// 0010 | ST | Transaction Set Header | M | 1 |   |   |  
/// 0020 | ZC1 | Beginning Segment For Data Correction Or Change | O | 1 |   |   |  
/// 0030 | BX | General Shipment Information | O | 1 |   |   |  
/// 0040 | BNX | Rail Shipment Information | O | 1 |   |   |  
/// 0050 | M3 | Release | M | 1 |   |   |  
/// 0060 | N9 | Reference Identification | M | 30 |   |   |  
/// 0070 | CM | Cargo Manifest | O | 2 |   |   |  
/// 0080 | M1 | Insurance | O | 1 |   |   |  
/// 0090 | DTM | Date/Time Reference | O | 5 |   |   |  
/// LOOP ID - N7 | 500
/// N7 -> 0100 | N7 | Equipment Details | M | 1 |   |   |  
/// N7 -> 0101 | EM | Equipment Characteristics | O | 1 |   |   |  
/// N7 -> LOOP ID - VC | 21 |  
/// N7 -> VC -> 0110 | VC | Motor Vehicle Control | O | 1 |   |   |  
/// N7 -> VC -> LOOP ID - N1 | 2 |   |  
/// N7 -> VC -> N1 -> 0112 | N1 | Name | O | 1 |   |   |  
/// N7 -> VC -> N1 -> 0114 | N3 | Address Information | O | 2 |   |   |  
/// N7 -> VC -> N1 -> 0116 | N4 | Geographic Location | O | 1 |   |   |  
/// N7 -> VC -> N1 -> 0118 | H3 | Special Handling Instructions | O | 1 |   |   |  
/// N7 -> 0130 | M7 | Seal Numbers | O | 5 |   |   |  
/// N7 -> 0140 | N5 | Equipment Ordered | O | 1 |   |   |  
/// N7 -> 0150 | IC | Intermodal Chassis Equipment | O | 1 |   |   |  
/// N7 -> 0160 | IM | Intermodal Movement Information | O | 1 |   |   |  
/// N7 -> 0170 | M12 | In-bond Identifying Information | O | 2 |   |   |  
/// N7 -> LOOP ID - E1 | 2 |  
/// N7 -> E1 -> 0171 | E1 | Empty Car Disposition - Pended Destination Consignee | O | 1 |   |   |  
/// N7 -> E1 -> 0172 | E4 | Empty Car Disposition - Pended Destination City | O | 1 |   |   |  
/// N7 -> E1 -> 0173 | E5 | Empty Car Disposition - Pended Destination Route | O | 13 |   |   |  
/// N7 -> E1 -> 0174 | PI | Price Authority Identification | O | 1 |   |   |  
/// N7 -> 0175 | GA | Canadian Grain Information | O | 15 |   |   |  
/// N7 -> LOOP ID - REF | 99 |  
/// N7 -> REF -> 0177 | REF | Reference Identification | O | 1 |   |   |  
/// N7 -> REF -> 0178 | N10 | Quantity and Description | O | 15 |   |   |  
/// N7 -> REF -> LOOP ID - N1 | 5 |   |  
/// N7 -> REF -> N1 -> 0179 | N1 | Name | O | 1 |   |   |  
/// N7 -> REF -> N1 -> 0180 | N3 | Address Information | O | 1 |   |   |  
/// N7 -> REF -> N1 -> 0182 | N4 | Geographic Location | O | 1 |   |   |  
/// 0185 | NA | Cross-Reference Equipment | O | 10 |   |   |  
/// 0190 | F9 | Origin Station | M | 1 |   |   |  
/// 0200 | D9 | Destination Station | M | 1 |   |   |  
/// LOOP ID - N1 | 10
/// N1 -> 0210 | N1 | Name | M | 1 |   |   |  
/// N1 -> 0215 | N2 | Additional Name Information | O | 2 |   |   |  
/// N1 -> 0220 | N3 | Address Information | O | 2 |   |   |  
/// N1 -> 0230 | N4 | Geographic Location | O | 1 |   |   |  
/// N1 -> 0235 | REF | Reference Identification | O | 2 |   |   |  
/// N1 -> 0240 | PER | Administrative Communications Contact | O | 2 |   |   |  
/// N1 -> 0252 | BL | Billing Information | O | 12 |   |   |  
/// LOOP ID - S1 | 12
/// S1 -> 0430 | S1 | Stop-off Name | O | 1 |   |   |  
/// S1 -> 0440 | S2 | Stop-off Address | O | 2 |   |   |  
/// S1 -> 0448 | S9 | Stop-off Station | O | 1 |   |   |  
/// S1 -> 0449 | N1 | Name | O | 1 |   |   |  
/// S1 -> 0450 | N2 | Additional Name Information | O | 1 |   |   |  
/// S1 -> 0451 | N3 | Address Information | O | 1 |   |   |  
/// S1 -> 0452 | N4 | Geographic Location | O | 1 |   |   |  
/// S1 -> 0453 | PER | Administrative Communications Contact | O | 1 |   |   |  
/// 0460 | R2 | Route Information | O | 13 |   |   |  
/// 0480 | R9 | Route Code | O | 1 |   |   |  
/// LOOP ID - E1 | 2
/// E1 -> 0490 | E1 | Empty Car Disposition - Pended Destination Consignee | O | 1 |   |   |  
/// E1 -> 0500 | E4 | Empty Car Disposition - Pended Destination City | O | 1 |   |   |  
/// E1 -> 0510 | E5 | Empty Car Disposition - Pended Destination Route | O | 13 |   |   |  
/// E1 -> 0511 | PI | Price Authority Identification | O | 1 |   |   |  
/// 0520 | H3 | Special Handling Instructions | O | 20 |   |   |  
/// 0530 | PS | Protective Service Instructions | O | 5 |   |   |  
/// LOOP ID - LX | 25
/// LX -> 0540 | LX | Assigned Number | M | 1 |   |   |  
/// LX -> 0550 | L5 | Description, Marks and Numbers | M | 15 |   |   |  
/// LX -> LOOP ID - L0 | 25 |  
/// LX -> L0 -> 0570 | L0 | Line Item - Quantity and Weight | O | 1 |   |   |  
/// LX -> L0 -> 0575 | MEA | Measurements | O | 3 |   |   |  
/// LX -> L0 -> 0580 | L1 | Rate and Charges | O | 10 |   |   |  
/// LX -> L0 -> 0590 | PI | Price Authority Identification | O | 30 |   |   |  
/// LX -> 0600 | X1 | Export License | O | 6 |   |   |  
/// LOOP ID - T1 | 64
/// T1 -> 0610 | T1 | Transit Inbound Origin | O | 1 |   |   |  
/// T1 -> 0620 | T2 | Transit Inbound Lading | O | 30 |   |   |  
/// T1 -> 0630 | T3 | Transit Inbound Route | O | 12 |   |   |  
/// T1 -> 0640 | T6 | Transit Inbound Rates | O | 1 |   |   |  
/// T1 -> 0650 | T8 | Free-form Transit Data | O | 99 |   |   |  
/// 0660 | L3 | Total Weight and Charges | O | 1 |   |   |  
/// 0670 | LS | Loop Header | O | 1 |   |   |  
/// LOOP ID - LH1 | 100
/// LH1 -> 0680 | LH1 | Hazardous Identification Information | O | 1 |   |   |  
/// LH1 -> 0690 | LH2 | Hazardous Classification Information | O | 4 |   |   |  
/// LH1 -> 0700 | LH3 | Hazardous Material Shipping Name | O | 10 |   |   |  
/// LH1 -> 0710 | LFH | Freeform Hazardous Material Information | O | 20 |   |   |  
/// LH1 -> 0720 | LEP | EPA Required Data | O | 3 |   |   |  
/// LH1 -> 0730 | LH4 | Canadian Dangerous Requirements | O | 1 |   |   |  
/// LH1 -> 0740 | LHT | Transborder Hazardous Requirements | O | 3 |   |   |  
/// LH1 -> 0750 | LHR | Hazardous Material Identifying Reference Numbers | O | 5 |   |   |  
/// LH1 -> 0755 | PER | Administrative Communications Contact | O | 5 |   |   |  
/// 0760 | LE | Loop Trailer | O | 1 |   |   |  
/// 0770 | PER | Administrative Communications Contact | O | 5 |   |   |  
/// 0780 | LH2 | Hazardous Classification Information | O | 6 |   |   |  
/// 0790 | LHR | Hazardous Material Identifying Reference Numbers | O | 1 |   |   |  
/// 0800 | LH6 | Hazardous Certification | O | 5 |   |   |  
/// 0810 | XH | Pro Forma - B13 Information | O | 1 |   |   |  
/// 0820 | X7 | Customs Information | O | 10 |   |   |  
/// 0840 | SE | Transaction Set Trailer | M | 1
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _404 {
    pub _010: ST,
    pub _020: Option<ZC1>,
    pub _030: Option<BX>,
    pub _040: Option<BNX>,
    pub _050: M3,
    pub _060: N9,
    pub _070: Option<CM>,
    pub _080: Option<M1>,
    pub _090: Option<DTM>,
    pub loop_n7: Vec<_404LoopN7>,
    pub na: Option<NA>,
    pub f9: F9,
    pub d9: D9,
    pub loop_n1: Vec<_404LoopN1>,
    pub loop_s1: Vec<_404LoopS1>,
    pub r2: Option<R2>,
    pub r9: Option<R9>,
    pub loop_e1: Vec<_404LoopE1>,
    pub h3: Option<H3>,
    pub ps: Option<PS>,
    pub loop_lx: Vec<_404LoopLX>,
    pub loop_t1: Vec<_404LoopT1>,
    pub l3: Option<L3>,
    pub ls: Option<LS>,
    pub loop_lh1: Vec<_404LoopLH1>,
    pub le: Option<LE>,
    pub per: Option<PER>,
    pub lh2: Option<LH2>,
    pub lhr: Option<LHR>,
    pub lh6: Option<LH6>,
    pub xh: Option<XH>,
    pub x7: Option<X7>,
    pub se: SE,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _404LoopN7 {
    pub n7: N7,
    pub em: Option<EM>,
    pub loop_vc: Vec<_404LoopVC>,
    pub m7: Option<M7>,
    pub n5: Option<N5>,
    pub ic: Option<IC>,
    pub im: Option<IM>,
    pub m12: Option<M12>,
    pub loop_e1: Vec<_404LoopN7E1>,
    pub ga: Option<GA>,
    pub loop_ref: Vec<_404LoopN7Ref>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _404LoopN7Ref {
    pub _ref: Option<REF>,
    pub n10: Option<N10>,
    pub loop_n1: Vec<_404LoopN7RefN1>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _404LoopN7RefN1 {
    pub n1: Option<N1>,
    pub n3: Option<N3>,
    pub n4: Option<N4>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _404LoopVC {
    pub vc: Option<VC>,
    pub loop_n1: Vec<_404LoopVcN1>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _404LoopVcN1 {
    pub n1: Option<N1>,
    pub n3: Option<N3>,
    pub n4: Option<N4>,
    pub h3: Option<H3>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _404LoopN1 {
    pub n1: N1,
    pub n2: Option<N2>,
    pub n3: Option<N3>,
    pub n4: Option<N4>,
    pub _ref: Option<REF>,
    pub per: Option<PER>,
    pub bl: Option<BL>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _404LoopS1 {
    pub s1: Option<S1>,
    pub s2: Option<S2>,
    pub s9: Option<S9>,
    pub n1: Option<N1>,
    pub n2: Option<N2>,
    pub n3: Option<N3>,
    pub n4: Option<N4>,
    pub per: Option<PER>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _404LoopN7E1 {
    pub e1: E1,
    pub e4: Option<E4>,
    pub e5: Option<E5>,
    pub pi: Option<PI>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _404LoopE1 {
    pub e1: E1,
    pub e4: Option<E4>,
    pub e5: Option<E5>,
    pub pi: Option<PI>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _404LoopL0 {
    pub l0: Option<L0>,
    pub mea: Option<MEA>,
    pub l1: Option<L1>,
    pub pi: Option<PI>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _404LoopT1 {
    pub t1: Option<T1>,
    pub t2: Option<T2>,
    pub t3: Option<T3>,
    pub t6: Option<T6>,
    pub t8: Option<T8>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _404LoopLH1 {
    pub lh1: Option<LH1>,
    pub lh2: Option<LH2>,
    pub lh3: Option<LH3>,
    pub lfh: Option<LFH>,
    pub lep: Option<LEP>,
    pub lh4: Option<LH4>,
    pub lht: Option<LHT>,
    pub lhr: Option<LHR>,
    pub per: Option<PER>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _404LoopLX {
    pub lx: LX,
    pub l5: L5,
    pub loop_l0: Vec<_404LoopL0>,
    pub x1: Option<X1>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _404LoopRef {
    pub _ref: Option<REF>,
    pub n10: Option<N10>,
    pub loop_n1: Vec<_404LoopRefN1>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct _404LoopRefN1 {
    pub n1: Option<N1>,
    pub n3: Option<N3>,
    pub n4: Option<N4>,
}

/// 997 - Functional Acknowledgment
///
/// This Draft Standard for Trial Use contains the format and establishes the data contents of the Functional Acknowledgment Transaction Set (997) for use within the context of an Electronic Data Interchange (EDI) environment. The transaction set can be used to define the control structures for a set of acknowledgments to indicate the results of the syntactical analysis of the electronically encoded documents. The encoded documents are the transaction sets, which are grouped in functional groups, used in defining transactions for business data interchange. This standard does not cover the semantic meaning of the information encoded in the transaction sets.
///
/// POS | ID | NAME | REQ | MAX | REPEAT
/// ----|----|------|-----|-----|-------
/// 0010 | ST | Transaction Set Header | M | 1 |   |  
/// 0020 | AK1 | Functional Group Response Header | M | 1 |   |  
/// LOOP ID - AK2 | 999999
/// AK2 -> 0030 | AK2 | Transaction Set Response Header | O | 1 |   |  
/// AK2 -> LOOP ID - AK3 | 999999 |  
/// AK2 -> AK3 -> 0040 | AK3 | Data Segment Note | O | 1 |   |  
/// AK2 -> AK3 -> 0050 | AK4 | Data Element Note | O | 99 |   |  
/// AK2 -> 0060 | AK5 | Transaction Set Response Trailer | M | 1 |   |  
/// 0070 | AK9 | Functional Group Response Trailer | M | 1 |   |  
/// 0080 | SE | Transaction Set Trailer | M | 1 |  
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
pub struct _997 {
    pub st: ST,
    pub ak1: AK1,
    pub loop_ak2: Vec<_997LoopAk2>,
    pub ak9: AK9,
    pub se: SE,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
pub struct _997LoopAk2 {
    pub ak2: AK2,
    pub loop_ak3: Vec<_997LoopAk3>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
pub struct _997LoopAk3 {
    pub ak3: Option<AK3>,
    pub ak4: Vec<AK4>,
}

/// 998 - Set Cancellation
///
/// This X12 Transaction Set contains the format and establishes the data contents of the Set Cancellation Transaction Set (998) for use within the context of an Electronic Data Interchange (EDI) environment. The transaction set can be used to request the deletion of a previously transmitted transaction set and will indicate the reason for this action, such as diversion or cancelled bill.
/// POS | ID | NAME | REQ | MAX | REPEAT
/// ----|----|------|-----|-----|-------
/// 0100 | ST | Transaction Set Header | M | 1
/// 0200 | ZD | Transaction Set Deletion - ID, Reason, and Source | M | 1
/// 0300 | SE | Transaction Set Trailer | M | 1
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
pub struct _998 {
    pub st: ST,
    pub zd: ZD,
    pub se: SE,
}