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
use std::fmt;
use serde::{de, Deserialize, ser, Serialize};
/**365

See docs at <https://www.stedi.com/edi/x12/element/365>*/
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum CommunicationNumberQualifier {
    ///01 - Additional Trade Item Description URL
    AdditionalTradeItemDescriptionUrl,
    ///02 - Cash Register Description URL
    CashRegisterDescriptionUrl,
    ///03 - Consumer Usage Storage Instructions URL
    ConsumerUsageStorageInstructionsUrl,
    ///04 - Cooking Suggestions URL
    CookingSuggestionsUrl,
    ///05 - Customer Service URL
    CustomerServiceUrl,
    ///06 - Direct Product Markings Description URL
    DirectProductMarkingsDescriptionUrl,
    ///07 - Feature and Benefits URL
    FeatureAndBenefitsUrl,
    ///08 - Finish Description and Image URL
    FinishDescriptionAndImageUrl,
    ///09 - Beauty Image URL
    BeautyImageUrl,
    ///10 - Image Information URL
    ImageInformationUrl,
    ///11 - Label Storage Information URL
    LabelStorageInformationUrl,
    ///12 - Marketing Message URL
    MarketingMessageUrl,
    ///13 - Promotion Markings URL
    PromotionMarkingsUrl,
    ///14 - Precautionary Statement URL
    PrecautionaryStatementUrl,
    ///15 - Preparation Instructions URL
    PreparationInstructionsUrl,
    ///16 - Product Information URL
    ProductInformationUrl,
    ///17 - Serving Suggestions URL
    ServingSuggestionsUrl,
    ///18 - Shape Description URL
    ShapeDescriptionUrl,
    ///19 - Warranty Information URL
    WarrantyInformationUrl,
    ///AA - International Telephone Access Code
    InternationalTelephoneAccessCode,
    ///AB - Joint Facsimile and Phone Number
    JointFacsimileAndPhoneNumber,
    ///AC - Message Only Voice Number
    MessageOnlyVoiceNumber,
    ///AD - Delivery Location Phone
    DeliveryLocationPhone,
    ///AE - Area Code
    AreaCode,
    ///AL - Allergen Information URL
    AllergenInformationUrl,
    ///AP - Alternate Telephone
    AlternateTelephone,
    ///AS - Answering Service
    AnsweringService,
    ///AU - Defense Switched Network
    DefenseSwitchedNetwork,
    ///BN - Beeper Number
    BeeperNumber,
    ///BR - Brochure URL Address
    BrochureUrlAddress,
    ///BT - BTX Number
    BtxNumber,
    ///CA - Cable
    Cable,
    ///CI - Conflict Mineral Information URL
    ConflictMineralInformationUrl,
    ///CM - Certification Mark Image URL
    CertificationMarkImageUrl,
    ///CN - Consumer Support Phone Number
    ConsumerSupportPhoneNumber,
    ///CP - Cellular Phone
    CellularPhone,
    ///CS - Allergen Consumer Support Phone Number
    AllergenConsumerSupportPhoneNumber,
    ///CT - Certification URL
    CertificationUrl,
    ///DN - Defense Data Network (DDN)
    CodeDN,
    ///EA - Internet Email Address
    InternetEmailAddress,
    ///ED - Electronic Data Interchange Access Number
    ElectronicDataInterchangeAccessNumber,
    ///EM - Electronic Mail
    ElectronicMail,
    ///EN - Full Engineering Drawing URL
    FullEngineeringDrawingUrl,
    ///EX - Telephone Extension
    TelephoneExtension,
    ///FT - Federal Telecommunications System (FTS)
    CodeFT,
    ///FU - Facsimile User Identifier
    FacsimileUser,
    ///FX - Facsimile
    Facsimile,
    ///HF - Home Facsimile Number
    HomeFacsimileNumber,
    ///HP - Home Phone Number
    HomePhoneNumber,
    ///IT - International Telephone
    InternationalTelephone,
    ///MN - Modem Number
    ModemNumber,
    ///NP - Night Telephone
    NightTelephone,
    ///OF - Other Residential Facsimile Number
    OtherResidentialFacsimileNumber,
    ///OT - Other Residential Telephone Number
    OtherResidentialTelephoneNumber,
    ///PA - Appointment Phone
    AppointmentPhone,
    ///PC - Personal Cellular
    PersonalCellular,
    ///PP - Personal Phone
    PersonalPhone,
    ///PS - Packet Switching
    PacketSwitching,
    ///Q1 - Image Link
    ImageLink,
    ///Q2 - Image Information Link
    ImageInformationLink,
    ///Q3 - Allergen Information Link
    AllergenInformationLink,
    ///Q4, S4 - Warranty Information Link
    WarrantyInformationLink,
    ///Q5 - Customer Service Link
    CustomerServiceLink,
    ///Q6 - Product Information Link
    ProductInformationLink,
    ///Q7 - Organic Information Link
    OrganicInformationLink,
    ///Q8 - Organic Certification Link (agency)
    CodeQ8,
    ///Q9 - Diet Type Certification Link
    DietTypeCertificationLink,
    ///QA - Image Thumbnail URL
    ImageThumbnailUrl,
    ///R1 - Diet Type Consumer Support Phone Number
    DietTypeConsumerSupportPhoneNumber,
    ///R2 - Installation Video URL
    InstallationVideoUrl,
    ///R3 - Technical Drawing URL
    TechnicalDrawingUrl,
    ///R4 - Manufacturer Product Website URL
    ManufacturerProductWebsiteUrl,
    ///R5 - Material Safety Data Sheet (MSDS or SDS) URL
    CodeR5,
    ///R6 - User Manual URL
    UserManualUrl,
    ///R7 - Pallet Configuration URL
    PalletConfigurationUrl,
    ///R8 - Product Specification URL
    ProductSpecificationUrl,
    ///R9 - Restrictions on Hazardous Substances (RoHS) Material Composition URL
    CodeR9,
    ///RA - Installation Instructions URL
    InstallationInstructionsUrl,
    ///S1 - Service Manual URL
    ServiceManualUrl,
    ///S2 - Technical Bulletin URL
    TechnicalBulletinUrl,
    ///S3 - Video Clip URL
    VideoClipUrl,
    ///S5 - Wiring Diagram URL
    WiringDiagramUrl,
    ///SP - Showing Phone
    ShowingPhone,
    ///TD - 3D Rendering URL
    CodeTD,
    ///TE - Telephone
    Telephone,
    ///TL - Telex
    Telex,
    ///TM - Telemail
    Telemail,
    ///TN - Teletex Number
    TeletexNumber,
    ///TS - Text Message Address
    TextMessageAddress,
    ///TX - TWX
    Twx,
    ///UR - Uniform Resource Locator (URL)
    CodeUR,
    ///VM - Voice Mail
    VoiceMail,
    ///WC - Work Cellular
    WorkCellular,
    ///WF - Work Facsimile Number
    WorkFacsimileNumber,
    ///WP - Work Phone Number
    WorkPhoneNumber,
}
impl CommunicationNumberQualifier {
    pub fn code(&self) -> &str {
        {
            use CommunicationNumberQualifier::*;
            match self {
                AdditionalTradeItemDescriptionUrl => "01",
                CashRegisterDescriptionUrl => "02",
                ConsumerUsageStorageInstructionsUrl => "03",
                CookingSuggestionsUrl => "04",
                CustomerServiceUrl => "05",
                DirectProductMarkingsDescriptionUrl => "06",
                FeatureAndBenefitsUrl => "07",
                FinishDescriptionAndImageUrl => "08",
                BeautyImageUrl => "09",
                ImageInformationUrl => "10",
                LabelStorageInformationUrl => "11",
                MarketingMessageUrl => "12",
                PromotionMarkingsUrl => "13",
                PrecautionaryStatementUrl => "14",
                PreparationInstructionsUrl => "15",
                ProductInformationUrl => "16",
                ServingSuggestionsUrl => "17",
                ShapeDescriptionUrl => "18",
                WarrantyInformationUrl => "19",
                InternationalTelephoneAccessCode => "AA",
                JointFacsimileAndPhoneNumber => "AB",
                MessageOnlyVoiceNumber => "AC",
                DeliveryLocationPhone => "AD",
                AreaCode => "AE",
                AllergenInformationUrl => "AL",
                AlternateTelephone => "AP",
                AnsweringService => "AS",
                DefenseSwitchedNetwork => "AU",
                BeeperNumber => "BN",
                BrochureUrlAddress => "BR",
                BtxNumber => "BT",
                Cable => "CA",
                ConflictMineralInformationUrl => "CI",
                CertificationMarkImageUrl => "CM",
                ConsumerSupportPhoneNumber => "CN",
                CellularPhone => "CP",
                AllergenConsumerSupportPhoneNumber => "CS",
                CertificationUrl => "CT",
                CodeDN => "DN",
                InternetEmailAddress => "EA",
                ElectronicDataInterchangeAccessNumber => "ED",
                ElectronicMail => "EM",
                FullEngineeringDrawingUrl => "EN",
                TelephoneExtension => "EX",
                CodeFT => "FT",
                FacsimileUser => "FU",
                Facsimile => "FX",
                HomeFacsimileNumber => "HF",
                HomePhoneNumber => "HP",
                InternationalTelephone => "IT",
                ModemNumber => "MN",
                NightTelephone => "NP",
                OtherResidentialFacsimileNumber => "OF",
                OtherResidentialTelephoneNumber => "OT",
                AppointmentPhone => "PA",
                PersonalCellular => "PC",
                PersonalPhone => "PP",
                PacketSwitching => "PS",
                ImageLink => "Q1",
                ImageInformationLink => "Q2",
                AllergenInformationLink => "Q3",
                WarrantyInformationLink => "Q4",
                CustomerServiceLink => "Q5",
                ProductInformationLink => "Q6",
                OrganicInformationLink => "Q7",
                CodeQ8 => "Q8",
                DietTypeCertificationLink => "Q9",
                ImageThumbnailUrl => "QA",
                DietTypeConsumerSupportPhoneNumber => "R1",
                InstallationVideoUrl => "R2",
                TechnicalDrawingUrl => "R3",
                ManufacturerProductWebsiteUrl => "R4",
                CodeR5 => "R5",
                UserManualUrl => "R6",
                PalletConfigurationUrl => "R7",
                ProductSpecificationUrl => "R8",
                CodeR9 => "R9",
                InstallationInstructionsUrl => "RA",
                ServiceManualUrl => "S1",
                TechnicalBulletinUrl => "S2",
                VideoClipUrl => "S3",
                WiringDiagramUrl => "S5",
                ShowingPhone => "SP",
                CodeTD => "TD",
                Telephone => "TE",
                Telex => "TL",
                Telemail => "TM",
                TeletexNumber => "TN",
                TextMessageAddress => "TS",
                Twx => "TX",
                CodeUR => "UR",
                VoiceMail => "VM",
                WorkCellular => "WC",
                WorkFacsimileNumber => "WF",
                WorkPhoneNumber => "WP",
            }
        }
    }
    pub fn from_code(code: &[u8]) -> Option<CommunicationNumberQualifier> {
        use CommunicationNumberQualifier::*;
        match code {
            b"01" => Some(AdditionalTradeItemDescriptionUrl),
            b"02" => Some(CashRegisterDescriptionUrl),
            b"03" => Some(ConsumerUsageStorageInstructionsUrl),
            b"04" => Some(CookingSuggestionsUrl),
            b"05" => Some(CustomerServiceUrl),
            b"06" => Some(DirectProductMarkingsDescriptionUrl),
            b"07" => Some(FeatureAndBenefitsUrl),
            b"08" => Some(FinishDescriptionAndImageUrl),
            b"09" => Some(BeautyImageUrl),
            b"10" => Some(ImageInformationUrl),
            b"11" => Some(LabelStorageInformationUrl),
            b"12" => Some(MarketingMessageUrl),
            b"13" => Some(PromotionMarkingsUrl),
            b"14" => Some(PrecautionaryStatementUrl),
            b"15" => Some(PreparationInstructionsUrl),
            b"16" => Some(ProductInformationUrl),
            b"17" => Some(ServingSuggestionsUrl),
            b"18" => Some(ShapeDescriptionUrl),
            b"19" => Some(WarrantyInformationUrl),
            b"AA" => Some(InternationalTelephoneAccessCode),
            b"AB" => Some(JointFacsimileAndPhoneNumber),
            b"AC" => Some(MessageOnlyVoiceNumber),
            b"AD" => Some(DeliveryLocationPhone),
            b"AE" => Some(AreaCode),
            b"AL" => Some(AllergenInformationUrl),
            b"AP" => Some(AlternateTelephone),
            b"AS" => Some(AnsweringService),
            b"AU" => Some(DefenseSwitchedNetwork),
            b"BN" => Some(BeeperNumber),
            b"BR" => Some(BrochureUrlAddress),
            b"BT" => Some(BtxNumber),
            b"CA" => Some(Cable),
            b"CI" => Some(ConflictMineralInformationUrl),
            b"CM" => Some(CertificationMarkImageUrl),
            b"CN" => Some(ConsumerSupportPhoneNumber),
            b"CP" => Some(CellularPhone),
            b"CS" => Some(AllergenConsumerSupportPhoneNumber),
            b"CT" => Some(CertificationUrl),
            b"DN" => Some(CodeDN),
            b"EA" => Some(InternetEmailAddress),
            b"ED" => Some(ElectronicDataInterchangeAccessNumber),
            b"EM" => Some(ElectronicMail),
            b"EN" => Some(FullEngineeringDrawingUrl),
            b"EX" => Some(TelephoneExtension),
            b"FT" => Some(CodeFT),
            b"FU" => Some(FacsimileUser),
            b"FX" => Some(Facsimile),
            b"HF" => Some(HomeFacsimileNumber),
            b"HP" => Some(HomePhoneNumber),
            b"IT" => Some(InternationalTelephone),
            b"MN" => Some(ModemNumber),
            b"NP" => Some(NightTelephone),
            b"OF" => Some(OtherResidentialFacsimileNumber),
            b"OT" => Some(OtherResidentialTelephoneNumber),
            b"PA" => Some(AppointmentPhone),
            b"PC" => Some(PersonalCellular),
            b"PP" => Some(PersonalPhone),
            b"PS" => Some(PacketSwitching),
            b"Q1" => Some(ImageLink),
            b"Q2" => Some(ImageInformationLink),
            b"Q3" => Some(AllergenInformationLink),
            b"Q4" => Some(WarrantyInformationLink),
            b"S4" => Some(WarrantyInformationLink),
            b"Q5" => Some(CustomerServiceLink),
            b"Q6" => Some(ProductInformationLink),
            b"Q7" => Some(OrganicInformationLink),
            b"Q8" => Some(CodeQ8),
            b"Q9" => Some(DietTypeCertificationLink),
            b"QA" => Some(ImageThumbnailUrl),
            b"R1" => Some(DietTypeConsumerSupportPhoneNumber),
            b"R2" => Some(InstallationVideoUrl),
            b"R3" => Some(TechnicalDrawingUrl),
            b"R4" => Some(ManufacturerProductWebsiteUrl),
            b"R5" => Some(CodeR5),
            b"R6" => Some(UserManualUrl),
            b"R7" => Some(PalletConfigurationUrl),
            b"R8" => Some(ProductSpecificationUrl),
            b"R9" => Some(CodeR9),
            b"RA" => Some(InstallationInstructionsUrl),
            b"S1" => Some(ServiceManualUrl),
            b"S2" => Some(TechnicalBulletinUrl),
            b"S3" => Some(VideoClipUrl),
            b"S5" => Some(WiringDiagramUrl),
            b"SP" => Some(ShowingPhone),
            b"TD" => Some(CodeTD),
            b"TE" => Some(Telephone),
            b"TL" => Some(Telex),
            b"TM" => Some(Telemail),
            b"TN" => Some(TeletexNumber),
            b"TS" => Some(TextMessageAddress),
            b"TX" => Some(Twx),
            b"UR" => Some(CodeUR),
            b"VM" => Some(VoiceMail),
            b"WC" => Some(WorkCellular),
            b"WF" => Some(WorkFacsimileNumber),
            b"WP" => Some(WorkPhoneNumber),
            _ => None,
        }
    }
    fn description(&self) -> &str {
        use CommunicationNumberQualifier::*;
        match self {
            AdditionalTradeItemDescriptionUrl => "Additional Trade Item Description URL",
            CashRegisterDescriptionUrl => "Cash Register Description URL",
            ConsumerUsageStorageInstructionsUrl => {
                "Consumer Usage Storage Instructions URL"
            }
            CookingSuggestionsUrl => "Cooking Suggestions URL",
            CustomerServiceUrl => "Customer Service URL",
            DirectProductMarkingsDescriptionUrl => {
                "Direct Product Markings Description URL"
            }
            FeatureAndBenefitsUrl => "Feature and Benefits URL",
            FinishDescriptionAndImageUrl => "Finish Description and Image URL",
            BeautyImageUrl => "Beauty Image URL",
            ImageInformationUrl => "Image Information URL",
            LabelStorageInformationUrl => "Label Storage Information URL",
            MarketingMessageUrl => "Marketing Message URL",
            PromotionMarkingsUrl => "Promotion Markings URL",
            PrecautionaryStatementUrl => "Precautionary Statement URL",
            PreparationInstructionsUrl => "Preparation Instructions URL",
            ProductInformationUrl => "Product Information URL",
            ServingSuggestionsUrl => "Serving Suggestions URL",
            ShapeDescriptionUrl => "Shape Description URL",
            WarrantyInformationUrl => "Warranty Information URL",
            InternationalTelephoneAccessCode => "International Telephone Access Code",
            JointFacsimileAndPhoneNumber => "Joint Facsimile and Phone Number",
            MessageOnlyVoiceNumber => "Message Only Voice Number",
            DeliveryLocationPhone => "Delivery Location Phone",
            AreaCode => "Area Code",
            AllergenInformationUrl => "Allergen Information URL",
            AlternateTelephone => "Alternate Telephone",
            AnsweringService => "Answering Service",
            DefenseSwitchedNetwork => "Defense Switched Network",
            BeeperNumber => "Beeper Number",
            BrochureUrlAddress => "Brochure URL Address",
            BtxNumber => "BTX Number",
            Cable => "Cable",
            ConflictMineralInformationUrl => "Conflict Mineral Information URL",
            CertificationMarkImageUrl => "Certification Mark Image URL",
            ConsumerSupportPhoneNumber => "Consumer Support Phone Number",
            CellularPhone => "Cellular Phone",
            AllergenConsumerSupportPhoneNumber => {
                "Allergen Consumer Support Phone Number"
            }
            CertificationUrl => "Certification URL",
            CodeDN => "Defense Data Network (DDN)",
            InternetEmailAddress => "Internet Email Address",
            ElectronicDataInterchangeAccessNumber => {
                "Electronic Data Interchange Access Number"
            }
            ElectronicMail => "Electronic Mail",
            FullEngineeringDrawingUrl => "Full Engineering Drawing URL",
            TelephoneExtension => "Telephone Extension",
            CodeFT => "Federal Telecommunications System (FTS)",
            FacsimileUser => "Facsimile User Identifier",
            Facsimile => "Facsimile",
            HomeFacsimileNumber => "Home Facsimile Number",
            HomePhoneNumber => "Home Phone Number",
            InternationalTelephone => "International Telephone",
            ModemNumber => "Modem Number",
            NightTelephone => "Night Telephone",
            OtherResidentialFacsimileNumber => "Other Residential Facsimile Number",
            OtherResidentialTelephoneNumber => "Other Residential Telephone Number",
            AppointmentPhone => "Appointment Phone",
            PersonalCellular => "Personal Cellular",
            PersonalPhone => "Personal Phone",
            PacketSwitching => "Packet Switching",
            ImageLink => "Image Link",
            ImageInformationLink => "Image Information Link",
            AllergenInformationLink => "Allergen Information Link",
            WarrantyInformationLink => "Warranty Information Link",
            CustomerServiceLink => "Customer Service Link",
            ProductInformationLink => "Product Information Link",
            OrganicInformationLink => "Organic Information Link",
            CodeQ8 => "Organic Certification Link (agency)",
            DietTypeCertificationLink => "Diet Type Certification Link",
            ImageThumbnailUrl => "Image Thumbnail URL",
            DietTypeConsumerSupportPhoneNumber => {
                "Diet Type Consumer Support Phone Number"
            }
            InstallationVideoUrl => "Installation Video URL",
            TechnicalDrawingUrl => "Technical Drawing URL",
            ManufacturerProductWebsiteUrl => "Manufacturer Product Website URL",
            CodeR5 => "Material Safety Data Sheet (MSDS or SDS) URL",
            UserManualUrl => "User Manual URL",
            PalletConfigurationUrl => "Pallet Configuration URL",
            ProductSpecificationUrl => "Product Specification URL",
            CodeR9 => {
                "Restrictions on Hazardous Substances (RoHS) Material Composition URL"
            }
            InstallationInstructionsUrl => "Installation Instructions URL",
            ServiceManualUrl => "Service Manual URL",
            TechnicalBulletinUrl => "Technical Bulletin URL",
            VideoClipUrl => "Video Clip URL",
            WiringDiagramUrl => "Wiring Diagram URL",
            ShowingPhone => "Showing Phone",
            CodeTD => "3D Rendering URL",
            Telephone => "Telephone",
            Telex => "Telex",
            Telemail => "Telemail",
            TeletexNumber => "Teletex Number",
            TextMessageAddress => "Text Message Address",
            Twx => "TWX",
            CodeUR => "Uniform Resource Locator (URL)",
            VoiceMail => "Voice Mail",
            WorkCellular => "Work Cellular",
            WorkFacsimileNumber => "Work Facsimile Number",
            WorkPhoneNumber => "Work Phone Number",
        }
    }
    fn from_description(description: &str) -> Option<CommunicationNumberQualifier> {
        {
            use CommunicationNumberQualifier::*;
            match description {
                "Additional Trade Item Description URL" => {
                    Some(AdditionalTradeItemDescriptionUrl)
                }
                "Cash Register Description URL" => Some(CashRegisterDescriptionUrl),
                "Consumer Usage Storage Instructions URL" => {
                    Some(ConsumerUsageStorageInstructionsUrl)
                }
                "Cooking Suggestions URL" => Some(CookingSuggestionsUrl),
                "Customer Service URL" => Some(CustomerServiceUrl),
                "Direct Product Markings Description URL" => {
                    Some(DirectProductMarkingsDescriptionUrl)
                }
                "Feature and Benefits URL" => Some(FeatureAndBenefitsUrl),
                "Finish Description and Image URL" => Some(FinishDescriptionAndImageUrl),
                "Beauty Image URL" => Some(BeautyImageUrl),
                "Image Information URL" => Some(ImageInformationUrl),
                "Label Storage Information URL" => Some(LabelStorageInformationUrl),
                "Marketing Message URL" => Some(MarketingMessageUrl),
                "Promotion Markings URL" => Some(PromotionMarkingsUrl),
                "Precautionary Statement URL" => Some(PrecautionaryStatementUrl),
                "Preparation Instructions URL" => Some(PreparationInstructionsUrl),
                "Product Information URL" => Some(ProductInformationUrl),
                "Serving Suggestions URL" => Some(ServingSuggestionsUrl),
                "Shape Description URL" => Some(ShapeDescriptionUrl),
                "Warranty Information URL" => Some(WarrantyInformationUrl),
                "International Telephone Access Code" => {
                    Some(InternationalTelephoneAccessCode)
                }
                "Joint Facsimile and Phone Number" => Some(JointFacsimileAndPhoneNumber),
                "Message Only Voice Number" => Some(MessageOnlyVoiceNumber),
                "Delivery Location Phone" => Some(DeliveryLocationPhone),
                "Area Code" => Some(AreaCode),
                "Allergen Information URL" => Some(AllergenInformationUrl),
                "Alternate Telephone" => Some(AlternateTelephone),
                "Answering Service" => Some(AnsweringService),
                "Defense Switched Network" => Some(DefenseSwitchedNetwork),
                "Beeper Number" => Some(BeeperNumber),
                "Brochure URL Address" => Some(BrochureUrlAddress),
                "BTX Number" => Some(BtxNumber),
                "Cable" => Some(Cable),
                "Conflict Mineral Information URL" => Some(ConflictMineralInformationUrl),
                "Certification Mark Image URL" => Some(CertificationMarkImageUrl),
                "Consumer Support Phone Number" => Some(ConsumerSupportPhoneNumber),
                "Cellular Phone" => Some(CellularPhone),
                "Allergen Consumer Support Phone Number" => {
                    Some(AllergenConsumerSupportPhoneNumber)
                }
                "Certification URL" => Some(CertificationUrl),
                "Defense Data Network (DDN)" => Some(CodeDN),
                "Internet Email Address" => Some(InternetEmailAddress),
                "Electronic Data Interchange Access Number" => {
                    Some(ElectronicDataInterchangeAccessNumber)
                }
                "Electronic Mail" => Some(ElectronicMail),
                "Full Engineering Drawing URL" => Some(FullEngineeringDrawingUrl),
                "Telephone Extension" => Some(TelephoneExtension),
                "Federal Telecommunications System (FTS)" => Some(CodeFT),
                "Facsimile User Identifier" => Some(FacsimileUser),
                "Facsimile" => Some(Facsimile),
                "Home Facsimile Number" => Some(HomeFacsimileNumber),
                "Home Phone Number" => Some(HomePhoneNumber),
                "International Telephone" => Some(InternationalTelephone),
                "Modem Number" => Some(ModemNumber),
                "Night Telephone" => Some(NightTelephone),
                "Other Residential Facsimile Number" => {
                    Some(OtherResidentialFacsimileNumber)
                }
                "Other Residential Telephone Number" => {
                    Some(OtherResidentialTelephoneNumber)
                }
                "Appointment Phone" => Some(AppointmentPhone),
                "Personal Cellular" => Some(PersonalCellular),
                "Personal Phone" => Some(PersonalPhone),
                "Packet Switching" => Some(PacketSwitching),
                "Image Link" => Some(ImageLink),
                "Image Information Link" => Some(ImageInformationLink),
                "Allergen Information Link" => Some(AllergenInformationLink),
                "Warranty Information Link" => Some(WarrantyInformationLink),
                "Customer Service Link" => Some(CustomerServiceLink),
                "Product Information Link" => Some(ProductInformationLink),
                "Organic Information Link" => Some(OrganicInformationLink),
                "Organic Certification Link (agency)" => Some(CodeQ8),
                "Diet Type Certification Link" => Some(DietTypeCertificationLink),
                "Image Thumbnail URL" => Some(ImageThumbnailUrl),
                "Diet Type Consumer Support Phone Number" => {
                    Some(DietTypeConsumerSupportPhoneNumber)
                }
                "Installation Video URL" => Some(InstallationVideoUrl),
                "Technical Drawing URL" => Some(TechnicalDrawingUrl),
                "Manufacturer Product Website URL" => Some(ManufacturerProductWebsiteUrl),
                "Material Safety Data Sheet (MSDS or SDS) URL" => Some(CodeR5),
                "User Manual URL" => Some(UserManualUrl),
                "Pallet Configuration URL" => Some(PalletConfigurationUrl),
                "Product Specification URL" => Some(ProductSpecificationUrl),
                "Restrictions on Hazardous Substances (RoHS) Material Composition URL" => {
                    Some(CodeR9)
                }
                "Installation Instructions URL" => Some(InstallationInstructionsUrl),
                "Service Manual URL" => Some(ServiceManualUrl),
                "Technical Bulletin URL" => Some(TechnicalBulletinUrl),
                "Video Clip URL" => Some(VideoClipUrl),
                "Wiring Diagram URL" => Some(WiringDiagramUrl),
                "Showing Phone" => Some(ShowingPhone),
                "3D Rendering URL" => Some(CodeTD),
                "Telephone" => Some(Telephone),
                "Telex" => Some(Telex),
                "Telemail" => Some(Telemail),
                "Teletex Number" => Some(TeletexNumber),
                "Text Message Address" => Some(TextMessageAddress),
                "TWX" => Some(Twx),
                "Uniform Resource Locator (URL)" => Some(CodeUR),
                "Voice Mail" => Some(VoiceMail),
                "Work Cellular" => Some(WorkCellular),
                "Work Facsimile Number" => Some(WorkFacsimileNumber),
                "Work Phone Number" => Some(WorkPhoneNumber),
                _ => None,
            }
        }
    }
}
impl Serialize for CommunicationNumberQualifier {
    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 = CommunicationNumberQualifier;
    fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
        formatter.write_str("Communication Number Qualifier")
    }
    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
    where
        E: de::Error,
    {
        CommunicationNumberQualifier::from_description(v)
            .ok_or_else(|| E::custom(
                format!("Invalid Communication Number Qualifier: {}", v),
            ))
    }
    fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E>
    where
        E: de::Error,
    {
        CommunicationNumberQualifier::from_code(v)
            .ok_or_else(|| E::custom(
                format!(
                    "Invalid Communication Number Qualifier: {}", std::str::from_utf8(v)
                    .unwrap()
                ),
            ))
    }
}
impl<'de> Deserialize<'de> for CommunicationNumberQualifier {
    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)
        }
    }
}