ed_journals/modules/odyssey/models/
item.rs

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
use std::fmt::{Display, Formatter};
use std::str::FromStr;

use lazy_static::lazy_static;
use regex::Regex;
use serde::Serialize;
use thiserror::Error;

use crate::from_str_deserialize_impl;

#[derive(Debug, Serialize, Clone, PartialEq)]
#[cfg_attr(not(feature = "allow-unknown"), non_exhaustive)]
pub enum Item {
    // Data
    AccidentLogs,
    AirQualityReports,
    AtmosphericData,
    AudioLogs,
    AxCombatLogs,
    BallisticsData,
    BiologicalWeaponData,
    BiometricData,
    BlacklistData,
    BloodTestResults,
    CampaignPlans,
    CatMedia,
    CensusData,
    ChemicalExperimentData,
    ChemicalFormulae,
    ChemicalInventory,
    ChemicalPatents,
    ChemicalWeaponData,
    ClassicEntertainment,
    ClinicalTrialRecords,
    CocktailRecipes,
    CombatTrainingMaterial,
    CombatantPerformance,
    ConflictHistory,
    CriminalRecords,
    CropYieldAnalysis,
    CulinaryRecipes,
    DigitalDesigns,
    DutyRota,
    EmployeeDirectory,
    EmployeeExpenses,
    EmployeeGeneticData,
    EmploymentHistory,
    EnhancedInterrogationRecordings,
    EspionageMaterial,
    EvacuationProtocols,
    ExplorationJournals,
    ExtractionYieldData,
    FactionAssociates,
    FactionDonatorList,
    FactionNews,
    FinancialProjections,
    FleetRegistry,
    GeneSequencingData,
    GeneticResearch,
    GeologicalData,
    HydroponicData,
    IncidentLogs,
    InfluenceProjections,
    InternalCorrespondence,
    InterrogationRecordings,
    InterviewRecordings,
    JobApplications,
    Kompromat,
    LiteraryFiction,
    MaintenanceLogs,
    ManufacturingInstructions,
    MedicalRecords,
    MeetingMinutes,
    MineralSurvey,
    MiningAnalytics,
    MultimediaEntertainment,
    NetworkAccessHistory,
    NetworkSecurityProtocols,
    NextOfKinRecords,
    NocData,
    OperationalManual,
    OpinionPolls,
    PatientHistory,
    PatrolRoutes,
    PayrollInformation,
    PersonalLogs,
    PharmaceuticalPatents,
    PhotoAlbums,
    PlantGrowthCharts,
    PoliticalAffiliations,
    PrisonerLogs,
    ProductionReports,
    ProductionSchedule,
    Propaganda,
    PurchaseRecords,
    PurchaseRequests,
    RadioactivityData,
    ReactorOutputReview,
    RecyclingLogs,
    ResidentialDirectory,
    RiskAssessments,
    SalesRecords,
    SecurityExpenses,
    SeedGeneaology,
    SettlementAssaultPlans,
    SettlementDefencePlans,
    ShareholderInformation,
    SlushFundLogs,
    SmearCampaignPlans,
    SpectralAnalysisData,
    Spyware,
    StellarActivityLogs,
    SurveillanceLogs,
    TacticalPlans,
    TaxRecords,
    TopographicalSurveys,
    TravelPermits,
    TroopDeploymentRecords,
    UnionMembership,
    VaccinationRecords,
    VaccineResearch,
    VipSecurityDetail,
    VirologyData,
    Virus,
    VisitorRegister,
    WeaponInventory,
    WeaponTestData,
    XenoDefenceProtocols,

    // Goods
    AgriculturalProcessSample,
    BiochemicalAgent,
    BiologicalSample,
    BuildingSchematic,
    Californium,
    CastFossil,
    ChemicalProcessSample,
    ChemicalSample,
    CompactLibrary,
    CompressionLiquefiedGas,
    ContaminatedSpireRefineryCompound,
    DeepMantleSample,
    DegradedPowerRegulator,
    GMeds,
    GeneticRepairMeds,
    HealthMonitor,
    Hush,
    InertiaCanister,
    Infinity,
    InorganicContaminant,
    Insight,
    InsightDataBank,
    InsightEntertainmentSuite,
    IonisedGas,
    Lazarus,
    MicrobialInhibitor,
    MutagenicCatalyst,
    NutritionalConcentrate,
    PersonalComputer,
    PersonalDocuments,
    PetrifiedFossil,
    PowerRegulator,
    Push,
    PyrolyticCatalyst,
    RefinementProcessSample,
    ShipSchematic,
    SpireRefineryCompound,
    SuitSchematic,
    SurveillanceEquipment,
    SyntheticGenome,
    SyntheticPathogen,
    TrueFormFossil,
    UniversalTranslator,
    VehicleSchematic,
    WeaponSchematic,

    // Chemicals
    Aerogel,
    ChemicalCatalyst,
    ChemicalSuperbase,
    Epinephrine,
    EpoxyAdhesive,
    Graphene,
    OxygenicBacteria,
    PHNeutraliser,
    RDX,
    ViscoelasticPolymer,

    // Circuits
    CircuitBoard,
    CircuitSwitch,
    ElectricalFuse,
    ElectricalWiring,
    Electromagnet,
    IonBattery,
    MetalCoil,
    MicroSupercapacitor,
    MicroTransformer,
    Microelectrode,
    Motor,
    OpticalFibre,

    // Tech
    CarbonFibrePlating,
    EncryptedMemoryChip,
    MemoryChip,
    MicroHydraulics,
    MicroThrusters,
    OpticalLens,
    Scrambler,
    TitaniumPlating,
    Transmitter,
    TungstenCarbide,
    WeaponComponent,

    // Consumables
    EnergyCell,
    FragGranade,
    Medkit,
    ShieldDisruptor,
    ShieldProjector,
    EBreach,

    #[cfg(feature = "allow-unknown")]
    #[cfg_attr(docsrs, doc(cfg(feature = "allow-unknown")))]
    Unknown(String),
}

#[derive(Debug, Error)]
pub enum ItemError {
    #[error("Unknown item: '{0}'")]
    UnknownItem(String),
}

impl Item {
    fn name_to_item(name: &str) -> Result<Item, ItemError> {
        let lower_case: &str = &name.to_ascii_lowercase();

        Ok(match lower_case {
            // Data
            "accidentlogs" => Item::AccidentLogs,
            "airqualityreports" => Item::AirQualityReports,
            "atmosphericdata" => Item::AtmosphericData,
            "audiologs" => Item::AudioLogs,
            "axcombatlogs" => Item::AxCombatLogs,
            "ballisticsdata" => Item::BallisticsData,
            "biologicalweapondata" => Item::BiologicalWeaponData,
            "biometricdata" => Item::BiometricData,
            "blacklistdata" => Item::BlacklistData,
            "bloodtestresults" => Item::BloodTestResults,
            "campaignplans" => Item::CampaignPlans,
            "catmedia" => Item::CatMedia,
            "censusdata" => Item::CensusData,
            "chemicalexperimentdata" => Item::ChemicalExperimentData,
            "chemicalformulae" => Item::ChemicalFormulae,
            "chemicalinventory" => Item::ChemicalInventory,
            "chemicalpatents" => Item::ChemicalPatents,
            "chemicalweapondata" => Item::ChemicalWeaponData,
            "classicentertainment" => Item::ClassicEntertainment,
            "medicaltrialrecords" => Item::ClinicalTrialRecords,
            "cocktailrecipes" => Item::CocktailRecipes,
            "combattrainingmaterial" => Item::CombatTrainingMaterial,
            "combatantperformance" => Item::CombatantPerformance,
            "conflicthistory" => Item::ConflictHistory,
            "criminalrecords" => Item::CriminalRecords,
            "cropyieldanalysis" => Item::CropYieldAnalysis,
            "culinaryrecipes" => Item::CulinaryRecipes,
            "digitaldesigns" => Item::DigitalDesigns,
            "dutyrota" => Item::DutyRota,
            "employeedirectory" => Item::EmployeeDirectory,
            "employeeexpenses" => Item::EmployeeExpenses,
            "employeegeneticdata" => Item::EmployeeGeneticData,
            "employmenthistory" => Item::EmploymentHistory,
            "enhancedinterrogationrecordings" => Item::EnhancedInterrogationRecordings,
            "espionagematerial" => Item::EspionageMaterial,
            "evacuationprotocols" => Item::EvacuationProtocols,
            "explorationjournals" => Item::ExplorationJournals,
            "extractionyielddata" => Item::ExtractionYieldData,
            "factionassociates" => Item::FactionAssociates,
            "factiondonatorlist" => Item::FactionDonatorList,
            "factionnews" => Item::FactionNews,
            "financialprojections" => Item::FinancialProjections,
            "fleetregistry" => Item::FleetRegistry,
            "genesequencingdata" => Item::GeneSequencingData,
            "geneticresearch" => Item::GeneticResearch,
            "geologicaldata" => Item::GeologicalData,
            "hydroponicdata" => Item::HydroponicData,
            "incidentlogs" => Item::IncidentLogs,
            "influenceprojections" => Item::InfluenceProjections,
            "internalcorrespondence" => Item::InternalCorrespondence,
            "interrogationrecordings" => Item::InterrogationRecordings,
            "interviewrecordings" => Item::InterviewRecordings,
            "jobapplications" => Item::JobApplications,
            "kompromat" => Item::Kompromat,
            "literaryfiction" => Item::LiteraryFiction,
            "maintenancelogs" => Item::MaintenanceLogs,
            "manufacturinginstructions" => Item::ManufacturingInstructions,
            "medicalrecords" => Item::MedicalRecords,
            "meetingminutes" => Item::MeetingMinutes,
            "mineralsurvey" => Item::MineralSurvey,
            "mininganalytics" => Item::MiningAnalytics,
            "multimediaentertainment" => Item::MultimediaEntertainment,
            "networkaccesshistory" => Item::NetworkAccessHistory,
            "networksecurityprotocols" => Item::NetworkSecurityProtocols,
            "nextofkinrecords" => Item::NextOfKinRecords,
            "nocdata" => Item::NocData,
            "operationalmanual" => Item::OperationalManual,
            "opinionpolls" => Item::OpinionPolls,
            "patienthistory" => Item::PatientHistory,
            "patrolroutes" => Item::PatrolRoutes,
            "payrollinformation" => Item::PayrollInformation,
            "personallogs" => Item::PersonalLogs,
            "pharmaceuticalpatents" => Item::PharmaceuticalPatents,
            "photoalbums" => Item::PhotoAlbums,
            "plantgrowthcharts" => Item::PlantGrowthCharts,
            "politicalaffiliations" => Item::PoliticalAffiliations,
            "prisonerlogs" => Item::PrisonerLogs,
            "productionreports" => Item::ProductionReports,
            "productionschedule" => Item::ProductionSchedule,
            "propaganda" => Item::Propaganda,
            "purchaserecords" => Item::PurchaseRecords,
            "purchaserequests" => Item::PurchaseRequests,
            "radioactivitydata" => Item::RadioactivityData,
            "reactoroutputreview" => Item::ReactorOutputReview,
            "recyclinglogs" => Item::RecyclingLogs,
            "residentialdirectory" => Item::ResidentialDirectory,
            "riskassessments" => Item::RiskAssessments,
            "salesrecords" => Item::SalesRecords,
            "securityexpenses" => Item::SecurityExpenses,
            "seedgeneaology" => Item::SeedGeneaology,
            "settlementassaultplans" => Item::SettlementAssaultPlans,
            "settlementdefenceplans" => Item::SettlementDefencePlans,
            "shareholderinformation" => Item::ShareholderInformation,
            "slushfundlogs" => Item::SlushFundLogs,
            "smearcampaignplans" => Item::SmearCampaignPlans,
            "spectralanalysisdata" => Item::SpectralAnalysisData,
            "spyware" => Item::Spyware,
            "stellaractivitylogs" => Item::StellarActivityLogs,
            "surveilleancelogs" => Item::SurveillanceLogs,
            "tacticalplans" => Item::TacticalPlans,
            "taxrecords" => Item::TaxRecords,
            "topographicalsurveys" => Item::TopographicalSurveys,
            "travelpermits" => Item::TravelPermits,
            "troopdeploymentrecords" => Item::TroopDeploymentRecords,
            "unionmembership" => Item::UnionMembership,
            "vaccinationrecords" => Item::VaccinationRecords,
            "vaccineresearch" => Item::VaccineResearch,
            "vipsecuritydetail" => Item::VipSecurityDetail,
            "virologydata" => Item::VirologyData,
            "virus" => Item::Virus,
            "visitorregister" => Item::VisitorRegister,
            "weaponinventory" => Item::WeaponInventory,
            "weapontestdata" => Item::WeaponTestData,
            "xenodefenceprotocols" => Item::XenoDefenceProtocols,

            // Goods
            "agriculturalprocesssample" => Item::AgriculturalProcessSample,
            "biochemicalagent" => Item::BiochemicalAgent,
            "geneticsample" => Item::BiologicalSample,
            "buildingschematic" => Item::BuildingSchematic,
            "californium" => Item::Californium,
            "castfossil" => Item::CastFossil,
            "chemicalprocesssample" => Item::ChemicalProcessSample,
            "chemicalsample" => Item::ChemicalSample,
            "compactlibrary" => Item::CompactLibrary,
            "compressionliquefiedgas" => Item::CompressionLiquefiedGas,
            "contaminatedspirerefinerycompound" => Item::ContaminatedSpireRefineryCompound,
            "deepmantlesample" => Item::DeepMantleSample,
            "degradedpowerregulator" => Item::DegradedPowerRegulator,
            "gmeds" => Item::GMeds,
            "geneticrepairmeds" => Item::GeneticRepairMeds,
            "healthmonitor" => Item::HealthMonitor,
            "hush" => Item::Hush,
            "inertiacanister" => Item::InertiaCanister,
            "infinity" => Item::Infinity,
            "inorganiccontaminant" => Item::InorganicContaminant,
            "insight" => Item::Insight,
            "insightdatabank" => Item::InsightDataBank,
            "insightentertainmentsuite" => Item::InsightEntertainmentSuite,
            "ionisedgas" => Item::IonisedGas,
            "lazarus" => Item::Lazarus,
            "microbialinhibitor" => Item::MicrobialInhibitor,
            "mutageniccatalyst" => Item::MutagenicCatalyst,
            "nutritionalconcentrate" => Item::NutritionalConcentrate,
            "personalcomputer" => Item::PersonalComputer,
            "personaldocuments" => Item::PersonalDocuments,
            "petrifiedfossil" => Item::PetrifiedFossil,
            "largecapacitypowerregulator" => Item::PowerRegulator,
            "push" => Item::Push,
            "pyrolyticcatalyst" => Item::PyrolyticCatalyst,
            "refinementprocesssample" => Item::RefinementProcessSample,
            "shipschematic" => Item::ShipSchematic,
            "spirerefinerycompound" => Item::SpireRefineryCompound,
            "suitschematic" => Item::SuitSchematic,
            "surveillanceequipment" => Item::SurveillanceEquipment,
            "syntheticgenome" => Item::SyntheticGenome,
            "syntheticpathogen" => Item::SyntheticPathogen,
            "trueformfossil" => Item::TrueFormFossil,
            "universaltranslator" => Item::UniversalTranslator,
            "vehicleschematic" => Item::VehicleSchematic,
            "weaponschematic" => Item::WeaponSchematic,

            // Chemicals
            "aerogel" => Item::Aerogel,
            "chemicalcatalyst" => Item::ChemicalCatalyst,
            "chemicalsuperbase" => Item::ChemicalSuperbase,
            "epinephrine" => Item::Epinephrine,
            "epoxyadhesive" => Item::EpoxyAdhesive,
            "graphene" => Item::Graphene,
            "oxygenicbacteria" => Item::OxygenicBacteria,
            "phneutraliser" => Item::PHNeutraliser,
            "rdx" => Item::RDX,
            "viscoelasticpolymer" => Item::ViscoelasticPolymer,

            "circuitboard" => Item::CircuitBoard,
            "circuitswitch" => Item::CircuitSwitch,
            "electricalfuse" => Item::ElectricalFuse,
            "electricalwiring" => Item::ElectricalWiring,
            "electromagnet" => Item::Electromagnet,
            "ionbattery" => Item::IonBattery,
            "metalcoil" => Item::MetalCoil,
            "microsupercapacitor" => Item::MicroSupercapacitor,
            "microtransformer" => Item::MicroTransformer,
            "microelectrode" => Item::Microelectrode,
            "motor" => Item::Motor,
            "opticalfibre" => Item::OpticalFibre,

            "carbonfibreplating" => Item::CarbonFibrePlating,
            "encryptedmemorychip" => Item::EncryptedMemoryChip,
            "memorychip" => Item::MemoryChip,
            "microhydraulics" => Item::MicroHydraulics,
            "microthrusters" => Item::MicroThrusters,
            "opticallens" => Item::OpticalLens,
            "scrambler" => Item::Scrambler,
            "titaniumplating" => Item::TitaniumPlating,
            "transmitter" => Item::Transmitter,
            "tungstencarbide" => Item::TungstenCarbide,
            "weaponcomponent" => Item::WeaponComponent,

            "energycell" => Item::EnergyCell,
            "amm_grenade_frag" => Item::FragGranade,
            "healthpack" => Item::Medkit,
            "amm_grenade_emp" => Item::ShieldDisruptor,
            "amm_grenade_shield" => Item::ShieldProjector,
            "bypass" => Item::EBreach,

            #[cfg(feature = "allow-unknown")]
            _ => Item::Unknown(name.to_string()),

            #[cfg(not(feature = "allow-unknown"))]
            _ => return Err(ItemError::UnknownItem(name.to_string())),
        })
    }
}

lazy_static! {
    static ref ITEM_NAME_REGEX: Regex = Regex::new(r#"^\$?([a-zA-Z_]+?)(_[nN]ame;)?$"#).unwrap();
}

impl FromStr for Item {
    type Err = ItemError;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let Some(captures) = ITEM_NAME_REGEX.captures(s) else {
            return Err(ItemError::UnknownItem(s.to_string()));
        };

        Item::name_to_item(
            captures
                .get(1)
                .expect("Should have been captured already")
                .as_str(),
        )
    }
}

from_str_deserialize_impl!(Item);

impl Display for Item {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        write!(
            f,
            "{}",
            match self {
                // Data
                Item::AccidentLogs => "Accident Logs",
                Item::AirQualityReports => "Air Quality Reports",
                Item::AtmosphericData => "Atmospheric Data",
                Item::AudioLogs => "Audio Logs",
                Item::AxCombatLogs => "AX Combat Logs",
                Item::BallisticsData => "Ballistics Data",
                Item::BiologicalWeaponData => "Biological Weapon Data",
                Item::BiometricData => "Biometric Data",
                Item::BlacklistData => "Blacklist Data",
                Item::BloodTestResults => "Blood Test Results",
                Item::CampaignPlans => "Campaign Plans",
                Item::CatMedia => "Cat Media",
                Item::CensusData => "Census Data",
                Item::ChemicalExperimentData => "Chemical Experiment Data",
                Item::ChemicalFormulae => "Chemical Formulae",
                Item::ChemicalInventory => "Chemical Inventory",
                Item::ChemicalPatents => "Chemical Patents",
                Item::ChemicalWeaponData => "Chemical Weapon Data",
                Item::ClassicEntertainment => "Classic Entertainment",
                Item::ClinicalTrialRecords => "Clinical Trial Records",
                Item::CocktailRecipes => "Cocktail Recipes",
                Item::CombatTrainingMaterial => "Combat Training Material",
                Item::CombatantPerformance => "Combatant Performance",
                Item::ConflictHistory => "Conflict History",
                Item::CriminalRecords => "Criminal Records",
                Item::CropYieldAnalysis => "Crop Yield Analysis",
                Item::CulinaryRecipes => "Culinary Recipes",
                Item::DigitalDesigns => "Digital Designs",
                Item::DutyRota => "Duty Rota",
                Item::EmployeeDirectory => "Employee Directory",
                Item::EmployeeExpenses => "Employee Expenses",
                Item::EmployeeGeneticData => "Employee Genetic Data",
                Item::EmploymentHistory => "Employment History",
                Item::EnhancedInterrogationRecordings => "Enhanced Interrogation Recordings",
                Item::EspionageMaterial => "Espionage Material",
                Item::EvacuationProtocols => "Evacuation Protocols",
                Item::ExplorationJournals => "Exploration Journals",
                Item::ExtractionYieldData => "Extraction Yield Data",
                Item::FactionAssociates => "Faction Associates",
                Item::FactionDonatorList => "Faction Donator List",
                Item::FactionNews => "Faction News",
                Item::FinancialProjections => "Financial Projections",
                Item::FleetRegistry => "Fleet Registry",
                Item::GeneSequencingData => "Gene Sequencing Data",
                Item::GeneticResearch => "Genetic Research",
                Item::GeologicalData => "Geological Data",
                Item::HydroponicData => "Hydroponic Data",
                Item::IncidentLogs => "Incident Logs",
                Item::InfluenceProjections => "Influence Projections",
                Item::InternalCorrespondence => "Internal Correspondence",
                Item::InterrogationRecordings => "Interrogation Recordings",
                Item::InterviewRecordings => "Interview Recordings",
                Item::JobApplications => "Job Applications",
                Item::Kompromat => "Kompromat",
                Item::LiteraryFiction => "Literary Fiction",
                Item::MaintenanceLogs => "Maintenance Logs",
                Item::ManufacturingInstructions => "Manufacturing Instructions",
                Item::MedicalRecords => "Medical Records",
                Item::MeetingMinutes => "Meeting Minutes",
                Item::MineralSurvey => "Mineral Survey",
                Item::MiningAnalytics => "Mining Analytics",
                Item::MultimediaEntertainment => "Multimedia Entertainment",
                Item::NetworkAccessHistory => "Network Access History",
                Item::NetworkSecurityProtocols => "Network Security Protocols",
                Item::NextOfKinRecords => "Next of Kin Records",
                Item::NocData => "NOC Data",
                Item::OperationalManual => "Operational Manual",
                Item::OpinionPolls => "Opinion Polls",
                Item::PatientHistory => "Patient History",
                Item::PatrolRoutes => "Patrol Routes",
                Item::PayrollInformation => "Payroll Information",
                Item::PersonalLogs => "Personal Logs",
                Item::PharmaceuticalPatents => "Pharmaceutical Patents",
                Item::PhotoAlbums => "Photo Albums",
                Item::PlantGrowthCharts => "Plant Growth Charts",
                Item::PoliticalAffiliations => "Political Affiliations",
                Item::PrisonerLogs => "Prisoner Logs",
                Item::ProductionReports => "Production Reports",
                Item::ProductionSchedule => "Production Schedule",
                Item::Propaganda => "Propaganda",
                Item::PurchaseRecords => "Purchase Records",
                Item::PurchaseRequests => "Purchase Requests",
                Item::RadioactivityData => "Radioactivity Data",
                Item::ReactorOutputReview => "Reactor Output Review",
                Item::RecyclingLogs => "Recycling Logs",
                Item::ResidentialDirectory => "Residential Directory",
                Item::RiskAssessments => "Risk Assessments",
                Item::SalesRecords => "Sales Records",
                Item::SecurityExpenses => "Security Expenses",
                Item::SeedGeneaology => "Seed Geneaology",
                Item::SettlementAssaultPlans => "Settlement Assault Plans",
                Item::SettlementDefencePlans => "Settlement Defence Plans",
                Item::ShareholderInformation => "Shareholder Information",
                Item::SlushFundLogs => "Slush Fund Logs",
                Item::SmearCampaignPlans => "Smear Campaign Plans",
                Item::SpectralAnalysisData => "Spectral Analysis Data",
                Item::Spyware => "Spyware",
                Item::StellarActivityLogs => "Stellar Activity Logs",
                Item::SurveillanceLogs => "Surveillance Logs",
                Item::TacticalPlans => "Tactical Plans",
                Item::TaxRecords => "Tax Records",
                Item::TopographicalSurveys => "Topographical Surveys",
                Item::TravelPermits => "Travel Permits",
                Item::TroopDeploymentRecords => "Troop Deployment Records",
                Item::UnionMembership => "Union Membership",
                Item::VaccinationRecords => "Vaccination Records",
                Item::VaccineResearch => "Vaccine Research",
                Item::VipSecurityDetail => "VIP Security Detail",
                Item::VirologyData => "Virology Data",
                Item::Virus => "Virus",
                Item::VisitorRegister => "Visitor Register",
                Item::WeaponInventory => "Weapon Inventory",
                Item::WeaponTestData => "Weapon Test Data",
                Item::XenoDefenceProtocols => "Xeno-Defence Protocols",

                // Goods
                Item::AgriculturalProcessSample => "Agricultural Process Sample",
                Item::BiochemicalAgent => "Biochemical Agent",
                Item::BiologicalSample => "Biological Sample",
                Item::BuildingSchematic => "Building Schematic",
                Item::Californium => "Californium",
                Item::CastFossil => "Cast Fossil",
                Item::ChemicalProcessSample => "Chemical Process Sample",
                Item::ChemicalSample => "Chemical Sample",
                Item::CompactLibrary => "Compact Library",
                Item::CompressionLiquefiedGas => "Compression-Liquefied Gas",
                Item::ContaminatedSpireRefineryCompound => "Contaminated Spire Refinery Compound",
                Item::DeepMantleSample => "Deep Mantle Sample",
                Item::DegradedPowerRegulator => "Degraded Power Regulator",
                Item::GMeds => "G-Meds",
                Item::GeneticRepairMeds => "Genetic Repair Meds",
                Item::HealthMonitor => "Health Monitor",
                Item::Hush => "Hush",
                Item::InertiaCanister => "Inertia Canister",
                Item::Infinity => "Infinity",
                Item::InorganicContaminant => "Inorganic Contaminant",
                Item::Insight => "Insight",
                Item::InsightDataBank => "Insight Data Bank",
                Item::InsightEntertainmentSuite => "Insight Entertainment Suite",
                Item::IonisedGas => "Ionised Gas",
                Item::Lazarus => "Lazarus",
                Item::MicrobialInhibitor => "Microbial Inhibitor",
                Item::MutagenicCatalyst => "Mutagenic Catalyst",
                Item::NutritionalConcentrate => "Nutritional Concentrate",
                Item::PersonalComputer => "Personal Computer",
                Item::PersonalDocuments => "Personal Documents",
                Item::PetrifiedFossil => "Petrified Fossil",
                Item::PowerRegulator => "Power Regulator",
                Item::Push => "Push",
                Item::PyrolyticCatalyst => "Pyrolytic Catalyst",
                Item::RefinementProcessSample => "Refinement Process Sample",
                Item::ShipSchematic => "Ship Schematic",
                Item::SpireRefineryCompound => "Spire Refinery Compound",
                Item::SuitSchematic => "Suit Schematic",
                Item::SurveillanceEquipment => "Surveillance Equipment",
                Item::SyntheticGenome => "Synthetic Genome",
                Item::SyntheticPathogen => "Synthetic Pathogen",
                Item::TrueFormFossil => "True Form Fossil",
                Item::UniversalTranslator => "Universal Translator",
                Item::VehicleSchematic => "Vehicle Schematic",
                Item::WeaponSchematic => "Weapon Schematic",

                // Chemicals
                Item::Aerogel => "Aerogel",
                Item::ChemicalCatalyst => "Chemical Catalyst",
                Item::ChemicalSuperbase => "Chemical Superbase",
                Item::Epinephrine => "Epinephrine",
                Item::EpoxyAdhesive => "Epoxy Adhesive",
                Item::Graphene => "Graphene",
                Item::OxygenicBacteria => "Oxygenic Bacteria",
                Item::PHNeutraliser => "pH Neutraliser",
                Item::RDX => "RDX",
                Item::ViscoelasticPolymer => "Viscoelastic Polymer",

                // Circuits
                Item::CircuitBoard => "Circuit Board",
                Item::CircuitSwitch => "Circuit Switch",
                Item::ElectricalFuse => "Electrical Fuse",
                Item::ElectricalWiring => "Electrical Wiring",
                Item::Electromagnet => "Electromagnet",
                Item::IonBattery => "Ion Battery",
                Item::MetalCoil => "Metal Coil",
                Item::MicroSupercapacitor => "Micro Supercapacitor",
                Item::MicroTransformer => "Micro Transformer",
                Item::Microelectrode => "Microelectrode",
                Item::Motor => "Motor",
                Item::OpticalFibre => "Optical Fibre",

                // Tech
                Item::CarbonFibrePlating => "Carbon Fibre Plating",
                Item::EncryptedMemoryChip => "Encrypted Memory Chip",
                Item::MemoryChip => "Memory Chip",
                Item::MicroHydraulics => "Micro Hydraulics",
                Item::MicroThrusters => "Micro Thrusters",
                Item::OpticalLens => "Micro Thrusters",
                Item::Scrambler => "Optical Lens",
                Item::TitaniumPlating => "Titanium Plating",
                Item::Transmitter => "Scrambler",
                Item::TungstenCarbide => "Titanium Plating",
                Item::WeaponComponent => "Transmitter",

                // Consumables
                Item::EnergyCell => "Energy Cell",
                Item::FragGranade => "Frag Grenade",
                Item::Medkit => "Medkit",
                Item::ShieldDisruptor => "Shield Disruptor",
                Item::ShieldProjector => "Shield Projector",
                Item::EBreach => "E-Breach",

                #[cfg(feature = "allow-unknown")]
                Item::Unknown(unknown) => return write!(f, "Unknown item: {}", unknown),
            }
        )
    }
}

#[cfg(test)]
mod tests {
    use std::str::FromStr;

    use crate::modules::odyssey::Item;

    #[test]
    fn item_test_cases_are_parsed_correctly() {
        let test_cases = [
            (
                "$EnhancedInterrogationRecordings_Name;",
                Item::EnhancedInterrogationRecordings,
            ),
            ("$WeaponSchematic_Name;", Item::WeaponSchematic),
        ];

        for (case, expected) in test_cases {
            let result = Item::from_str(case);

            assert!(result.is_ok());
            assert_eq!(result.unwrap(), expected);
        }
    }
}