x12_alt 0.1.0

Data types for X12 EDI
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
use std::fmt;
use serde::{de, Deserialize, ser, Serialize};
/**752

See docs at <https://www.stedi.com/edi/x12-005010/element/752>*/
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum SurfaceLayerPositionCode {
    ///1S - Side One
    SideOne,
    ///2S - Side Two
    SideTwo,
    ///A1 - Single
    Single,
    ///A2 - Left Front
    LeftFront,
    ///A3 - Right Front
    RightFront,
    ///A4 - Left Rear
    LeftRear,
    ///A5 - Right Rear
    RightRear,
    ///A6 - Inside Left Rear
    InsideLeftRear,
    ///A7 - Outside Left Rear
    OutsideLeftRear,
    ///A8 - Inside Right Rear
    InsideRightRear,
    ///A9 - Outside Right Rear
    OutsideRightRear,
    ///AL - All
    All,
    ///AO - Single End Overhang
    SingleEndOverhang,
    ///AS - Siding
    Siding,
    ///B1 - Bolster
    Bolster,
    ///BC - Back of Cab
    BackOfCab,
    ///BI - Bilateral
    Bilateral,
    ///BK - Rear
    Rear,
    ///BL - Block
    Block,
    ///BR - Brick
    Brick,
    ///BS - Both Sides
    BothSides,
    ///BT - Bottom
    Bottom,
    ///CH - Casing Head Flange
    CasingHeadFlange,
    ///CT - Center
    Center,
    ///DO - Double End Overhang
    DoubleEndOverhang,
    ///DT - Downstream Tap
    DownstreamTap,
    ///DU - Dual Fuel Tank Position
    DualFuelTankPosition,
    ///EX - Exterior
    Exterior,
    ///FR - Front
    Front,
    ///FS - Front Spare
    FrontSpare,
    ///GF - Rig Floor
    RigFloor,
    ///IN - Inside
    Inside,
    ///IT - Interior
    Interior,
    ///KB - Kelly Bushing
    KellyBushing,
    ///LC - Less Critical Surface
    LessCriticalSurface,
    ///LO - Lower
    Lower,
    ///LT - Left
    Left,
    ///M1 - Multiple
    Multiple,
    ///MC - More Critical Surface
    MoreCriticalSurface,
    ///MD - Middle
    Middle,
    ///NS - Not Specified
    NotSpecified,
    ///NT - Next Relative Position
    NextRelativePosition,
    ///OA - Overall
    Overall,
    ///OS - One Side
    OneSide,
    ///OT - Outside
    Outside,
    ///R0 - Relative Position 10
    RelativePosition10,
    ///R1 - Relative Position 1
    RelativePosition1,
    ///R2 - Relative Position 2
    RelativePosition2,
    ///R3 - Relative Position 3
    RelativePosition3,
    ///R4 - Relative Position 4
    RelativePosition4,
    ///R5 - Relative Position 5
    RelativePosition5,
    ///R6 - Relative Position 6
    RelativePosition6,
    ///R7 - Relative Position 7
    RelativePosition7,
    ///R8 - Relative Position 8
    RelativePosition8,
    ///R9 - Relative Position 9
    RelativePosition9,
    ///RA - Relative Position 11
    RelativePosition11,
    ///RB - Relative Position 12
    RelativePosition12,
    ///RC - Relative Position 13
    RelativePosition13,
    ///RD - Relative Position 14
    RelativePosition14,
    ///RE - Relative Position 15
    RelativePosition15,
    ///RF - Relative Position 16
    RelativePosition16,
    ///RG - Relative Position 17
    RelativePosition17,
    ///RH - Relative Position 18
    RelativePosition18,
    ///RI - Relative Position 19
    RelativePosition19,
    ///RJ - Relative Position 20
    RelativePosition20,
    ///RK - Relative Position 21
    RelativePosition21,
    ///RL - Relative Position 22
    RelativePosition22,
    ///RM - Relative Position 23
    RelativePosition23,
    ///RN - Relative Position 24
    RelativePosition24,
    ///RO - Relative Position 25
    RelativePosition25,
    ///RP - Relative Position 26
    RelativePosition26,
    ///RQ - Relative Position 27
    RelativePosition27,
    ///RR - Relative Position 28
    RelativePosition28,
    ///RS - Relative Position 29
    RelativePosition29,
    ///RT - Relative Position 30
    RelativePosition30,
    ///RU - Relative Position 31
    RelativePosition31,
    ///RV - Relative Position 32
    RelativePosition32,
    ///RW - Relative Position 33
    RelativePosition33,
    ///RX - Relative Position 34
    RelativePosition34,
    ///RY - Relative Position 35
    RelativePosition35,
    ///RZ - Relative Position 36
    RelativePosition36,
    ///S1 - Relative Position 37
    RelativePosition37,
    ///S2 - Relative Position 38
    RelativePosition38,
    ///S3 - Relative Position 39
    RelativePosition39,
    ///S4 - Relative Position 40
    RelativePosition40,
    ///S5 - Relative Position 41
    RelativePosition41,
    ///S6 - Relative Position 42
    RelativePosition42,
    ///S7 - Relative Position 43
    RelativePosition43,
    ///S8 - Relative Position 44
    RelativePosition44,
    ///S9 - Relative Position 45
    RelativePosition45,
    ///SA - Relative Position 46
    RelativePosition46,
    ///SB - Right
    Right,
    ///SC - Relative Position 47
    RelativePosition47,
    ///SD - Relative Position 48
    RelativePosition48,
    ///SE - Relative Position 49
    RelativePosition49,
    ///SF - Relative Position 50
    RelativePosition50,
    ///SN - Stone
    Stone,
    ///SP - Spare Tire Position
    SpareTirePosition,
    ///SS - Rear Spare
    RearSpare,
    ///ST - Stucco
    Stucco,
    ///SU - Sub-sea
    SubSea,
    ///TB - Tank Bottom
    TankBottom,
    ///TP - Top
    Top,
    ///TS - Two Sides
    TwoSides,
    ///UC - Under Cab
    UnderCab,
    ///UN - Unilateral
    Unilateral,
    ///UP - Upper
    Upper,
    ///UT - Upstream Tap
    UpstreamTap,
    ///WF - Wood
    Wood,
}
impl SurfaceLayerPositionCode {
    pub fn code(&self) -> &str {
        {
            use SurfaceLayerPositionCode::*;
            match self {
                SideOne => "1S",
                SideTwo => "2S",
                Single => "A1",
                LeftFront => "A2",
                RightFront => "A3",
                LeftRear => "A4",
                RightRear => "A5",
                InsideLeftRear => "A6",
                OutsideLeftRear => "A7",
                InsideRightRear => "A8",
                OutsideRightRear => "A9",
                All => "AL",
                SingleEndOverhang => "AO",
                Siding => "AS",
                Bolster => "B1",
                BackOfCab => "BC",
                Bilateral => "BI",
                Rear => "BK",
                Block => "BL",
                Brick => "BR",
                BothSides => "BS",
                Bottom => "BT",
                CasingHeadFlange => "CH",
                Center => "CT",
                DoubleEndOverhang => "DO",
                DownstreamTap => "DT",
                DualFuelTankPosition => "DU",
                Exterior => "EX",
                Front => "FR",
                FrontSpare => "FS",
                RigFloor => "GF",
                Inside => "IN",
                Interior => "IT",
                KellyBushing => "KB",
                LessCriticalSurface => "LC",
                Lower => "LO",
                Left => "LT",
                Multiple => "M1",
                MoreCriticalSurface => "MC",
                Middle => "MD",
                NotSpecified => "NS",
                NextRelativePosition => "NT",
                Overall => "OA",
                OneSide => "OS",
                Outside => "OT",
                RelativePosition10 => "R0",
                RelativePosition1 => "R1",
                RelativePosition2 => "R2",
                RelativePosition3 => "R3",
                RelativePosition4 => "R4",
                RelativePosition5 => "R5",
                RelativePosition6 => "R6",
                RelativePosition7 => "R7",
                RelativePosition8 => "R8",
                RelativePosition9 => "R9",
                RelativePosition11 => "RA",
                RelativePosition12 => "RB",
                RelativePosition13 => "RC",
                RelativePosition14 => "RD",
                RelativePosition15 => "RE",
                RelativePosition16 => "RF",
                RelativePosition17 => "RG",
                RelativePosition18 => "RH",
                RelativePosition19 => "RI",
                RelativePosition20 => "RJ",
                RelativePosition21 => "RK",
                RelativePosition22 => "RL",
                RelativePosition23 => "RM",
                RelativePosition24 => "RN",
                RelativePosition25 => "RO",
                RelativePosition26 => "RP",
                RelativePosition27 => "RQ",
                RelativePosition28 => "RR",
                RelativePosition29 => "RS",
                RelativePosition30 => "RT",
                RelativePosition31 => "RU",
                RelativePosition32 => "RV",
                RelativePosition33 => "RW",
                RelativePosition34 => "RX",
                RelativePosition35 => "RY",
                RelativePosition36 => "RZ",
                RelativePosition37 => "S1",
                RelativePosition38 => "S2",
                RelativePosition39 => "S3",
                RelativePosition40 => "S4",
                RelativePosition41 => "S5",
                RelativePosition42 => "S6",
                RelativePosition43 => "S7",
                RelativePosition44 => "S8",
                RelativePosition45 => "S9",
                RelativePosition46 => "SA",
                Right => "SB",
                RelativePosition47 => "SC",
                RelativePosition48 => "SD",
                RelativePosition49 => "SE",
                RelativePosition50 => "SF",
                Stone => "SN",
                SpareTirePosition => "SP",
                RearSpare => "SS",
                Stucco => "ST",
                SubSea => "SU",
                TankBottom => "TB",
                Top => "TP",
                TwoSides => "TS",
                UnderCab => "UC",
                Unilateral => "UN",
                Upper => "UP",
                UpstreamTap => "UT",
                Wood => "WF",
            }
        }
    }
    pub fn from_code(code: &[u8]) -> Option<SurfaceLayerPositionCode> {
        use SurfaceLayerPositionCode::*;
        match code {
            b"1S" => Some(SideOne),
            b"2S" => Some(SideTwo),
            b"A1" => Some(Single),
            b"A2" => Some(LeftFront),
            b"A3" => Some(RightFront),
            b"A4" => Some(LeftRear),
            b"A5" => Some(RightRear),
            b"A6" => Some(InsideLeftRear),
            b"A7" => Some(OutsideLeftRear),
            b"A8" => Some(InsideRightRear),
            b"A9" => Some(OutsideRightRear),
            b"AL" => Some(All),
            b"AO" => Some(SingleEndOverhang),
            b"AS" => Some(Siding),
            b"B1" => Some(Bolster),
            b"BC" => Some(BackOfCab),
            b"BI" => Some(Bilateral),
            b"BK" => Some(Rear),
            b"BL" => Some(Block),
            b"BR" => Some(Brick),
            b"BS" => Some(BothSides),
            b"BT" => Some(Bottom),
            b"CH" => Some(CasingHeadFlange),
            b"CT" => Some(Center),
            b"DO" => Some(DoubleEndOverhang),
            b"DT" => Some(DownstreamTap),
            b"DU" => Some(DualFuelTankPosition),
            b"EX" => Some(Exterior),
            b"FR" => Some(Front),
            b"FS" => Some(FrontSpare),
            b"GF" => Some(RigFloor),
            b"IN" => Some(Inside),
            b"IT" => Some(Interior),
            b"KB" => Some(KellyBushing),
            b"LC" => Some(LessCriticalSurface),
            b"LO" => Some(Lower),
            b"LT" => Some(Left),
            b"M1" => Some(Multiple),
            b"MC" => Some(MoreCriticalSurface),
            b"MD" => Some(Middle),
            b"NS" => Some(NotSpecified),
            b"NT" => Some(NextRelativePosition),
            b"OA" => Some(Overall),
            b"OS" => Some(OneSide),
            b"OT" => Some(Outside),
            b"R0" => Some(RelativePosition10),
            b"R1" => Some(RelativePosition1),
            b"R2" => Some(RelativePosition2),
            b"R3" => Some(RelativePosition3),
            b"R4" => Some(RelativePosition4),
            b"R5" => Some(RelativePosition5),
            b"R6" => Some(RelativePosition6),
            b"R7" => Some(RelativePosition7),
            b"R8" => Some(RelativePosition8),
            b"R9" => Some(RelativePosition9),
            b"RA" => Some(RelativePosition11),
            b"RB" => Some(RelativePosition12),
            b"RC" => Some(RelativePosition13),
            b"RD" => Some(RelativePosition14),
            b"RE" => Some(RelativePosition15),
            b"RF" => Some(RelativePosition16),
            b"RG" => Some(RelativePosition17),
            b"RH" => Some(RelativePosition18),
            b"RI" => Some(RelativePosition19),
            b"RJ" => Some(RelativePosition20),
            b"RK" => Some(RelativePosition21),
            b"RL" => Some(RelativePosition22),
            b"RM" => Some(RelativePosition23),
            b"RN" => Some(RelativePosition24),
            b"RO" => Some(RelativePosition25),
            b"RP" => Some(RelativePosition26),
            b"RQ" => Some(RelativePosition27),
            b"RR" => Some(RelativePosition28),
            b"RS" => Some(RelativePosition29),
            b"RT" => Some(RelativePosition30),
            b"RU" => Some(RelativePosition31),
            b"RV" => Some(RelativePosition32),
            b"RW" => Some(RelativePosition33),
            b"RX" => Some(RelativePosition34),
            b"RY" => Some(RelativePosition35),
            b"RZ" => Some(RelativePosition36),
            b"S1" => Some(RelativePosition37),
            b"S2" => Some(RelativePosition38),
            b"S3" => Some(RelativePosition39),
            b"S4" => Some(RelativePosition40),
            b"S5" => Some(RelativePosition41),
            b"S6" => Some(RelativePosition42),
            b"S7" => Some(RelativePosition43),
            b"S8" => Some(RelativePosition44),
            b"S9" => Some(RelativePosition45),
            b"SA" => Some(RelativePosition46),
            b"SB" => Some(Right),
            b"SC" => Some(RelativePosition47),
            b"SD" => Some(RelativePosition48),
            b"SE" => Some(RelativePosition49),
            b"SF" => Some(RelativePosition50),
            b"SN" => Some(Stone),
            b"SP" => Some(SpareTirePosition),
            b"SS" => Some(RearSpare),
            b"ST" => Some(Stucco),
            b"SU" => Some(SubSea),
            b"TB" => Some(TankBottom),
            b"TP" => Some(Top),
            b"TS" => Some(TwoSides),
            b"UC" => Some(UnderCab),
            b"UN" => Some(Unilateral),
            b"UP" => Some(Upper),
            b"UT" => Some(UpstreamTap),
            b"WF" => Some(Wood),
            _ => None,
        }
    }
    fn description(&self) -> &str {
        use SurfaceLayerPositionCode::*;
        match self {
            SideOne => "Side One",
            SideTwo => "Side Two",
            Single => "Single",
            LeftFront => "Left Front",
            RightFront => "Right Front",
            LeftRear => "Left Rear",
            RightRear => "Right Rear",
            InsideLeftRear => "Inside Left Rear",
            OutsideLeftRear => "Outside Left Rear",
            InsideRightRear => "Inside Right Rear",
            OutsideRightRear => "Outside Right Rear",
            All => "All",
            SingleEndOverhang => "Single End Overhang",
            Siding => "Siding",
            Bolster => "Bolster",
            BackOfCab => "Back of Cab",
            Bilateral => "Bilateral",
            Rear => "Rear",
            Block => "Block",
            Brick => "Brick",
            BothSides => "Both Sides",
            Bottom => "Bottom",
            CasingHeadFlange => "Casing Head Flange",
            Center => "Center",
            DoubleEndOverhang => "Double End Overhang",
            DownstreamTap => "Downstream Tap",
            DualFuelTankPosition => "Dual Fuel Tank Position",
            Exterior => "Exterior",
            Front => "Front",
            FrontSpare => "Front Spare",
            RigFloor => "Rig Floor",
            Inside => "Inside",
            Interior => "Interior",
            KellyBushing => "Kelly Bushing",
            LessCriticalSurface => "Less Critical Surface",
            Lower => "Lower",
            Left => "Left",
            Multiple => "Multiple",
            MoreCriticalSurface => "More Critical Surface",
            Middle => "Middle",
            NotSpecified => "Not Specified",
            NextRelativePosition => "Next Relative Position",
            Overall => "Overall",
            OneSide => "One Side",
            Outside => "Outside",
            RelativePosition10 => "Relative Position 10",
            RelativePosition1 => "Relative Position 1",
            RelativePosition2 => "Relative Position 2",
            RelativePosition3 => "Relative Position 3",
            RelativePosition4 => "Relative Position 4",
            RelativePosition5 => "Relative Position 5",
            RelativePosition6 => "Relative Position 6",
            RelativePosition7 => "Relative Position 7",
            RelativePosition8 => "Relative Position 8",
            RelativePosition9 => "Relative Position 9",
            RelativePosition11 => "Relative Position 11",
            RelativePosition12 => "Relative Position 12",
            RelativePosition13 => "Relative Position 13",
            RelativePosition14 => "Relative Position 14",
            RelativePosition15 => "Relative Position 15",
            RelativePosition16 => "Relative Position 16",
            RelativePosition17 => "Relative Position 17",
            RelativePosition18 => "Relative Position 18",
            RelativePosition19 => "Relative Position 19",
            RelativePosition20 => "Relative Position 20",
            RelativePosition21 => "Relative Position 21",
            RelativePosition22 => "Relative Position 22",
            RelativePosition23 => "Relative Position 23",
            RelativePosition24 => "Relative Position 24",
            RelativePosition25 => "Relative Position 25",
            RelativePosition26 => "Relative Position 26",
            RelativePosition27 => "Relative Position 27",
            RelativePosition28 => "Relative Position 28",
            RelativePosition29 => "Relative Position 29",
            RelativePosition30 => "Relative Position 30",
            RelativePosition31 => "Relative Position 31",
            RelativePosition32 => "Relative Position 32",
            RelativePosition33 => "Relative Position 33",
            RelativePosition34 => "Relative Position 34",
            RelativePosition35 => "Relative Position 35",
            RelativePosition36 => "Relative Position 36",
            RelativePosition37 => "Relative Position 37",
            RelativePosition38 => "Relative Position 38",
            RelativePosition39 => "Relative Position 39",
            RelativePosition40 => "Relative Position 40",
            RelativePosition41 => "Relative Position 41",
            RelativePosition42 => "Relative Position 42",
            RelativePosition43 => "Relative Position 43",
            RelativePosition44 => "Relative Position 44",
            RelativePosition45 => "Relative Position 45",
            RelativePosition46 => "Relative Position 46",
            Right => "Right",
            RelativePosition47 => "Relative Position 47",
            RelativePosition48 => "Relative Position 48",
            RelativePosition49 => "Relative Position 49",
            RelativePosition50 => "Relative Position 50",
            Stone => "Stone",
            SpareTirePosition => "Spare Tire Position",
            RearSpare => "Rear Spare",
            Stucco => "Stucco",
            SubSea => "Sub-sea",
            TankBottom => "Tank Bottom",
            Top => "Top",
            TwoSides => "Two Sides",
            UnderCab => "Under Cab",
            Unilateral => "Unilateral",
            Upper => "Upper",
            UpstreamTap => "Upstream Tap",
            Wood => "Wood",
        }
    }
    fn from_description(description: &str) -> Option<SurfaceLayerPositionCode> {
        {
            use SurfaceLayerPositionCode::*;
            match description {
                "Side One" => Some(SideOne),
                "Side Two" => Some(SideTwo),
                "Single" => Some(Single),
                "Left Front" => Some(LeftFront),
                "Right Front" => Some(RightFront),
                "Left Rear" => Some(LeftRear),
                "Right Rear" => Some(RightRear),
                "Inside Left Rear" => Some(InsideLeftRear),
                "Outside Left Rear" => Some(OutsideLeftRear),
                "Inside Right Rear" => Some(InsideRightRear),
                "Outside Right Rear" => Some(OutsideRightRear),
                "All" => Some(All),
                "Single End Overhang" => Some(SingleEndOverhang),
                "Siding" => Some(Siding),
                "Bolster" => Some(Bolster),
                "Back of Cab" => Some(BackOfCab),
                "Bilateral" => Some(Bilateral),
                "Rear" => Some(Rear),
                "Block" => Some(Block),
                "Brick" => Some(Brick),
                "Both Sides" => Some(BothSides),
                "Bottom" => Some(Bottom),
                "Casing Head Flange" => Some(CasingHeadFlange),
                "Center" => Some(Center),
                "Double End Overhang" => Some(DoubleEndOverhang),
                "Downstream Tap" => Some(DownstreamTap),
                "Dual Fuel Tank Position" => Some(DualFuelTankPosition),
                "Exterior" => Some(Exterior),
                "Front" => Some(Front),
                "Front Spare" => Some(FrontSpare),
                "Rig Floor" => Some(RigFloor),
                "Inside" => Some(Inside),
                "Interior" => Some(Interior),
                "Kelly Bushing" => Some(KellyBushing),
                "Less Critical Surface" => Some(LessCriticalSurface),
                "Lower" => Some(Lower),
                "Left" => Some(Left),
                "Multiple" => Some(Multiple),
                "More Critical Surface" => Some(MoreCriticalSurface),
                "Middle" => Some(Middle),
                "Not Specified" => Some(NotSpecified),
                "Next Relative Position" => Some(NextRelativePosition),
                "Overall" => Some(Overall),
                "One Side" => Some(OneSide),
                "Outside" => Some(Outside),
                "Relative Position 10" => Some(RelativePosition10),
                "Relative Position 1" => Some(RelativePosition1),
                "Relative Position 2" => Some(RelativePosition2),
                "Relative Position 3" => Some(RelativePosition3),
                "Relative Position 4" => Some(RelativePosition4),
                "Relative Position 5" => Some(RelativePosition5),
                "Relative Position 6" => Some(RelativePosition6),
                "Relative Position 7" => Some(RelativePosition7),
                "Relative Position 8" => Some(RelativePosition8),
                "Relative Position 9" => Some(RelativePosition9),
                "Relative Position 11" => Some(RelativePosition11),
                "Relative Position 12" => Some(RelativePosition12),
                "Relative Position 13" => Some(RelativePosition13),
                "Relative Position 14" => Some(RelativePosition14),
                "Relative Position 15" => Some(RelativePosition15),
                "Relative Position 16" => Some(RelativePosition16),
                "Relative Position 17" => Some(RelativePosition17),
                "Relative Position 18" => Some(RelativePosition18),
                "Relative Position 19" => Some(RelativePosition19),
                "Relative Position 20" => Some(RelativePosition20),
                "Relative Position 21" => Some(RelativePosition21),
                "Relative Position 22" => Some(RelativePosition22),
                "Relative Position 23" => Some(RelativePosition23),
                "Relative Position 24" => Some(RelativePosition24),
                "Relative Position 25" => Some(RelativePosition25),
                "Relative Position 26" => Some(RelativePosition26),
                "Relative Position 27" => Some(RelativePosition27),
                "Relative Position 28" => Some(RelativePosition28),
                "Relative Position 29" => Some(RelativePosition29),
                "Relative Position 30" => Some(RelativePosition30),
                "Relative Position 31" => Some(RelativePosition31),
                "Relative Position 32" => Some(RelativePosition32),
                "Relative Position 33" => Some(RelativePosition33),
                "Relative Position 34" => Some(RelativePosition34),
                "Relative Position 35" => Some(RelativePosition35),
                "Relative Position 36" => Some(RelativePosition36),
                "Relative Position 37" => Some(RelativePosition37),
                "Relative Position 38" => Some(RelativePosition38),
                "Relative Position 39" => Some(RelativePosition39),
                "Relative Position 40" => Some(RelativePosition40),
                "Relative Position 41" => Some(RelativePosition41),
                "Relative Position 42" => Some(RelativePosition42),
                "Relative Position 43" => Some(RelativePosition43),
                "Relative Position 44" => Some(RelativePosition44),
                "Relative Position 45" => Some(RelativePosition45),
                "Relative Position 46" => Some(RelativePosition46),
                "Right" => Some(Right),
                "Relative Position 47" => Some(RelativePosition47),
                "Relative Position 48" => Some(RelativePosition48),
                "Relative Position 49" => Some(RelativePosition49),
                "Relative Position 50" => Some(RelativePosition50),
                "Stone" => Some(Stone),
                "Spare Tire Position" => Some(SpareTirePosition),
                "Rear Spare" => Some(RearSpare),
                "Stucco" => Some(Stucco),
                "Sub-sea" => Some(SubSea),
                "Tank Bottom" => Some(TankBottom),
                "Top" => Some(Top),
                "Two Sides" => Some(TwoSides),
                "Under Cab" => Some(UnderCab),
                "Unilateral" => Some(Unilateral),
                "Upper" => Some(Upper),
                "Upstream Tap" => Some(UpstreamTap),
                "Wood" => Some(Wood),
                _ => None,
            }
        }
    }
}
impl Serialize for SurfaceLayerPositionCode {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: ser::Serializer,
    {
        let value = if serializer.is_human_readable() {
            self.description()
        } else {
            self.code()
        };
        serializer.serialize_str(value)
    }
}
struct Visitor;
impl<'de> de::Visitor<'de> for Visitor {
    type Value = SurfaceLayerPositionCode;
    fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
        formatter.write_str("Surface/Layer/Position Code")
    }
    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
    where
        E: de::Error,
    {
        SurfaceLayerPositionCode::from_description(v)
            .ok_or_else(|| E::custom(
                format!("Invalid Surface/Layer/Position Code: {}", v),
            ))
    }
    fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E>
    where
        E: de::Error,
    {
        SurfaceLayerPositionCode::from_code(v)
            .ok_or_else(|| E::custom(
                format!(
                    "Invalid Surface/Layer/Position Code: {}", std::str::from_utf8(v)
                    .unwrap()
                ),
            ))
    }
}
impl<'de> Deserialize<'de> for SurfaceLayerPositionCode {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: de::Deserializer<'de>,
    {
        if deserializer.is_human_readable() {
            deserializer.deserialize_str(Visitor)
        } else {
            deserializer.deserialize_bytes(Visitor)
        }
    }
}