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
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
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
use std::fmt;
use serde::{de, Deserialize, ser, Serialize};
/**735

See docs at <https://www.stedi.com/edi/x12/element/735>*/
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum HierarchicalLevelCode {
    ///0 - Region
    Region,
    ///1 - Service/Billing Provider
    ServiceBillingProvider,
    ///2 - Billing Arrangement
    BillingArrangement,
    ///2A - Branch
    Branch,
    ///2B - Direct Affiliate
    DirectAffiliate,
    ///2C - Director
    Director,
    ///2D - Headquarters
    Headquarters,
    ///2E - Indirect Affiliate
    IndirectAffiliate,
    ///2F - Management Antecedents
    ManagementAntecedents,
    ///2G - Management or Principal
    ManagementOrPrincipal,
    ///2H - Parent Company
    ParentCompany,
    ///2I - Stockholder
    Stockholder,
    ///2J - Subsidiary
    Subsidiary,
    ///2K - Ultimate Domestic Parent Company
    UltimateDomesticParentCompany,
    ///2L - Ultimate Parent Company
    UltimateParentCompany,
    ///3 - Sub-Billing Arrangement
    SubBillingArrangement,
    ///4 - Group
    Group,
    ///5 - Category
    Category,
    ///6 - Sub-Category
    SubCategory,
    ///7 - Type
    Type,
    ///8 - Charge Detail
    ChargeDetail,
    ///9 - Line Detail
    LineDetail,
    ///19 - Provider of Service
    ProviderOfService,
    ///20 - Information Source
    InformationSource,
    ///21 - Information Receiver
    InformationReceiver,
    ///22 - Subscriber
    Subscriber,
    ///23 - Dependent
    Dependent,
    ///24 - Supergroup
    Supergroup,
    ///25 - Subgroup
    Subgroup,
    ///26 - Member
    Member,
    ///27 - Ancillary Facility or Department
    AncillaryFacilityOrDepartment,
    ///28 - Hospital
    Hospital,
    ///29 - Franchisor
    Franchisor,
    ///30 - Franchisee
    Franchisee,
    ///31 - Franchisee Association
    FranchiseeAssociation,
    ///32 - Health Industry Business Communications Council (HIBCC) Health Industry Number (HIN) Database
    Code32,
    ///33 - Activity
    Activity,
    ///34 - Location Record
    LocationRecord,
    ///35 - Company/Corporation
    CompanyCorporation,
    ///36 - Operating Unit
    OperatingUnit,
    ///37 - Property
    Property,
    ///38 - Tradename
    Tradename,
    ///39 - Accountant
    Accountant,
    ///40 - Financial Institution
    FinancialInstitution,
    ///41 - Product Level
    ProductLevel,
    ///42 - Activity Details
    ActivityDetails,
    ///43 - Payment Summary Score
    PaymentSummaryScore,
    ///44 - Corporate Registration Filings
    CorporateRegistrationFilings,
    ///45 - Bankruptcy Details
    BankruptcyDetails,
    ///46 - Company History
    CompanyHistory,
    ///47 - Complete Financial History
    CompleteFinancialHistory,
    ///48 - Balance Sheet
    BalanceSheet,
    ///49 - Comparative Figures
    ComparativeFigures,
    ///50 - Payment Analysis
    PaymentAnalysis,
    ///51 - Special Notification
    SpecialNotification,
    ///52 - Public Record Financing Details
    PublicRecordFinancingDetails,
    ///53 - Public Record Financing Summary
    PublicRecordFinancingSummary,
    ///54 - Public Record Claim Details
    PublicRecordClaimDetails,
    ///55 - Public Record Claim Summary
    PublicRecordClaimSummary,
    ///56 - Statement of Work
    StatementOfWork,
    ///57 - Legal Action Details
    LegalActionDetails,
    ///58 - Legal Action Summary
    LegalActionSummary,
    ///59 - Company Evaluation
    CompanyEvaluation,
    ///60 - Company Summary
    CompanySummary,
    ///61 - Credit Scores
    CreditScores,
    ///62 - Industry Averages
    IndustryAverages,
    ///63 - Referring Provider
    ReferringProvider,
    ///64 - Employee
    Employee,
    ///65 - Insurance Policy
    InsurancePolicy,
    ///66 - Vehicle
    Vehicle,
    ///67 - Key Contributor
    KeyContributor,
    ///68 - Public Record Summary
    PublicRecordSummary,
    ///69 - Delinquency Projections
    DelinquencyProjections,
    ///70 - Temporary Services Detail
    TemporaryServicesDetail,
    ///71 - Overnight Shipping Detail
    OvernightShippingDetail,
    ///72 - Medical Supply Detail
    MedicalSupplyDetail,
    ///73 - Equipment Leasing Detail
    EquipmentLeasingDetail,
    ///A - Assembly
    Assembly,
    ///AA - Insurer
    Insurer,
    ///AB - Claim Administrator
    ClaimAdministrator,
    ///AC - Insured
    Insured,
    ///AD - Administrative Information
    Administrative,
    ///AE - Car Rental Detail
    CarRentalDetail,
    ///AF - Lodging Detail
    LodgingDetail,
    ///AG - Agent
    Agent,
    ///AH - Transportation Detail
    TransportationDetail,
    ///AI - Purchase Card Detail
    PurchaseCardDetail,
    ///AJ - Alternate Taxing Authority
    AlternateTaxingAuthority,
    ///AL - Alternate Specification - Lift Level
    AlternateSpecificationLiftLevel,
    ///AM - Amount Information
    Amount,
    ///AP - Credential Action
    CredentialAction,
    ///AS - Animal Subject Group
    AnimalSubjectGroup,
    ///AT - Account
    Account,
    ///B - Buyer's Location
    BuyersLocation,
    ///BD - Building
    Building,
    ///BE - Business Entity
    BusinessEntity,
    ///BP - Body Part
    BodyPart,
    ///BT - Batch
    Batch,
    ///C - Date
    Date,
    ///CB - Contractholder Branch Office
    ContractholderBranchOffice,
    ///CC - Cost Center
    CostCenter,
    ///CE - Cost Element
    CostElement,
    ///CH - Contractholder
    Contractholder,
    ///CI - Cause of Injury
    CauseOfInjury,
    ///CL - Claimant
    Claimant,
    ///CN - Container
    Container,
    ///CO - Consortium
    Consortium,
    ///CP - Client or Party
    ClientOrParty,
    ///CT - Cost Type
    CostType,
    ///CV - Coverage, Rider, or Supplementary Benefit
    CodeCV,
    ///D - Product Description
    ProductDescription,
    ///DG - Drawing
    Drawing,
    ///DM - Damage
    Damage,
    ///DP - Department
    Department,
    ///DS - District
    District,
    ///E - Transportation Equipment
    TransportationEquipment,
    ///EB - Filer
    Filer,
    ///EC - Receipts
    Receipts,
    ///ED - Engineering Data List
    EngineeringDataList,
    ///EF - Expenditures
    Expenditures,
    ///EG - Receivables
    Receivables,
    ///EH - Payables
    Payables,
    ///EI - Organizational Information
    Organizational,
    ///EL - Exhibit Line Item
    ExhibitLineItem,
    ///EM - Employer
    Employer,
    ///EN - End Item
    EndItem,
    ///EV - Event
    Event,
    ///EX - Exception
    Exception,
    ///F - Component
    Component,
    ///FC - Function Code
    FunctionCode,
    ///FG - Functional Group
    FunctionalGroup,
    ///FI - Financial Information
    Financial,
    ///FL - Fleet
    Fleet,
    ///FR - Frame
    Frame,
    ///G - Quality Characteristics
    QualityCharacteristics,
    ///GC - Group Coverage Options
    GroupCoverageOptions,
    ///GP - Group Purchasing Organization
    GroupPurchasingOrganization,
    ///GW - Group Work Candidate
    GroupWorkCandidate,
    ///H - Bill of Materials
    BillOfMaterials,
    ///HE - EPA Waste Number Subsection
    EpaWasteNumberSubsection,
    ///HP - Waste Profile Sheet
    WasteProfileSheet,
    ///I - Item
    Item,
    ///IA - Subline Item
    SublineItem,
    ///IB - Contract
    Contract,
    ///IC - Contract Data Requirements List (CDRL)
    CodeIC,
    ///IN - Interchange
    Interchange,
    ///IS - Installments
    Installments,
    ///IT - Institution
    Institution,
    ///IV - Individual
    Individual,
    ///J - Part Characteristic
    PartCharacteristic,
    ///JU - Jurisdiction
    Jurisdiction,
    ///K - Kit
    Kit,
    ///KA - Accident History
    AccidentHistory,
    ///KB - Chemical
    Chemical,
    ///KC - Control Device
    ControlDevice,
    ///KD - Discharge
    Discharge,
    ///KE - Emergency Response Plan
    EmergencyResponsePlan,
    ///KF - Emission
    Emission,
    ///KG - Emission Activity
    EmissionActivity,
    ///KH - Emission Release Point
    EmissionReleasePoint,
    ///KI - Emission Unit
    EmissionUnit,
    ///KJ - Flammable Mixture
    FlammableMixture,
    ///KK - Flammables Alternate Release
    FlammablesAlternateRelease,
    ///KL - Flammables Worst Case
    FlammablesWorstCase,
    ///KM - Hazardous Waste Generation
    HazardousWasteGeneration,
    ///KN - Hazardous Waste Received
    HazardousWasteReceived,
    ///KO - Off-Site Process
    OffSiteProcess,
    ///KP - On-Site Process
    OnSiteProcess,
    ///KQ - Parameter
    Parameter,
    ///KR - Prevention Program
    PreventionProgram,
    ///KS - Process
    Process,
    ///KT - Reduction and Recycling
    ReductionAndRecycling,
    ///KV - Toxics Alternate Release
    ToxicsAlternateRelease,
    ///KW - Toxics Worst Case
    ToxicsWorstCase,
    ///KX - Transfer
    Transfer,
    ///L - Supplier's Location
    SuppliersLocation,
    ///LD - Lender or Mortgage Company
    LenderOrMortgageCompany,
    ///LN - Loan Data
    LoanData,
    ///LP - Party to the Loan
    PartyToTheLoan,
    ///M - Measurement
    Measurement,
    ///ML - Manufacturing Level
    ManufacturingLevel,
    ///N - Site of Service
    SiteOfService,
    ///NI - Nature of Injury
    NatureOfInjury,
    ///NS - National Stock Number
    NationalStockNumber,
    ///O - Order
    Order,
    ///OS - Support
    Support,
    ///P - Pack
    Pack,
    ///PA - Primary Administrator
    PrimaryAdministrator,
    ///PB - Personal Property
    PersonalProperty,
    ///PC - Project Code
    ProjectCode,
    ///PD - Procedure
    Procedure,
    ///PE - Person
    Person,
    ///PH - Product Characteristic
    ProductCharacteristic,
    ///PI - Property Identification
    PropertyIdentification,
    ///PK - Property Tax
    PropertyTax,
    ///PL - Primary Specification - Lift Level
    PrimarySpecificationLiftLevel,
    ///PP - Related Parties
    RelatedParties,
    ///PR - Principal
    Principal,
    ///PS - Property Segment Group
    PropertySegmentGroup,
    ///PT - Patient
    Patient,
    ///PY - Payment Detail
    PaymentDetail,
    ///Q - Subpack
    Subpack,
    ///R - Quantity
    Quantity,
    ///RA - Reporting Agency
    ReportingAgency,
    ///RB - Response
    Response,
    ///RC - Response Details
    ResponseDetails,
    ///RD - Response Sub-details
    ResponseSubDetails,
    ///RE - Response Particular
    ResponseParticular,
    ///RF - Medication
    Medication,
    ///RG - Recommendation
    Recommendation,
    ///RH - Review History
    ReviewHistory,
    ///RL - Reference Location
    ReferenceLocation,
    ///RM - Room
    Room,
    ///RP - Report
    Report,
    ///S - Shipment
    Shipment,
    ///S1 - Site
    Site,
    ///S2 - Sample
    Sample,
    ///S3 - Test
    Test,
    ///SA - Secondary Administrator
    SecondaryAdministrator,
    ///SB - Substitute
    Substitute,
    ///SC - Subcontract Line Item
    SubcontractLineItem,
    ///SD - Support Document
    SupportDocument,
    ///SE - Subexhibit Line Item
    SubexhibitLineItem,
    ///SF - Safety Fitness
    SafetyFitness,
    ///SG - Safety Factor
    SafetyFactor,
    ///SH - Sheet
    Sheet,
    ///SI - Source of Injury
    SourceOfInjury,
    ///SL - Solicitation
    Solicitation,
    ///SP - Sub-Project
    SubProject,
    ///SR - Subroom
    Subroom,
    ///SS - Services
    Services,
    ///ST - State
    State,
    ///SY - System
    System,
    ///T - Shipping Tare
    ShippingTare,
    ///TA - Taxing Authority
    TaxingAuthority,
    ///TD - Tax Delinquency
    TaxDelinquency,
    ///TI - Technical Information Package
    TechnicalInformationPackage,
    ///TS - Transaction Set
    TransactionSet,
    ///TU - Traffic Unit
    TrafficUnit,
    ///TX - Tax Installment
    TaxInstallment,
    ///U - Subassembly
    Subassembly,
    ///UT - Unit or Lot
    UnitOrLot,
    ///V - Address Information
    Address,
    ///VI - Violation
    Violation,
    ///W - Transaction Reference Number
    TransactionReferenceNumber,
    ///WB - Work Breakdown Structure
    WorkBreakdownStructure,
    ///WC - Work Candidate
    WorkCandidate,
    ///WL - Well
    Well,
    ///WP - Well Completion
    WellCompletion,
    ///WR - Wellbore
    Wellbore,
    ///X - Serial Number
    SerialNumber,
    ///Y - Suffix
    Suffix,
    ///Z - Guarantor
    Guarantor,
    ///ZZ - Mutually Defined
    MutuallyDefined,
}
impl HierarchicalLevelCode {
    pub fn code(&self) -> &str {
        {
            use HierarchicalLevelCode::*;
            match self {
                Region => "0",
                ServiceBillingProvider => "1",
                BillingArrangement => "2",
                Branch => "2A",
                DirectAffiliate => "2B",
                Director => "2C",
                Headquarters => "2D",
                IndirectAffiliate => "2E",
                ManagementAntecedents => "2F",
                ManagementOrPrincipal => "2G",
                ParentCompany => "2H",
                Stockholder => "2I",
                Subsidiary => "2J",
                UltimateDomesticParentCompany => "2K",
                UltimateParentCompany => "2L",
                SubBillingArrangement => "3",
                Group => "4",
                Category => "5",
                SubCategory => "6",
                Type => "7",
                ChargeDetail => "8",
                LineDetail => "9",
                ProviderOfService => "19",
                InformationSource => "20",
                InformationReceiver => "21",
                Subscriber => "22",
                Dependent => "23",
                Supergroup => "24",
                Subgroup => "25",
                Member => "26",
                AncillaryFacilityOrDepartment => "27",
                Hospital => "28",
                Franchisor => "29",
                Franchisee => "30",
                FranchiseeAssociation => "31",
                Code32 => "32",
                Activity => "33",
                LocationRecord => "34",
                CompanyCorporation => "35",
                OperatingUnit => "36",
                Property => "37",
                Tradename => "38",
                Accountant => "39",
                FinancialInstitution => "40",
                ProductLevel => "41",
                ActivityDetails => "42",
                PaymentSummaryScore => "43",
                CorporateRegistrationFilings => "44",
                BankruptcyDetails => "45",
                CompanyHistory => "46",
                CompleteFinancialHistory => "47",
                BalanceSheet => "48",
                ComparativeFigures => "49",
                PaymentAnalysis => "50",
                SpecialNotification => "51",
                PublicRecordFinancingDetails => "52",
                PublicRecordFinancingSummary => "53",
                PublicRecordClaimDetails => "54",
                PublicRecordClaimSummary => "55",
                StatementOfWork => "56",
                LegalActionDetails => "57",
                LegalActionSummary => "58",
                CompanyEvaluation => "59",
                CompanySummary => "60",
                CreditScores => "61",
                IndustryAverages => "62",
                ReferringProvider => "63",
                Employee => "64",
                InsurancePolicy => "65",
                Vehicle => "66",
                KeyContributor => "67",
                PublicRecordSummary => "68",
                DelinquencyProjections => "69",
                TemporaryServicesDetail => "70",
                OvernightShippingDetail => "71",
                MedicalSupplyDetail => "72",
                EquipmentLeasingDetail => "73",
                Assembly => "A",
                Insurer => "AA",
                ClaimAdministrator => "AB",
                Insured => "AC",
                Administrative => "AD",
                CarRentalDetail => "AE",
                LodgingDetail => "AF",
                Agent => "AG",
                TransportationDetail => "AH",
                PurchaseCardDetail => "AI",
                AlternateTaxingAuthority => "AJ",
                AlternateSpecificationLiftLevel => "AL",
                Amount => "AM",
                CredentialAction => "AP",
                AnimalSubjectGroup => "AS",
                Account => "AT",
                BuyersLocation => "B",
                Building => "BD",
                BusinessEntity => "BE",
                BodyPart => "BP",
                Batch => "BT",
                Date => "C",
                ContractholderBranchOffice => "CB",
                CostCenter => "CC",
                CostElement => "CE",
                Contractholder => "CH",
                CauseOfInjury => "CI",
                Claimant => "CL",
                Container => "CN",
                Consortium => "CO",
                ClientOrParty => "CP",
                CostType => "CT",
                CodeCV => "CV",
                ProductDescription => "D",
                Drawing => "DG",
                Damage => "DM",
                Department => "DP",
                District => "DS",
                TransportationEquipment => "E",
                Filer => "EB",
                Receipts => "EC",
                EngineeringDataList => "ED",
                Expenditures => "EF",
                Receivables => "EG",
                Payables => "EH",
                Organizational => "EI",
                ExhibitLineItem => "EL",
                Employer => "EM",
                EndItem => "EN",
                Event => "EV",
                Exception => "EX",
                Component => "F",
                FunctionCode => "FC",
                FunctionalGroup => "FG",
                Financial => "FI",
                Fleet => "FL",
                Frame => "FR",
                QualityCharacteristics => "G",
                GroupCoverageOptions => "GC",
                GroupPurchasingOrganization => "GP",
                GroupWorkCandidate => "GW",
                BillOfMaterials => "H",
                EpaWasteNumberSubsection => "HE",
                WasteProfileSheet => "HP",
                Item => "I",
                SublineItem => "IA",
                Contract => "IB",
                CodeIC => "IC",
                Interchange => "IN",
                Installments => "IS",
                Institution => "IT",
                Individual => "IV",
                PartCharacteristic => "J",
                Jurisdiction => "JU",
                Kit => "K",
                AccidentHistory => "KA",
                Chemical => "KB",
                ControlDevice => "KC",
                Discharge => "KD",
                EmergencyResponsePlan => "KE",
                Emission => "KF",
                EmissionActivity => "KG",
                EmissionReleasePoint => "KH",
                EmissionUnit => "KI",
                FlammableMixture => "KJ",
                FlammablesAlternateRelease => "KK",
                FlammablesWorstCase => "KL",
                HazardousWasteGeneration => "KM",
                HazardousWasteReceived => "KN",
                OffSiteProcess => "KO",
                OnSiteProcess => "KP",
                Parameter => "KQ",
                PreventionProgram => "KR",
                Process => "KS",
                ReductionAndRecycling => "KT",
                ToxicsAlternateRelease => "KV",
                ToxicsWorstCase => "KW",
                Transfer => "KX",
                SuppliersLocation => "L",
                LenderOrMortgageCompany => "LD",
                LoanData => "LN",
                PartyToTheLoan => "LP",
                Measurement => "M",
                ManufacturingLevel => "ML",
                SiteOfService => "N",
                NatureOfInjury => "NI",
                NationalStockNumber => "NS",
                Order => "O",
                Support => "OS",
                Pack => "P",
                PrimaryAdministrator => "PA",
                PersonalProperty => "PB",
                ProjectCode => "PC",
                Procedure => "PD",
                Person => "PE",
                ProductCharacteristic => "PH",
                PropertyIdentification => "PI",
                PropertyTax => "PK",
                PrimarySpecificationLiftLevel => "PL",
                RelatedParties => "PP",
                Principal => "PR",
                PropertySegmentGroup => "PS",
                Patient => "PT",
                PaymentDetail => "PY",
                Subpack => "Q",
                Quantity => "R",
                ReportingAgency => "RA",
                Response => "RB",
                ResponseDetails => "RC",
                ResponseSubDetails => "RD",
                ResponseParticular => "RE",
                Medication => "RF",
                Recommendation => "RG",
                ReviewHistory => "RH",
                ReferenceLocation => "RL",
                Room => "RM",
                Report => "RP",
                Shipment => "S",
                Site => "S1",
                Sample => "S2",
                Test => "S3",
                SecondaryAdministrator => "SA",
                Substitute => "SB",
                SubcontractLineItem => "SC",
                SupportDocument => "SD",
                SubexhibitLineItem => "SE",
                SafetyFitness => "SF",
                SafetyFactor => "SG",
                Sheet => "SH",
                SourceOfInjury => "SI",
                Solicitation => "SL",
                SubProject => "SP",
                Subroom => "SR",
                Services => "SS",
                State => "ST",
                System => "SY",
                ShippingTare => "T",
                TaxingAuthority => "TA",
                TaxDelinquency => "TD",
                TechnicalInformationPackage => "TI",
                TransactionSet => "TS",
                TrafficUnit => "TU",
                TaxInstallment => "TX",
                Subassembly => "U",
                UnitOrLot => "UT",
                Address => "V",
                Violation => "VI",
                TransactionReferenceNumber => "W",
                WorkBreakdownStructure => "WB",
                WorkCandidate => "WC",
                Well => "WL",
                WellCompletion => "WP",
                Wellbore => "WR",
                SerialNumber => "X",
                Suffix => "Y",
                Guarantor => "Z",
                MutuallyDefined => "ZZ",
            }
        }
    }
    pub fn from_code(code: &[u8]) -> Option<HierarchicalLevelCode> {
        use HierarchicalLevelCode::*;
        match code {
            b"0" => Some(Region),
            b"1" => Some(ServiceBillingProvider),
            b"2" => Some(BillingArrangement),
            b"2A" => Some(Branch),
            b"2B" => Some(DirectAffiliate),
            b"2C" => Some(Director),
            b"2D" => Some(Headquarters),
            b"2E" => Some(IndirectAffiliate),
            b"2F" => Some(ManagementAntecedents),
            b"2G" => Some(ManagementOrPrincipal),
            b"2H" => Some(ParentCompany),
            b"2I" => Some(Stockholder),
            b"2J" => Some(Subsidiary),
            b"2K" => Some(UltimateDomesticParentCompany),
            b"2L" => Some(UltimateParentCompany),
            b"3" => Some(SubBillingArrangement),
            b"4" => Some(Group),
            b"5" => Some(Category),
            b"6" => Some(SubCategory),
            b"7" => Some(Type),
            b"8" => Some(ChargeDetail),
            b"9" => Some(LineDetail),
            b"19" => Some(ProviderOfService),
            b"20" => Some(InformationSource),
            b"21" => Some(InformationReceiver),
            b"22" => Some(Subscriber),
            b"23" => Some(Dependent),
            b"24" => Some(Supergroup),
            b"25" => Some(Subgroup),
            b"26" => Some(Member),
            b"27" => Some(AncillaryFacilityOrDepartment),
            b"28" => Some(Hospital),
            b"29" => Some(Franchisor),
            b"30" => Some(Franchisee),
            b"31" => Some(FranchiseeAssociation),
            b"32" => Some(Code32),
            b"33" => Some(Activity),
            b"34" => Some(LocationRecord),
            b"35" => Some(CompanyCorporation),
            b"36" => Some(OperatingUnit),
            b"37" => Some(Property),
            b"38" => Some(Tradename),
            b"39" => Some(Accountant),
            b"40" => Some(FinancialInstitution),
            b"41" => Some(ProductLevel),
            b"42" => Some(ActivityDetails),
            b"43" => Some(PaymentSummaryScore),
            b"44" => Some(CorporateRegistrationFilings),
            b"45" => Some(BankruptcyDetails),
            b"46" => Some(CompanyHistory),
            b"47" => Some(CompleteFinancialHistory),
            b"48" => Some(BalanceSheet),
            b"49" => Some(ComparativeFigures),
            b"50" => Some(PaymentAnalysis),
            b"51" => Some(SpecialNotification),
            b"52" => Some(PublicRecordFinancingDetails),
            b"53" => Some(PublicRecordFinancingSummary),
            b"54" => Some(PublicRecordClaimDetails),
            b"55" => Some(PublicRecordClaimSummary),
            b"56" => Some(StatementOfWork),
            b"57" => Some(LegalActionDetails),
            b"58" => Some(LegalActionSummary),
            b"59" => Some(CompanyEvaluation),
            b"60" => Some(CompanySummary),
            b"61" => Some(CreditScores),
            b"62" => Some(IndustryAverages),
            b"63" => Some(ReferringProvider),
            b"64" => Some(Employee),
            b"65" => Some(InsurancePolicy),
            b"66" => Some(Vehicle),
            b"67" => Some(KeyContributor),
            b"68" => Some(PublicRecordSummary),
            b"69" => Some(DelinquencyProjections),
            b"70" => Some(TemporaryServicesDetail),
            b"71" => Some(OvernightShippingDetail),
            b"72" => Some(MedicalSupplyDetail),
            b"73" => Some(EquipmentLeasingDetail),
            b"A" => Some(Assembly),
            b"AA" => Some(Insurer),
            b"AB" => Some(ClaimAdministrator),
            b"AC" => Some(Insured),
            b"AD" => Some(Administrative),
            b"AE" => Some(CarRentalDetail),
            b"AF" => Some(LodgingDetail),
            b"AG" => Some(Agent),
            b"AH" => Some(TransportationDetail),
            b"AI" => Some(PurchaseCardDetail),
            b"AJ" => Some(AlternateTaxingAuthority),
            b"AL" => Some(AlternateSpecificationLiftLevel),
            b"AM" => Some(Amount),
            b"AP" => Some(CredentialAction),
            b"AS" => Some(AnimalSubjectGroup),
            b"AT" => Some(Account),
            b"B" => Some(BuyersLocation),
            b"BD" => Some(Building),
            b"BE" => Some(BusinessEntity),
            b"BP" => Some(BodyPart),
            b"BT" => Some(Batch),
            b"C" => Some(Date),
            b"CB" => Some(ContractholderBranchOffice),
            b"CC" => Some(CostCenter),
            b"CE" => Some(CostElement),
            b"CH" => Some(Contractholder),
            b"CI" => Some(CauseOfInjury),
            b"CL" => Some(Claimant),
            b"CN" => Some(Container),
            b"CO" => Some(Consortium),
            b"CP" => Some(ClientOrParty),
            b"CT" => Some(CostType),
            b"CV" => Some(CodeCV),
            b"D" => Some(ProductDescription),
            b"DG" => Some(Drawing),
            b"DM" => Some(Damage),
            b"DP" => Some(Department),
            b"DS" => Some(District),
            b"E" => Some(TransportationEquipment),
            b"EB" => Some(Filer),
            b"EC" => Some(Receipts),
            b"ED" => Some(EngineeringDataList),
            b"EF" => Some(Expenditures),
            b"EG" => Some(Receivables),
            b"EH" => Some(Payables),
            b"EI" => Some(Organizational),
            b"EL" => Some(ExhibitLineItem),
            b"EM" => Some(Employer),
            b"EN" => Some(EndItem),
            b"EV" => Some(Event),
            b"EX" => Some(Exception),
            b"F" => Some(Component),
            b"FC" => Some(FunctionCode),
            b"FG" => Some(FunctionalGroup),
            b"FI" => Some(Financial),
            b"FL" => Some(Fleet),
            b"FR" => Some(Frame),
            b"G" => Some(QualityCharacteristics),
            b"GC" => Some(GroupCoverageOptions),
            b"GP" => Some(GroupPurchasingOrganization),
            b"GW" => Some(GroupWorkCandidate),
            b"H" => Some(BillOfMaterials),
            b"HE" => Some(EpaWasteNumberSubsection),
            b"HP" => Some(WasteProfileSheet),
            b"I" => Some(Item),
            b"IA" => Some(SublineItem),
            b"IB" => Some(Contract),
            b"IC" => Some(CodeIC),
            b"IN" => Some(Interchange),
            b"IS" => Some(Installments),
            b"IT" => Some(Institution),
            b"IV" => Some(Individual),
            b"J" => Some(PartCharacteristic),
            b"JU" => Some(Jurisdiction),
            b"K" => Some(Kit),
            b"KA" => Some(AccidentHistory),
            b"KB" => Some(Chemical),
            b"KC" => Some(ControlDevice),
            b"KD" => Some(Discharge),
            b"KE" => Some(EmergencyResponsePlan),
            b"KF" => Some(Emission),
            b"KG" => Some(EmissionActivity),
            b"KH" => Some(EmissionReleasePoint),
            b"KI" => Some(EmissionUnit),
            b"KJ" => Some(FlammableMixture),
            b"KK" => Some(FlammablesAlternateRelease),
            b"KL" => Some(FlammablesWorstCase),
            b"KM" => Some(HazardousWasteGeneration),
            b"KN" => Some(HazardousWasteReceived),
            b"KO" => Some(OffSiteProcess),
            b"KP" => Some(OnSiteProcess),
            b"KQ" => Some(Parameter),
            b"KR" => Some(PreventionProgram),
            b"KS" => Some(Process),
            b"KT" => Some(ReductionAndRecycling),
            b"KV" => Some(ToxicsAlternateRelease),
            b"KW" => Some(ToxicsWorstCase),
            b"KX" => Some(Transfer),
            b"L" => Some(SuppliersLocation),
            b"LD" => Some(LenderOrMortgageCompany),
            b"LN" => Some(LoanData),
            b"LP" => Some(PartyToTheLoan),
            b"M" => Some(Measurement),
            b"ML" => Some(ManufacturingLevel),
            b"N" => Some(SiteOfService),
            b"NI" => Some(NatureOfInjury),
            b"NS" => Some(NationalStockNumber),
            b"O" => Some(Order),
            b"OS" => Some(Support),
            b"P" => Some(Pack),
            b"PA" => Some(PrimaryAdministrator),
            b"PB" => Some(PersonalProperty),
            b"PC" => Some(ProjectCode),
            b"PD" => Some(Procedure),
            b"PE" => Some(Person),
            b"PH" => Some(ProductCharacteristic),
            b"PI" => Some(PropertyIdentification),
            b"PK" => Some(PropertyTax),
            b"PL" => Some(PrimarySpecificationLiftLevel),
            b"PP" => Some(RelatedParties),
            b"PR" => Some(Principal),
            b"PS" => Some(PropertySegmentGroup),
            b"PT" => Some(Patient),
            b"PY" => Some(PaymentDetail),
            b"Q" => Some(Subpack),
            b"R" => Some(Quantity),
            b"RA" => Some(ReportingAgency),
            b"RB" => Some(Response),
            b"RC" => Some(ResponseDetails),
            b"RD" => Some(ResponseSubDetails),
            b"RE" => Some(ResponseParticular),
            b"RF" => Some(Medication),
            b"RG" => Some(Recommendation),
            b"RH" => Some(ReviewHistory),
            b"RL" => Some(ReferenceLocation),
            b"RM" => Some(Room),
            b"RP" => Some(Report),
            b"S" => Some(Shipment),
            b"S1" => Some(Site),
            b"S2" => Some(Sample),
            b"S3" => Some(Test),
            b"SA" => Some(SecondaryAdministrator),
            b"SB" => Some(Substitute),
            b"SC" => Some(SubcontractLineItem),
            b"SD" => Some(SupportDocument),
            b"SE" => Some(SubexhibitLineItem),
            b"SF" => Some(SafetyFitness),
            b"SG" => Some(SafetyFactor),
            b"SH" => Some(Sheet),
            b"SI" => Some(SourceOfInjury),
            b"SL" => Some(Solicitation),
            b"SP" => Some(SubProject),
            b"SR" => Some(Subroom),
            b"SS" => Some(Services),
            b"ST" => Some(State),
            b"SY" => Some(System),
            b"T" => Some(ShippingTare),
            b"TA" => Some(TaxingAuthority),
            b"TD" => Some(TaxDelinquency),
            b"TI" => Some(TechnicalInformationPackage),
            b"TS" => Some(TransactionSet),
            b"TU" => Some(TrafficUnit),
            b"TX" => Some(TaxInstallment),
            b"U" => Some(Subassembly),
            b"UT" => Some(UnitOrLot),
            b"V" => Some(Address),
            b"VI" => Some(Violation),
            b"W" => Some(TransactionReferenceNumber),
            b"WB" => Some(WorkBreakdownStructure),
            b"WC" => Some(WorkCandidate),
            b"WL" => Some(Well),
            b"WP" => Some(WellCompletion),
            b"WR" => Some(Wellbore),
            b"X" => Some(SerialNumber),
            b"Y" => Some(Suffix),
            b"Z" => Some(Guarantor),
            b"ZZ" => Some(MutuallyDefined),
            _ => None,
        }
    }
    fn description(&self) -> &str {
        use HierarchicalLevelCode::*;
        match self {
            Region => "Region",
            ServiceBillingProvider => "Service/Billing Provider",
            BillingArrangement => "Billing Arrangement",
            Branch => "Branch",
            DirectAffiliate => "Direct Affiliate",
            Director => "Director",
            Headquarters => "Headquarters",
            IndirectAffiliate => "Indirect Affiliate",
            ManagementAntecedents => "Management Antecedents",
            ManagementOrPrincipal => "Management or Principal",
            ParentCompany => "Parent Company",
            Stockholder => "Stockholder",
            Subsidiary => "Subsidiary",
            UltimateDomesticParentCompany => "Ultimate Domestic Parent Company",
            UltimateParentCompany => "Ultimate Parent Company",
            SubBillingArrangement => "Sub-Billing Arrangement",
            Group => "Group",
            Category => "Category",
            SubCategory => "Sub-Category",
            Type => "Type",
            ChargeDetail => "Charge Detail",
            LineDetail => "Line Detail",
            ProviderOfService => "Provider of Service",
            InformationSource => "Information Source",
            InformationReceiver => "Information Receiver",
            Subscriber => "Subscriber",
            Dependent => "Dependent",
            Supergroup => "Supergroup",
            Subgroup => "Subgroup",
            Member => "Member",
            AncillaryFacilityOrDepartment => "Ancillary Facility or Department",
            Hospital => "Hospital",
            Franchisor => "Franchisor",
            Franchisee => "Franchisee",
            FranchiseeAssociation => "Franchisee Association",
            Code32 => {
                "Health Industry Business Communications Council (HIBCC) Health Industry Number (HIN) Database"
            }
            Activity => "Activity",
            LocationRecord => "Location Record",
            CompanyCorporation => "Company/Corporation",
            OperatingUnit => "Operating Unit",
            Property => "Property",
            Tradename => "Tradename",
            Accountant => "Accountant",
            FinancialInstitution => "Financial Institution",
            ProductLevel => "Product Level",
            ActivityDetails => "Activity Details",
            PaymentSummaryScore => "Payment Summary Score",
            CorporateRegistrationFilings => "Corporate Registration Filings",
            BankruptcyDetails => "Bankruptcy Details",
            CompanyHistory => "Company History",
            CompleteFinancialHistory => "Complete Financial History",
            BalanceSheet => "Balance Sheet",
            ComparativeFigures => "Comparative Figures",
            PaymentAnalysis => "Payment Analysis",
            SpecialNotification => "Special Notification",
            PublicRecordFinancingDetails => "Public Record Financing Details",
            PublicRecordFinancingSummary => "Public Record Financing Summary",
            PublicRecordClaimDetails => "Public Record Claim Details",
            PublicRecordClaimSummary => "Public Record Claim Summary",
            StatementOfWork => "Statement of Work",
            LegalActionDetails => "Legal Action Details",
            LegalActionSummary => "Legal Action Summary",
            CompanyEvaluation => "Company Evaluation",
            CompanySummary => "Company Summary",
            CreditScores => "Credit Scores",
            IndustryAverages => "Industry Averages",
            ReferringProvider => "Referring Provider",
            Employee => "Employee",
            InsurancePolicy => "Insurance Policy",
            Vehicle => "Vehicle",
            KeyContributor => "Key Contributor",
            PublicRecordSummary => "Public Record Summary",
            DelinquencyProjections => "Delinquency Projections",
            TemporaryServicesDetail => "Temporary Services Detail",
            OvernightShippingDetail => "Overnight Shipping Detail",
            MedicalSupplyDetail => "Medical Supply Detail",
            EquipmentLeasingDetail => "Equipment Leasing Detail",
            Assembly => "Assembly",
            Insurer => "Insurer",
            ClaimAdministrator => "Claim Administrator",
            Insured => "Insured",
            Administrative => "Administrative Information",
            CarRentalDetail => "Car Rental Detail",
            LodgingDetail => "Lodging Detail",
            Agent => "Agent",
            TransportationDetail => "Transportation Detail",
            PurchaseCardDetail => "Purchase Card Detail",
            AlternateTaxingAuthority => "Alternate Taxing Authority",
            AlternateSpecificationLiftLevel => "Alternate Specification - Lift Level",
            Amount => "Amount Information",
            CredentialAction => "Credential Action",
            AnimalSubjectGroup => "Animal Subject Group",
            Account => "Account",
            BuyersLocation => "Buyer's Location",
            Building => "Building",
            BusinessEntity => "Business Entity",
            BodyPart => "Body Part",
            Batch => "Batch",
            Date => "Date",
            ContractholderBranchOffice => "Contractholder Branch Office",
            CostCenter => "Cost Center",
            CostElement => "Cost Element",
            Contractholder => "Contractholder",
            CauseOfInjury => "Cause of Injury",
            Claimant => "Claimant",
            Container => "Container",
            Consortium => "Consortium",
            ClientOrParty => "Client or Party",
            CostType => "Cost Type",
            CodeCV => "Coverage, Rider, or Supplementary Benefit",
            ProductDescription => "Product Description",
            Drawing => "Drawing",
            Damage => "Damage",
            Department => "Department",
            District => "District",
            TransportationEquipment => "Transportation Equipment",
            Filer => "Filer",
            Receipts => "Receipts",
            EngineeringDataList => "Engineering Data List",
            Expenditures => "Expenditures",
            Receivables => "Receivables",
            Payables => "Payables",
            Organizational => "Organizational Information",
            ExhibitLineItem => "Exhibit Line Item",
            Employer => "Employer",
            EndItem => "End Item",
            Event => "Event",
            Exception => "Exception",
            Component => "Component",
            FunctionCode => "Function Code",
            FunctionalGroup => "Functional Group",
            Financial => "Financial Information",
            Fleet => "Fleet",
            Frame => "Frame",
            QualityCharacteristics => "Quality Characteristics",
            GroupCoverageOptions => "Group Coverage Options",
            GroupPurchasingOrganization => "Group Purchasing Organization",
            GroupWorkCandidate => "Group Work Candidate",
            BillOfMaterials => "Bill of Materials",
            EpaWasteNumberSubsection => "EPA Waste Number Subsection",
            WasteProfileSheet => "Waste Profile Sheet",
            Item => "Item",
            SublineItem => "Subline Item",
            Contract => "Contract",
            CodeIC => "Contract Data Requirements List (CDRL)",
            Interchange => "Interchange",
            Installments => "Installments",
            Institution => "Institution",
            Individual => "Individual",
            PartCharacteristic => "Part Characteristic",
            Jurisdiction => "Jurisdiction",
            Kit => "Kit",
            AccidentHistory => "Accident History",
            Chemical => "Chemical",
            ControlDevice => "Control Device",
            Discharge => "Discharge",
            EmergencyResponsePlan => "Emergency Response Plan",
            Emission => "Emission",
            EmissionActivity => "Emission Activity",
            EmissionReleasePoint => "Emission Release Point",
            EmissionUnit => "Emission Unit",
            FlammableMixture => "Flammable Mixture",
            FlammablesAlternateRelease => "Flammables Alternate Release",
            FlammablesWorstCase => "Flammables Worst Case",
            HazardousWasteGeneration => "Hazardous Waste Generation",
            HazardousWasteReceived => "Hazardous Waste Received",
            OffSiteProcess => "Off-Site Process",
            OnSiteProcess => "On-Site Process",
            Parameter => "Parameter",
            PreventionProgram => "Prevention Program",
            Process => "Process",
            ReductionAndRecycling => "Reduction and Recycling",
            ToxicsAlternateRelease => "Toxics Alternate Release",
            ToxicsWorstCase => "Toxics Worst Case",
            Transfer => "Transfer",
            SuppliersLocation => "Supplier's Location",
            LenderOrMortgageCompany => "Lender or Mortgage Company",
            LoanData => "Loan Data",
            PartyToTheLoan => "Party to the Loan",
            Measurement => "Measurement",
            ManufacturingLevel => "Manufacturing Level",
            SiteOfService => "Site of Service",
            NatureOfInjury => "Nature of Injury",
            NationalStockNumber => "National Stock Number",
            Order => "Order",
            Support => "Support",
            Pack => "Pack",
            PrimaryAdministrator => "Primary Administrator",
            PersonalProperty => "Personal Property",
            ProjectCode => "Project Code",
            Procedure => "Procedure",
            Person => "Person",
            ProductCharacteristic => "Product Characteristic",
            PropertyIdentification => "Property Identification",
            PropertyTax => "Property Tax",
            PrimarySpecificationLiftLevel => "Primary Specification - Lift Level",
            RelatedParties => "Related Parties",
            Principal => "Principal",
            PropertySegmentGroup => "Property Segment Group",
            Patient => "Patient",
            PaymentDetail => "Payment Detail",
            Subpack => "Subpack",
            Quantity => "Quantity",
            ReportingAgency => "Reporting Agency",
            Response => "Response",
            ResponseDetails => "Response Details",
            ResponseSubDetails => "Response Sub-details",
            ResponseParticular => "Response Particular",
            Medication => "Medication",
            Recommendation => "Recommendation",
            ReviewHistory => "Review History",
            ReferenceLocation => "Reference Location",
            Room => "Room",
            Report => "Report",
            Shipment => "Shipment",
            Site => "Site",
            Sample => "Sample",
            Test => "Test",
            SecondaryAdministrator => "Secondary Administrator",
            Substitute => "Substitute",
            SubcontractLineItem => "Subcontract Line Item",
            SupportDocument => "Support Document",
            SubexhibitLineItem => "Subexhibit Line Item",
            SafetyFitness => "Safety Fitness",
            SafetyFactor => "Safety Factor",
            Sheet => "Sheet",
            SourceOfInjury => "Source of Injury",
            Solicitation => "Solicitation",
            SubProject => "Sub-Project",
            Subroom => "Subroom",
            Services => "Services",
            State => "State",
            System => "System",
            ShippingTare => "Shipping Tare",
            TaxingAuthority => "Taxing Authority",
            TaxDelinquency => "Tax Delinquency",
            TechnicalInformationPackage => "Technical Information Package",
            TransactionSet => "Transaction Set",
            TrafficUnit => "Traffic Unit",
            TaxInstallment => "Tax Installment",
            Subassembly => "Subassembly",
            UnitOrLot => "Unit or Lot",
            Address => "Address Information",
            Violation => "Violation",
            TransactionReferenceNumber => "Transaction Reference Number",
            WorkBreakdownStructure => "Work Breakdown Structure",
            WorkCandidate => "Work Candidate",
            Well => "Well",
            WellCompletion => "Well Completion",
            Wellbore => "Wellbore",
            SerialNumber => "Serial Number",
            Suffix => "Suffix",
            Guarantor => "Guarantor",
            MutuallyDefined => "Mutually Defined",
        }
    }
    fn from_description(description: &str) -> Option<HierarchicalLevelCode> {
        {
            use HierarchicalLevelCode::*;
            match description {
                "Region" => Some(Region),
                "Service/Billing Provider" => Some(ServiceBillingProvider),
                "Billing Arrangement" => Some(BillingArrangement),
                "Branch" => Some(Branch),
                "Direct Affiliate" => Some(DirectAffiliate),
                "Director" => Some(Director),
                "Headquarters" => Some(Headquarters),
                "Indirect Affiliate" => Some(IndirectAffiliate),
                "Management Antecedents" => Some(ManagementAntecedents),
                "Management or Principal" => Some(ManagementOrPrincipal),
                "Parent Company" => Some(ParentCompany),
                "Stockholder" => Some(Stockholder),
                "Subsidiary" => Some(Subsidiary),
                "Ultimate Domestic Parent Company" => Some(UltimateDomesticParentCompany),
                "Ultimate Parent Company" => Some(UltimateParentCompany),
                "Sub-Billing Arrangement" => Some(SubBillingArrangement),
                "Group" => Some(Group),
                "Category" => Some(Category),
                "Sub-Category" => Some(SubCategory),
                "Type" => Some(Type),
                "Charge Detail" => Some(ChargeDetail),
                "Line Detail" => Some(LineDetail),
                "Provider of Service" => Some(ProviderOfService),
                "Information Source" => Some(InformationSource),
                "Information Receiver" => Some(InformationReceiver),
                "Subscriber" => Some(Subscriber),
                "Dependent" => Some(Dependent),
                "Supergroup" => Some(Supergroup),
                "Subgroup" => Some(Subgroup),
                "Member" => Some(Member),
                "Ancillary Facility or Department" => Some(AncillaryFacilityOrDepartment),
                "Hospital" => Some(Hospital),
                "Franchisor" => Some(Franchisor),
                "Franchisee" => Some(Franchisee),
                "Franchisee Association" => Some(FranchiseeAssociation),
                "Health Industry Business Communications Council (HIBCC) Health Industry Number (HIN) Database" => {
                    Some(Code32)
                }
                "Activity" => Some(Activity),
                "Location Record" => Some(LocationRecord),
                "Company/Corporation" => Some(CompanyCorporation),
                "Operating Unit" => Some(OperatingUnit),
                "Property" => Some(Property),
                "Tradename" => Some(Tradename),
                "Accountant" => Some(Accountant),
                "Financial Institution" => Some(FinancialInstitution),
                "Product Level" => Some(ProductLevel),
                "Activity Details" => Some(ActivityDetails),
                "Payment Summary Score" => Some(PaymentSummaryScore),
                "Corporate Registration Filings" => Some(CorporateRegistrationFilings),
                "Bankruptcy Details" => Some(BankruptcyDetails),
                "Company History" => Some(CompanyHistory),
                "Complete Financial History" => Some(CompleteFinancialHistory),
                "Balance Sheet" => Some(BalanceSheet),
                "Comparative Figures" => Some(ComparativeFigures),
                "Payment Analysis" => Some(PaymentAnalysis),
                "Special Notification" => Some(SpecialNotification),
                "Public Record Financing Details" => Some(PublicRecordFinancingDetails),
                "Public Record Financing Summary" => Some(PublicRecordFinancingSummary),
                "Public Record Claim Details" => Some(PublicRecordClaimDetails),
                "Public Record Claim Summary" => Some(PublicRecordClaimSummary),
                "Statement of Work" => Some(StatementOfWork),
                "Legal Action Details" => Some(LegalActionDetails),
                "Legal Action Summary" => Some(LegalActionSummary),
                "Company Evaluation" => Some(CompanyEvaluation),
                "Company Summary" => Some(CompanySummary),
                "Credit Scores" => Some(CreditScores),
                "Industry Averages" => Some(IndustryAverages),
                "Referring Provider" => Some(ReferringProvider),
                "Employee" => Some(Employee),
                "Insurance Policy" => Some(InsurancePolicy),
                "Vehicle" => Some(Vehicle),
                "Key Contributor" => Some(KeyContributor),
                "Public Record Summary" => Some(PublicRecordSummary),
                "Delinquency Projections" => Some(DelinquencyProjections),
                "Temporary Services Detail" => Some(TemporaryServicesDetail),
                "Overnight Shipping Detail" => Some(OvernightShippingDetail),
                "Medical Supply Detail" => Some(MedicalSupplyDetail),
                "Equipment Leasing Detail" => Some(EquipmentLeasingDetail),
                "Assembly" => Some(Assembly),
                "Insurer" => Some(Insurer),
                "Claim Administrator" => Some(ClaimAdministrator),
                "Insured" => Some(Insured),
                "Administrative Information" => Some(Administrative),
                "Car Rental Detail" => Some(CarRentalDetail),
                "Lodging Detail" => Some(LodgingDetail),
                "Agent" => Some(Agent),
                "Transportation Detail" => Some(TransportationDetail),
                "Purchase Card Detail" => Some(PurchaseCardDetail),
                "Alternate Taxing Authority" => Some(AlternateTaxingAuthority),
                "Alternate Specification - Lift Level" => {
                    Some(AlternateSpecificationLiftLevel)
                }
                "Amount Information" => Some(Amount),
                "Credential Action" => Some(CredentialAction),
                "Animal Subject Group" => Some(AnimalSubjectGroup),
                "Account" => Some(Account),
                "Buyer's Location" => Some(BuyersLocation),
                "Building" => Some(Building),
                "Business Entity" => Some(BusinessEntity),
                "Body Part" => Some(BodyPart),
                "Batch" => Some(Batch),
                "Date" => Some(Date),
                "Contractholder Branch Office" => Some(ContractholderBranchOffice),
                "Cost Center" => Some(CostCenter),
                "Cost Element" => Some(CostElement),
                "Contractholder" => Some(Contractholder),
                "Cause of Injury" => Some(CauseOfInjury),
                "Claimant" => Some(Claimant),
                "Container" => Some(Container),
                "Consortium" => Some(Consortium),
                "Client or Party" => Some(ClientOrParty),
                "Cost Type" => Some(CostType),
                "Coverage, Rider, or Supplementary Benefit" => Some(CodeCV),
                "Product Description" => Some(ProductDescription),
                "Drawing" => Some(Drawing),
                "Damage" => Some(Damage),
                "Department" => Some(Department),
                "District" => Some(District),
                "Transportation Equipment" => Some(TransportationEquipment),
                "Filer" => Some(Filer),
                "Receipts" => Some(Receipts),
                "Engineering Data List" => Some(EngineeringDataList),
                "Expenditures" => Some(Expenditures),
                "Receivables" => Some(Receivables),
                "Payables" => Some(Payables),
                "Organizational Information" => Some(Organizational),
                "Exhibit Line Item" => Some(ExhibitLineItem),
                "Employer" => Some(Employer),
                "End Item" => Some(EndItem),
                "Event" => Some(Event),
                "Exception" => Some(Exception),
                "Component" => Some(Component),
                "Function Code" => Some(FunctionCode),
                "Functional Group" => Some(FunctionalGroup),
                "Financial Information" => Some(Financial),
                "Fleet" => Some(Fleet),
                "Frame" => Some(Frame),
                "Quality Characteristics" => Some(QualityCharacteristics),
                "Group Coverage Options" => Some(GroupCoverageOptions),
                "Group Purchasing Organization" => Some(GroupPurchasingOrganization),
                "Group Work Candidate" => Some(GroupWorkCandidate),
                "Bill of Materials" => Some(BillOfMaterials),
                "EPA Waste Number Subsection" => Some(EpaWasteNumberSubsection),
                "Waste Profile Sheet" => Some(WasteProfileSheet),
                "Item" => Some(Item),
                "Subline Item" => Some(SublineItem),
                "Contract" => Some(Contract),
                "Contract Data Requirements List (CDRL)" => Some(CodeIC),
                "Interchange" => Some(Interchange),
                "Installments" => Some(Installments),
                "Institution" => Some(Institution),
                "Individual" => Some(Individual),
                "Part Characteristic" => Some(PartCharacteristic),
                "Jurisdiction" => Some(Jurisdiction),
                "Kit" => Some(Kit),
                "Accident History" => Some(AccidentHistory),
                "Chemical" => Some(Chemical),
                "Control Device" => Some(ControlDevice),
                "Discharge" => Some(Discharge),
                "Emergency Response Plan" => Some(EmergencyResponsePlan),
                "Emission" => Some(Emission),
                "Emission Activity" => Some(EmissionActivity),
                "Emission Release Point" => Some(EmissionReleasePoint),
                "Emission Unit" => Some(EmissionUnit),
                "Flammable Mixture" => Some(FlammableMixture),
                "Flammables Alternate Release" => Some(FlammablesAlternateRelease),
                "Flammables Worst Case" => Some(FlammablesWorstCase),
                "Hazardous Waste Generation" => Some(HazardousWasteGeneration),
                "Hazardous Waste Received" => Some(HazardousWasteReceived),
                "Off-Site Process" => Some(OffSiteProcess),
                "On-Site Process" => Some(OnSiteProcess),
                "Parameter" => Some(Parameter),
                "Prevention Program" => Some(PreventionProgram),
                "Process" => Some(Process),
                "Reduction and Recycling" => Some(ReductionAndRecycling),
                "Toxics Alternate Release" => Some(ToxicsAlternateRelease),
                "Toxics Worst Case" => Some(ToxicsWorstCase),
                "Transfer" => Some(Transfer),
                "Supplier's Location" => Some(SuppliersLocation),
                "Lender or Mortgage Company" => Some(LenderOrMortgageCompany),
                "Loan Data" => Some(LoanData),
                "Party to the Loan" => Some(PartyToTheLoan),
                "Measurement" => Some(Measurement),
                "Manufacturing Level" => Some(ManufacturingLevel),
                "Site of Service" => Some(SiteOfService),
                "Nature of Injury" => Some(NatureOfInjury),
                "National Stock Number" => Some(NationalStockNumber),
                "Order" => Some(Order),
                "Support" => Some(Support),
                "Pack" => Some(Pack),
                "Primary Administrator" => Some(PrimaryAdministrator),
                "Personal Property" => Some(PersonalProperty),
                "Project Code" => Some(ProjectCode),
                "Procedure" => Some(Procedure),
                "Person" => Some(Person),
                "Product Characteristic" => Some(ProductCharacteristic),
                "Property Identification" => Some(PropertyIdentification),
                "Property Tax" => Some(PropertyTax),
                "Primary Specification - Lift Level" => {
                    Some(PrimarySpecificationLiftLevel)
                }
                "Related Parties" => Some(RelatedParties),
                "Principal" => Some(Principal),
                "Property Segment Group" => Some(PropertySegmentGroup),
                "Patient" => Some(Patient),
                "Payment Detail" => Some(PaymentDetail),
                "Subpack" => Some(Subpack),
                "Quantity" => Some(Quantity),
                "Reporting Agency" => Some(ReportingAgency),
                "Response" => Some(Response),
                "Response Details" => Some(ResponseDetails),
                "Response Sub-details" => Some(ResponseSubDetails),
                "Response Particular" => Some(ResponseParticular),
                "Medication" => Some(Medication),
                "Recommendation" => Some(Recommendation),
                "Review History" => Some(ReviewHistory),
                "Reference Location" => Some(ReferenceLocation),
                "Room" => Some(Room),
                "Report" => Some(Report),
                "Shipment" => Some(Shipment),
                "Site" => Some(Site),
                "Sample" => Some(Sample),
                "Test" => Some(Test),
                "Secondary Administrator" => Some(SecondaryAdministrator),
                "Substitute" => Some(Substitute),
                "Subcontract Line Item" => Some(SubcontractLineItem),
                "Support Document" => Some(SupportDocument),
                "Subexhibit Line Item" => Some(SubexhibitLineItem),
                "Safety Fitness" => Some(SafetyFitness),
                "Safety Factor" => Some(SafetyFactor),
                "Sheet" => Some(Sheet),
                "Source of Injury" => Some(SourceOfInjury),
                "Solicitation" => Some(Solicitation),
                "Sub-Project" => Some(SubProject),
                "Subroom" => Some(Subroom),
                "Services" => Some(Services),
                "State" => Some(State),
                "System" => Some(System),
                "Shipping Tare" => Some(ShippingTare),
                "Taxing Authority" => Some(TaxingAuthority),
                "Tax Delinquency" => Some(TaxDelinquency),
                "Technical Information Package" => Some(TechnicalInformationPackage),
                "Transaction Set" => Some(TransactionSet),
                "Traffic Unit" => Some(TrafficUnit),
                "Tax Installment" => Some(TaxInstallment),
                "Subassembly" => Some(Subassembly),
                "Unit or Lot" => Some(UnitOrLot),
                "Address Information" => Some(Address),
                "Violation" => Some(Violation),
                "Transaction Reference Number" => Some(TransactionReferenceNumber),
                "Work Breakdown Structure" => Some(WorkBreakdownStructure),
                "Work Candidate" => Some(WorkCandidate),
                "Well" => Some(Well),
                "Well Completion" => Some(WellCompletion),
                "Wellbore" => Some(Wellbore),
                "Serial Number" => Some(SerialNumber),
                "Suffix" => Some(Suffix),
                "Guarantor" => Some(Guarantor),
                "Mutually Defined" => Some(MutuallyDefined),
                _ => None,
            }
        }
    }
}
impl Serialize for HierarchicalLevelCode {
    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 = HierarchicalLevelCode;
    fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
        formatter.write_str("Hierarchical Level Code")
    }
    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
    where
        E: de::Error,
    {
        HierarchicalLevelCode::from_description(v)
            .ok_or_else(|| E::custom(format!("Invalid Hierarchical Level Code: {}", v)))
    }
    fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E>
    where
        E: de::Error,
    {
        HierarchicalLevelCode::from_code(v)
            .ok_or_else(|| E::custom(
                format!(
                    "Invalid Hierarchical Level Code: {}", std::str::from_utf8(v)
                    .unwrap()
                ),
            ))
    }
}
impl<'de> Deserialize<'de> for HierarchicalLevelCode {
    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)
        }
    }
}