# frozen_string_literal: true

module Kanrisuru
  class Util
    class DmiType
      ## https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.4.0.pdf
      @dmi_type_fields = {
        'BIOS' => {
          characteristics: [
            'BIOS characteristics not supported',
            'ISA is supported',
            'MCA is supported',
            'EISA is supported',
            'PCI is supported',
            'PC Card (PCMCIA) is supported',
            'PNP is supported',
            'APM is supported',
            'BIOS is upgradeable',
            'BIOS shadowing is allowed',
            'VLB is supported',
            'ESCD support is available',
            'Boot from CD is supported',
            'Selectable boot is supported',
            'BIOS ROM is socketed',
            'Boot from PC Card (PCMCIA) is supported',
            'EDD is supported',
            'Japanese floppy for NEC 9800 1.2 MB is supported (int 13h)',
            'Japanese floppy for Toshiba 1.2 MB is supported (int 13h)',
            '5.25"/360 kB floppy services are supported (int 13h)',
            '5.25"/1.2 MB floppy services are supported (int 13h)',
            '3.5"/720 kB floppy services are supported (int 13h)',
            '3.5"/2.88 MB floppy services are supported (int 13h)',
            'Print screen service is supported (int 5h)',
            '8042 keyboard services are supported (int 9h)',
            'Serial services are supported (int 14h)',
            'Printer services are supported (int 17h)',
            'CGA/mono video services are supported (int 10h)',
            'NEC PC-98'
          ],
          characteristics_x1: [
            'ACPI is supported',
            'USB legacy is supported',
            'AGP is supported',
            'I2O boot is supported',
            'LS-120 boot is supported',
            'ATAPI Zip drive boot is supported',
            'IEEE 1394 boot is supported',
            'Smart battery is supported'
          ],
          characteristics_x2: [
            'BIOS boot specification is supported',
            'Function key-initiated network boot is supported',
            'Targeted content distribution is supported',
            'UEFI is supported',
            'System is a virtual machine'
          ]
        },
        'System' => {
          wake_up_type: [
            'Reserved',
            'Other',
            'Unknown',
            'APM Timer',
            'Modem Ring',
            'LAN Remote',
            'Power Switch',
            'PCI PME#',
            'AC Power Restored'
          ]
        },
        'Baseboard' => {
          features: [
            'Board is a hosting board',
            'Board requires at least one daughter board',
            'Board is removable',
            'Board is replaceable',
            'Board is hot swappable'
          ],
          type: [
            'Unknown',
            'Other',
            'Server Blade',
            'Connectivity Switch',
            'System Management Module',
            'Processor Module',
            'I/O Module',
            'Memory Module',
            'Daughter Board',
            'Motherboard',
            'Processor+Memory Module',
            'Processor+I/O Module',
            'Interconnect Board'
          ]
        },
        'Chassis' => {
          types: [
            'Other',
            'Unknown',
            'Desktop',
            'Low Profile Desktop',
            'Pizza Box',
            'Mini Tower',
            'Tower',
            'Portable',
            'Laptop',
            'Notebook',
            'Hand Held',
            'Docking Station',
            'All In One',
            'Sub Notebook',
            'Space-saving',
            'Lunch Box',
            'Main Server Chassis',
            'Expansion Chassis',
            'Sub Chassis',
            'Bus Expansion Chassis',
            'Peripheral Chassis',
            'RAID Chassis',
            'Rack Mount Chassis',
            'Sealed-case PC',
            'Multi-system',
            'CompactPCI',
            'AdvancedTCA',
            'Blade',
            'Blade Enclosing',
            'Tablet',
            'Convertible',
            'Detachable',
            'IoT Gateway',
            'Embedded PC',
            'Mini PC',
            'Stick PC'
          ],
          security_status: [
            'Other',
            'Unknown',
            'None',
            'External Interface Locked Out',
            'External Interface Enabled'
          ],
          states: [
            'Other',
            'Unknown',
            'Safe',
            'Warning',
            'Critical',
            'Non-recoverable'
          ]
        },
        'Processor' => {
          type: [
            'Other',
            'Unknown',
            'Central Processor',
            'Math Processor',
            'DSP Processor',
            'Video Processor'
          ],
          family: [
            'Other',
            'Unknown',
            '8086',
            '80286',
            '80386',
            '80486',
            '8087',
            '80287',
            '80387',
            '80487',
            'Pentium',
            'Pentium Pro',
            'Pentium II',
            'Pentium MMX',
            'Celeron',
            'Pentium II Xeon',
            'Pentium III',
            'M1',
            'M2',
            'Celeron M',
            'Pentium 4 HT',
            'Duron',
            'K5',
            'K6',
            'K6-2',
            'K6-3',
            'Athlon',
            'AMD29000',
            'K6-2+',
            'Power PC',
            'Power PC 601',
            'Power PC 603',
            'Power PC 603+',
            'Power PC 604',
            'Power PC 620',
            'Power PC x704',
            'Power PC 750',
            'Core Duo',
            'Core Duo Mobile',
            'Core Solo Mobile',
            'Atom',
            'Core M',
            'Core m3',
            'Core m5',
            'Core m7',
            'Alpha',
            'Alpha 21064',
            'Alpha 21066',
            'Alpha 21164',
            'Alpha 21164PC',
            'Alpha 21164a',
            'Alpha 21264',
            'Alpha 21364',
            'Turion II Ultra Dual-Core Mobile M',
            'Turion II Dual-Core Mobile M',
            'Athlon II Dual-Core M',
            'Opteron 6100',
            'Opteron 4100',
            'Opteron 6200',
            'Opteron 4200',
            'FX',
            'MIPS',
            'MIPS R4000',
            'MIPS R4200',
            'MIPS R4400',
            'MIPS R4600',
            'MIPS R10000',
            'C-Series',
            'E-Series',
            'A-Series',
            'G-Series',
            'Z-Series',
            'R-Series',
            'Opteron 4300',
            'Opteron 6300',
            'Opteron 3300',
            'FirePro',
            'SPARC',
            'SuperSPARC',
            'MicroSPARC II',
            'MicroSPARC IIep',
            'UltraSPARC',
            'UltraSPARC II',
            'UltraSPARC IIi',
            'UltraSPARC III',
            'UltraSPARC IIIi',
            '68040',
            '68xxx',
            '68000',
            '68010',
            '68020',
            '68030',
            'Athlon X4',
            'Opteron X1000',
            'Opteron X2000',
            'Opteron A-Series',
            'Opteron X3000',
            'Zen',
            'Hobbit',
            'Crusoe TM5000',
            'Crusoe TM3000',
            'Efficeon TM8000',
            'Weitek',
            'Itanium',
            'Athlon 64',
            'Opteron',
            'Sempron',
            'Turion 64',
            'Dual-Core Opteron',
            'Athlon 64 X2',
            'Turion 64 X2',
            'Quad-Core Opteron',
            'Third-Generation Opteron',
            'Phenom FX',
            'Phenom X4',
            'Phenom X2',
            'Athlon X2',
            'PA-RISC',
            'PA-RISC 8500',
            'PA-RISC 8000',
            'PA-RISC 7300LC',
            'PA-RISC 7200',
            'PA-RISC 7100LC',
            'PA-RISC 7100',
            'V30',
            'Quad-Core Xeon 3200',
            'Dual-Core Xeon 3000',
            'Quad-Core Xeon 5300',
            'Dual-Core Xeon 5100',
            'Dual-Core Xeon 5000',
            'Dual-Core Xeon LV',
            'Dual-Core Xeon ULV',
            'Dual-Core Xeon 7100',
            'Quad-Core Xeon 5400',
            'Quad-Core Xeon',
            'Dual-Core Xeon 5200',
            'Dual-Core Xeon 7200',
            'Quad-Core Xeon 7300',
            'Quad-Core Xeon 7400',
            'Multi-Core Xeon 7400',
            'Pentium III Xeon',
            'Pentium III Speedstep',
            'Pentium 4',
            'Xeon',
            'AS400',
            'Xeon MP',
            'Athlon XP',
            'Athlon MP',
            'Itanium 2',
            'Pentium M',
            'Celeron D',
            'Pentium D',
            'Pentium EE',
            'Core Solo',
            'Core 2 Duo',
            'Core 2 Solo',
            'Core 2 Extreme',
            'Core 2 Quad',
            'Core 2 Extreme Mobile',
            'Core 2 Duo Mobile',
            'Core 2 Solo Mobile',
            'Core i7',
            'Dual-Core Celeron',
            'IBM390',
            'G4',
            'G5',
            'ESA/390 G6',
            'z/Architecture',
            'Core i5',
            'Core i3',
            'Core i9',
            'C7-M',
            'C7-D',
            'C7',
            'Eden',
            'Multi-Core Xeon',
            'Dual-Core Xeon 3xxx',
            'Quad-Core Xeon 3xxx',
            'Nano',
            'Dual-Core Xeon 5xxx',
            'Quad-Core Xeon 5xxx',
            'Dual-Core Xeon 7xxx',
            'Quad-Core Xeon 7xxx',
            'Multi-Core Xeon 7xxx',
            'Multi-Core Xeon 3400',
            'Opteron 3000',
            'Sempron II',
            'Embedded Opteron Quad-Core',
            'Phenom Triple-Core',
            'Turion Ultra Dual-Core Mobile',
            'Turion Dual-Core Mobile',
            'Athlon Dual-Core',
            'Sempron SI',
            'Phenom II',
            'Athlon II',
            'Six-Core Opteron',
            'Sempron M',
            'i860',
            'i960',
            'ARMv7',
            'ARMv8',
            'SH-3',
            'SH-4',
            'ARM',
            'StrongARM',
            '6x86',
            'MediaGX',
            'MII',
            'WinChip',
            'DSP',
            'Video Processor',
            'RV32',
            'RV64',
            'RV128'
          ],
          voltage: [
            '5.0 V',
            '3.3 V',
            '2.9 V'
          ],
          upgrade: [
            'Other',
            'Unknown',
            'Daughter Board',
            'ZIF Socket',
            'Replaceable Piggy Back',
            'None',
            'LIF Socket',
            'Slot 1',
            'Slot 2',
            '370-pin Socket',
            'Slot A',
            'Slot M',
            'Socket 423',
            'Socket A (Socket 462)',
            'Socket 478',
            'Socket 754',
            'Socket 940',
            'Socket 939',
            'Socket mPGA604',
            'Socket LGA771',
            'Socket LGA775',
            'Socket S1',
            'Socket AM2',
            'Socket F (1207)',
            'Socket LGA1366',
            'Socket G34',
            'Socket AM3',
            'Socket C32',
            'Socket LGA1156',
            'Socket LGA1567',
            'Socket PGA988A',
            'Socket BGA1288',
            'Socket rPGA988B',
            'Socket BGA1023',
            'Socket BGA1224',
            'Socket BGA1155',
            'Socket LGA1356',
            'Socket LGA2011',
            'Socket FS1',
            'Socket FS2',
            'Socket FM1',
            'Socket FM2',
            'Socket LGA2011-3',
            'Socket LGA1356-3',
            'Socket LGA1150',
            'Socket BGA1168',
            'Socket BGA1234',
            'Socket BGA1364',
            'Socket AM4',
            'Socket LGA1151',
            'Socket BGA1356',
            'Socket BGA1440',
            'Socket BGA1515',
            'Socket LGA3647-1',
            'Socket SP3',
            'Socket SP3r2',
            'Socket LGA2066',
            'Socket BGA1392',
            'Socket BGA1510',
            'Socket BGA1528',
            'Socket LGA4189',
            'Socket LGA1200'
          ],
          characteristics: [
            '64-bit capable',
            'Multi-Core',
            'Hardware Thread',
            'Execute Protection',
            'Enhanced Virtualization',
            'Power/Performance Control',
            '128-bit Capable',
            'Arm64 SoC ID'
          ],
          flags: [
            'FPU (Floating-point unit on-chip)',
            'VME (Virtual mode extension)',
            'DE (Debugging extension)',
            'PSE (Page size extension)',
            'TSC (Time stamp counter)',
            'MSR (Model specific registers)',
            'PAE (Physical address extension)',
            'MCE (Machine check exception)',
            'CX8 (CMPXCHG8 instruction supported)',
            'APIC (On-chip APIC hardware supported)',
            'SEP (Fast system call)',
            'MTRR (Memory type range registers)',
            'PGE (Page global enable)',
            'MCA (Machine check architecture)',
            'CMOV (Conditional move instruction supported)',
            'PAT (Page attribute table)',
            'PSE-36 (36-bit page size extension)',
            'PSN (Processor serial number present and enabled)',
            'CLFSH (CLFLUSH instruction supported)',
            'DS (Debug store)',
            'ACPI (ACPI supported)',
            'MMX (MMX technology supported)',
            'FXSR (FXSAVE and FXSTOR instructions supported)',
            'SSE (Streaming SIMD extensions)',
            'SSE2 (Streaming SIMD extensions 2)',
            'SS (Self-snoop)',
            'HTT (Multi-threading)',
            'TM (Thermal monitor supported)',
            'PBE (Pending break enabled)'
          ]
        },
        'Memory Contorller' => {
          error_detecting_method: [
            'Other',
            'Unknown',
            'None',
            '8-bit Parity',
            '32-bit ECC',
            '64-bit ECC',
            '128-bit ECC',
            'CRC'
          ],
          error_correcting_capability: [
            'Other',
            'Unknown',
            'None',
            'Single-bit Error Correcting',
            'Double-bit Error Correcting',
            'Error Scrubbing'
          ],
          interleave_support: [
            'Other',
            'Unknown',
            'One-way Interleave',
            'Two-way Interleave',
            'Four-way Interleave',
            'Eight-way Interleave',
            'Sixteen-way Interleave'
          ],
          speeds: [
            'Other',
            'Unknown',
            '70 ns',
            '60 ns',
            '50 ns'
          ]
        },
        'Memory Module' => {
          types: [
            'Other',
            'Unknown',
            'Standard',
            'FPM',
            'EDO',
            'Parity',
            'ECC',
            'SIMM',
            'DIMM',
            'Burst EDO',
            'SDRAM'
          ]
        },
        'Cache' => {
          sram_type: [
            'Other',
            'Unknown',
            'Non-burst',
            'Burst',
            'Pipeline Burst',
            'Synchronous',
            'Asynchronous'
          ],
          error_correction_type: [
            'Other',
            'Unknown',
            'None',
            'Parity',
            'Single-bit ECC',
            'Multi-bit ECC'
          ],
          system_cache_types: [
            'Other',
            'Unknown',
            'Instruction',
            'Data',
            'Unified'
          ],
          associativity: [
            'Other',
            'Unknown',
            'Direct Mapped',
            '2-way Set-associative',
            '4-way Set-associative',
            'Fully Associative',
            '8-way Set-associative',
            '16-way Set-associative',
            '12-way Set-associative',
            '24-way Set-associative',
            '32-way Set-associative',
            '48-way Set-associative',
            '64-way Set-associative',
            '20-way Set-associative'
          ]
        },
        'Port Connector' => {
          connector_types: [
            'None',
            'Centronics',
            'Mini Centronics',
            'Proprietary',
            'DB-25 male',
            'DB-25 female',
            'DB-15 male',
            'DB-15 female',
            'DB-9 male',
            'DB-9 female',
            'RJ-11',
            'RJ-45',
            '50 Pin MiniSCSI',
            'Mini DIN',
            'Micro DIN',
            'PS/2',
            'Infrared',
            'HP-HIL',
            'Access Bus (USB)',
            'SSA SCSI',
            'Circular DIN-8 male',
            'Circular DIN-8 female',
            'On Board IDE',
            'On Board Floppy',
            '9 Pin Dual Inline (pin 10 cut)',
            '25 Pin Dual Inline (pin 26 cut)',
            '50 Pin Dual Inline',
            '68 Pin Dual Inline',
            'On Board Sound Input From CD-ROM',
            'Mini Centronics Type-14',
            'Mini Centronics Type-26',
            'Mini Jack (headphones)',
            'BNC',
            'IEEE 1394',
            'SAS/SATA Plug Receptacle',
            'USB Type-C Receptacle',
            'PC-98',
            'PC-98 Hireso',
            'PC-H98',
            'PC-98 Note',
            'PC-98 Full',
            'Other'
          ],
          port_types: [
            'None',
            'Parallel Port XT/AT Compatible',
            'Parallel Port PS/2',
            'Parallel Port ECP',
            'Parallel Port EPP',
            'Parallel Port ECP/EPP',
            'Serial Port XT/AT Compatible',
            'Serial Port 16450 Compatible',
            'Serial Port 16550 Compatible',
            'Serial Port 16550A Compatible',
            'SCSI Port',
            'MIDI Port',
            'Joystick Port',
            'Keyboard Port',
            'Mouse Port',
            'SSA SCSI',
            'USB',
            'Firewire (IEEE P1394)',
            'PCMCIA Type I',
            'PCMCIA Type II',
            'PCMCIA Type III',
            'Cardbus',
            'Access Bus Port',
            'SCSI II',
            'SCSI Wide',
            'PC-98',
            'PC-98 Hireso',
            'PC-H98',
            'Video Port',
            'Audio Port',
            'Modem Port',
            'Network Port',
            'SATA',
            'SAS'
          ]
        },
        'System Slots' => {
          slot_type: [
            'Other',
            'Unknown',
            'ISA',
            'MCA',
            'EISA',
            'PCI',
            'PC Card (PCMCIA)',
            'VLB',
            'Proprietary',
            'Processor Card',
            'Proprietary Memory Card',
            'I/O Riser Card',
            'NuBus',
            'PCI-66',
            'AGP',
            'AGP 2x',
            'AGP 4x',
            'PCI-X',
            'AGP 8x',
            'M.2 Socket 1-DP',
            'M.2 Socket 1-SD',
            'M.2 Socket 2',
            'M.2 Socket 3',
            'MXM Type I',
            'MXM Type II',
            'MXM Type III',
            'MXM Type III-HE',
            'MXM Type IV',
            'MXM 3.0 Type A',
            'MXM 3.0 Type B',
            'PCI Express 2 SFF-8639 (U.2)',
            'PCI Express 3 SFF-8639 (U.2)',
            'PCI Express Mini 52-pin with bottom-side keep-outs',
            'PCI Express Mini 52-pin without bottom-side keep-outs',
            'PCI Express Mini 76-pin',
            'PCI Express 4 SFF-8639 (U.2)',
            'PCI Express 5 SFF-8639 (U.2)',
            'OCP NIC 3.0 Small Form Factor (SFF)',
            'OCP NIC 3.0 Large Form Factor (LFF)',
            'OCP NIC Prior to 3.0',
            'CXL FLexbus 1.0',
            'PC-98/C20',
            'PC-98/C24',
            'PC-98/E',
            'PC-98/Local Bus',
            'PC-98/Card',
            'PCI Express',
            'PCI Express x1',
            'PCI Express x2',
            'PCI Express x4',
            'PCI Express x8',
            'PCI Express x16',
            'PCI Express 2',
            'PCI Express 2 x1',
            'PCI Express 2 x2',
            'PCI Express 2 x4',
            'PCI Express 2 x8',
            'PCI Express 2 x16',
            'PCI Express 3',
            'PCI Express 3 x1',
            'PCI Express 3 x2',
            'PCI Express 3 x4',
            'PCI Express 3 x8',
            'PCI Express 3 x16',
            'PCI Express 4',
            'PCI Express 4 x1',
            'PCI Express 4 x2',
            'PCI Express 4 x4',
            'PCI Express 4 x8',
            'PCI Express 4 x16',
            'PCI Express 5',
            'PCI Express 5 x1',
            'PCI Express 5 x2',
            'PCI Express 5 x4',
            'PCI Express 5 x8',
            'PCI Express 5 x16',
            'PCI Express 6+',
            'EDSFF E1',
            'EDSFF E3'
          ],
          slot_width: [
            '8-bit',
            '16-bit',
            '32-bit',
            '64-bit',
            '128-bit',
            'x1',
            'x2',
            'x4',
            'x8',
            'x12',
            'x16',
            'x32'
          ],
          current_usage: [
            'Other',
            'Unknown',
            'Available',
            'In Use',
            'Unavailable'
          ],
          slot_length: [
            'Other',
            'Unknown',
            'Short',
            'Long',
            '2.5" drive form factor',
            '3.5" drive form factor'
          ],
          slot_characteristics1: [
            '5.0 V is provided',
            '3.3 V is provided',
            'Opening is shared',
            'PC Card-16 is supported',
            'Cardbus is supported',
            'Zoom Video is supported',
            'Modem ring resume is supported'
          ],
          slot_characteristics2: [
            'PME signal is supported',
            'Hot-plug devices are supported',
            'SMBus signal is supported',
            'PCIe slot bifurcation is supported',
            'Async/surprise removal is supported',
            'Flexbus slot, CXL 1.0 capable',
            'Flexbus slot, CXL 2.0 capable',
            'Unknown',
            'None'
          ]
        },
        'On Board Devices' => {
          device_types: [
            'Other',
            'Unknown',
            'Video',
            'SCSI Controller',
            'Ethernet',
            'Token Ring',
            'Sound',
            'PATA Controller',
            'SATA Controller',
            'SAS Controller'
          ]
        },
        'BIOS Language' => {
          format: [
            'Abbreviated',
            'Long'
          ]
        },
        'Physical Memory Array' => {
          location: [
            'Other',
            'Unknown',
            'System Board Or Motherboard',
            'ISA Add-on Card',
            'EISA Add-on Card',
            'PCI Add-on Card',
            'MCA Add-on Card',
            'PCMCIA Add-on Card',
            'Proprietary Add-on Card',
            'NuBus',
            'PC-98/C20 Add-on Card',
            'PC-98/C24 Add-on Card',
            'PC-98/E Add-on Card',
            'PC-98/Local Bus Add-on Card',
            'CXL Flexbus 1.0'
          ],
          use: [
            'Other',
            'Unknown',
            'System Memory',
            'Video Memory',
            'Flash Memory',
            'Non-volatile RAM',
            'Cache Memory'
          ],
          error_correction_types: [
            'Other',
            'Unknown',
            'None',
            'Parity',
            'Single-bit ECC',
            'Multi-bit ECC',
            'CRC'
          ]
        },
        'Memory Device' => {
          form_factor: [
            'Other',
            'Unknown',
            'SIMM',
            'SIP',
            'Chip',
            'DIP',
            'ZIP',
            'Proprietary Card',
            'DIMM',
            'TSOP',
            'Row Of Chips',
            'RIMM',
            'SODIMM',
            'SRIMM',
            'FB-DIMM',
            'Die'
          ],
          type: [
            'Other',
            'Unknown',
            'DRAM',
            'EDRAM',
            'VRAM',
            'SRAM',
            'RAM',
            'ROM',
            'Flash',
            'EEPROM',
            'FEPROM',
            'EPROM',
            'CDRAM',
            '3DRAM',
            'SDRAM',
            'SGRAM',
            'RDRAM',
            'DDR',
            'DDR2',
            'DDR2 FB-DIMM',
            'Reserved',
            'Reserved',
            'Reserved',
            'DDR3',
            'FBD2',
            'DDR4',
            'LPDDR',
            'LPDDR2',
            'LPDDR3',
            'LPDDR4',
            'Logical non-volatile device',
            'HBM',
            'HBM2',
            'DDR5',
            'LPDDR5'
          ],
          type_detail: [
            'Other',
            'Unknown',
            'Fast-paged',
            'Static Column',
            'Pseudo-static',
            'RAMBus',
            'Synchronous',
            'CMOS',
            'EDO',
            'Window DRAM',
            'Cache DRAM',
            'Non-Volatile',
            'Registered (Buffered)',
            'Unbuffered (Unregistered)',
            'LRDIMM'
          ],
          technology: [
            'Other',
            'Unknown',
            'DRAM',
            'NVDIMM-N',
            'NVDIMM-F',
            'NVDIMM-P',
            'Intel Optane DC persistent memory'
          ],
          opearting_mode_capability: [
            'Other',
            'Unknown',
            'Volatile memory',
            'Byte-accessible persistent memory',
            'Block-accessible persistent memory',
            'None'
          ]
        },
        'Memory Error' => {
          type: [
            'Other',
            'Unknown',
            'OK',
            'Bad Read',
            'Parity Error',
            'Single-bit Error',
            'Double-bit Error',
            'Multi-bit Error',
            'Nibble Error',
            'Checksum Error',
            'CRC Error',
            'Corrected Single-bit Error',
            'Corrected Error',
            'Uncorrectable Error'
          ],
          error_granularity: [
            'Other',
            'Unknown',
            'Device Level',
            'Memory Partition Level'
          ],
          error_operation: [
            'Other',
            'Unknown',
            'Read',
            'Write',
            'Partial Write'
          ]
        },
        'Built-in Pointing Device' => {
          type: [
            'Other',
            'Unknown',
            'Mouse',
            'Track Ball',
            'Track Point',
            'Glide Point',
            'Touch Pad',
            'Touch Screen',
            'Optical Sensor'
          ],
          interface: [
            'Other',
            'Unknown',
            'Serial',
            'PS/2',
            'Infrared',
            'HIP-HIL',
            'Bus Mouse',
            'ADB (Apple Desktop Bus)',
            'Bus mouse DB-9',
            'Bus mouse micro-DIN',
            'USB'
          ]
        },
        'Portable Battery' => {
          chemistry: [
            'Other',
            'Unknown',
            'Lead Acid',
            'Nickel Cadmium',
            'Nickel Metal Hydride',
            'Lithium Ion',
            'Zinc Air',
            'Lithium Polymer'
          ]
        },
        'System Reset' => {
          boot_option: [
            'Operating System',
            'System Utilities',
            'Do Not Reboot'
          ]
        },
        'Hardware Security' => {
          status: [
            'Disabled',
            'Enabled',
            'Not Implemented',
            'Unknown'
          ]
        },
        'Voltage Probe' => {
          location: [
            'Other',
            'Unknown',
            'Processor',
            'Disk',
            'Peripheral Bay',
            'System Management Module',
            'Motherboard',
            'Memory Module',
            'Processor Module',
            'Power Unit',
            'Add-in Card'
          ],
          status: [
            'Other',
            'Unknown',
            'OK',
            'Non-critical',
            'Critical',
            'Non-recoverable'
          ]
        },
        'Cooling Device' => {
          type: [
            'Other',
            'Unknown',
            'Fan',
            'Centrifugal Blower',
            'Chip Fan',
            'Cabinet Fan',
            'Power Supply Fan',
            'Heat Pipe',
            'Integrated Refrigeration',
            'Active Cooling',
            'Passive Cooling'
          ],
          status: [
            'Other',
            'Unknown',
            'OK',
            'Non-critical',
            'Critical',
            'Non-recoverable'
          ]
        },
        'Temperature Probe' => {
          status: [
            'Other',
            'Unknown',
            'OK',
            'Non-critical',
            'Critical',
            'Non-recoverable'
          ],
          location: [
            'Other',
            'Unknown',
            'Processor',
            'Disk',
            'Peripheral Bay',
            'System Management Module',
            'Motherboard',
            'Memory Module',
            'Processor Module',
            'Power Unit',
            'Add-in Card',
            'Front Panel Board',
            'Back Panel Board',
            'Power System Board',
            'Drive Back Plane'
          ]
        },
        'Electrical Current Probe' => {
          status: [
            'Other',
            'Unknown',
            'OK',
            'Non-critical',
            'Critical',
            'Non-recoverable'
          ],
          location: [
            'Other',
            'Unknown',
            'Processor',
            'Disk',
            'Peripheral Bay',
            'System Management Module',
            'Motherboard',
            'Memory Module',
            'Processor Module',
            'Power Unit',
            'Add-in Card'
          ]
        },
        'System Boot' => {
          status: [
            'No errors detected',
            'No bootable media',
            'Operating system failed to load',
            'Firmware-detected hardware failure',
            'Operating system-detected hardware failure',
            'User-requested boot',
            'System security violation',
            'Previously-requested image',
            'System watchdog timer expired'
          ]
        },
        'Management Device' => {
          type: [
            'Other',
            'Unknown',
            'LM75',
            'LM78',
            'LM79',
            'LM80',
            'LM81',
            'ADM9240',
            'DS1780',
            'MAX1617',
            'GL518SM',
            'W83781D',
            'HT82H791'
          ],
          address_type: [
            'Other',
            'Unknown',
            'I/O Port',
            'Memory',
            'SMBus'
          ]
        },
        'Memory Channel' => {
          type: [
            'Other',
            'Unknown',
            'RamBus',
            'SyncLink'
          ]
        },
        'IPMI Device' => {
          type: [
            'Unknown',
            'KCS (Keyboard Control Style)',
            'SMIC (Server Management Interface Chip)',
            'BT (Block Transfer)',
            'SSIF (SMBus System Interface)'
          ],
          register_spacing: [
            'Successive Byte Boundaries',
            '32-bit Boundaries',
            '16-byte Boundaries'
          ]
        },
        'System Power Supply' => {
          type: [
            'Other',
            'Unknown',
            'Linear',
            'Switching',
            'Battery',
            'UPS',
            'Converter',
            'Regulator'
          ],
          status: [
            'Other',
            'Unknown',
            'OK',
            'Non-critical',
            'Critical',
            'Non-recoverable'
          ],
          switching: [
            'Other',
            'Unknown',
            'Manual',
            'Auto-switch',
            'Wide Range',
            'N/A'
          ]
        },
        'Management Controller Host Interface' => {
          type: [
            'KCS: Keyboard Controller Style',
            '8250 UART Register Compatible',
            '16450 UART Register Compatible',
            '16550/16550A UART Register Compatible',
            '16650/16650A UART Register Compatible',
            '16750/16750A UART Register Compatible',
            '16850/16850A UART Register Compatible'
          ],
          device_type: [
            'USB',
            'PCI/PCIe'
          ],
          protocol_record_type: [
            'Reserved',
            'IPMI',
            'MCTP',
            'Redfish over IP'
          ],
          protocol_assignment_type: [
            'Unknown',
            'Static',
            'DHCP',
            'AutoConf',
            'Host Selected'
          ],
          address_type: [
            'Unknown',
            'IPv4',
            'IPv6'
          ]
        },
        'TPM Device' => {
          characteristics: [
            'TPM Device characteristics not supported',
            'Family configurable via firmware update',
            'Family configurable via platform software support',
            'Family configurable via OEM proprietary mechanism'
          ]
        }
      }

      @dmi_types = {
        'BIOS' => 0,
        'System' => 1,
        'Baseboard' => 2,
        'Chassis' => 3,
        'Processor' => 4,
        'Memory Controller' => 5,
        'Memory Module' => 6,
        'Cache' => 7,
        'Port Connector' => 8,
        'System Slots' => 9,
        'On Board Devices' => 10,
        'OEM Strings' => 11,
        'System Configuration Options' => 12,
        'BIOS Language' => 13,
        'Group Associations' => 14,
        'System Event Log' => 15,
        'Physical Memory Array' => 16,
        'Memory Device' => 17,
        '32-bit Memory Error' => 18,
        'Memory Array Mapped Address' => 19,
        'Memory Device Mapped Address' => 20,
        'Built-in Pointing Device' => 21,
        'Portable Battery' => 22,
        'System Reset' => 23,
        'Hardware Security' => 24,
        'System Power Controls' => 25,
        'Voltage Probe' => 26,
        'Cooling Device' => 27,
        'Temperature Probe' => 28,
        'Electrical Current Probe' => 29,
        'Out-of-band Remote Access' => 30,
        'Boot Integrity Services' => 31,
        'System Boot' => 32,
        '64-bit Memory Error' => 33,
        'Management Device' => 34,
        'Management Device Component' => 35,
        'Management Device Threshold Data' => 36,
        'Memory Channel' => 37,
        'IPMI Device' => 38,
        'System Power Supply' => 39,
        'Additional Information' => 40,
        'Onboard Devices Extended Information' => 41,
        'Management Controller Host Interface' => 42,
        'TPM Device' => 43
      }

      @dmi_types_inverted = {
        0 => 'BIOS',
        1 => 'System',
        2 => 'Baseboard',
        3 => 'Chassis',
        4 => 'Processor',
        5 => 'Memory Controller',
        6 => 'Memory Module',
        7 => 'Cache',
        8 => 'Port Connector',
        9 => 'System Slots',
        10 => 'On Board Devices',
        11 => 'OEM Strings',
        12 => 'System Configuration Options',
        13 => 'BIOS Language',
        14 => 'Group Associations',
        15 => 'System Event Log',
        16 => 'Physical Memory Array',
        17 => 'Memory Device',
        18 => '32-bit Memory Error',
        19 => 'Memory Array Mapped Address',
        20 => 'Memory Device Mapped Address',
        21 => 'Built-in Pointing Device',
        22 => 'Portable Battery',
        23 => 'System Reset',
        24 => 'Hardware Security',
        25 => 'System Power Controls',
        26 => 'Voltage Probe',
        27 => 'Cooling Device',
        28 => 'Temperature Probe',
        29 => 'Electrical Current Probe',
        30 => 'Out-of-band Remote Access',
        31 => 'Boot Integrity Services',
        32 => 'System Boot',
        33 => '64-bit Memory Error',
        34 => 'Management Device',
        35 => 'Management Device Component',
        36 => 'Management Device Threshold Data',
        37 => 'Memory Channel',
        38 => 'IPMI Device',
        39 => 'System Power Supply',
        40 => 'Additional Information',
        41 => 'Onboard Devices Extended Information',
        42 => 'Management Controller Host Interface',
        43 => 'TPM Device'
      }

      def self.[](type)
        return unless valid?(type)

        if type.instance_of?(Integer)
          @dmi_types_inverted[type]
        else
          @dmi_types[type]
        end
      end

      def self.valid?(type)
        if type.instance_of?(Integer)
          @dmi_types_inverted.key?(type)
        elsif type.instance_of?(String)
          @dmi_types.key?(type)
        else
          raise ArgumentError, 'Invalid data type'
        end
      end
    end
  end
end
