/// A utility class that translates YSI instrument hex codes into human-readable descriptions.
/// This replaces the `ParameterHelper.java` class using a more efficient Map data structure.
class ParameterHelper {
  /// A private, static, and constant map for maximum performance.
  /// The map is created only once when the app starts.
  static const Map<String, String> _parameterMap = {
    '000100010001': 'Combo Probe for PH and ORP, original HW',
    '000100010002': 'PH only, Original HW',
    '000100010003': 'ammonium',
    '000100010004': 'Potasium',
    '000100010005': 'Nitrate',
    '000100010006': 'Chloride',
    '000100010007': 'Combo Probe for PH and ORP, hybrid HW for PH drift',
    '000100010008': 'PH only,  hybrid HW for PH drift',
    '000100010009': 'Combo Probe for PH and ORP,  VREF offset HW for PH drift',
    '00010001000A': 'PH only,  VREF offset HW for PH drift',
    '00010001000B': 'Combo Probe for PH and ORP,  Floating Reference is at 1.5V',
    '00010001000C': 'PH only,  Floating Reference is at 1.5V',
    '000100020001': 'Probe for ODO',
    '000100030001': 'Combo Probe for Conductivity and Temperature',
    '000100030002': 'Combo Probe for Wet Cal Conductivity and Temperature',
    '000100030003': 'Combo Probe for High accuracy Conductivity and Temperature',
    '000100030004': 'Combo Probe for Conductivity and Temperature, Wiped',
    '00010003FFFF': 'Mfg tester for Conductivity for CT probe',
    '000100040001': 'Probe for Turbidity',
    '000100050001': 'EXO1 - 4 port Sonde',
    '000100050002': 'EXO2 - 6 port Sonde',
    '000100050003': 'EXO3 - 8 port Sonde',
    '000100060001': 'Combo of Chlorophyll and BGA-PC',
    '000100060002': 'Combo of Chlorophyll and BGA-PE',
    '000100070001': 'depth probe, Non-Vented, Standard 0-250m',
    '000100070002': 'depth probe, Non-Vented, Medium 0-100m',
    '000100070003': 'depth probe, Non-Vented, Shallow 0-10m',
    '000100070004': 'depth probe, Vented,  0-10m',
    '000100080001': 'Wiper probe',
    '000100090001': 'Signal Output Adapter - DCP',
    '0001000A0001': 'Original Handheld (used primarily during manufacturing Testing)',
    '0001000A0002': 'New Handheld (ProDSS Style) with GPS',
    '0001000A0003': 'New Handheld (ProDSS Style) w/out GPS',
    '0001000B0001': 'fDOM',
    '0001000C0001': 'metal',
    '0001000E0001': 'EXO Test Board (reserved for R&D)',
    '0001000E0002': 'High Accuracy CT Test board',
    '0001000E0003': 'Phloptode',
    '0001000F0001': 'Deep UV A Channel T Channel wastewater sensor',
    '0001000F0002': 'Deep UV NOx Nitrate+Nitrite sensor',
    '000100100001': 'Signal Output Adapter - DCP Gen 2',
    '000100100002': 'Signal Output Adapter - DCP Gen 2 - Modbus',
    '000100110001': 'Used on both EXO and DSS platforms.',
    '000200010001': 'Variable Flourometer Sensor',
    '000300010001': 'Combo ODO/Conductivity/Temperature',
    '0000': 'Common Message',
    '0001': 'Sonde',
    '0002': 'PH',
    '0003': 'PH: PH units',
    '0004': 'PH: mV',
    '0005': 'ORP',
    '0006': 'ORP: mV',
    '0007': 'ORP: mV UnAdjusted',
    '0008': 'Optical Dissolved Oxygen',
    '0009': 'Optical Dissolved Oxygen: Compensated % Saturation',
    '000A': 'Optical Dissolved Oxygen: Compensated mg/L',
    '000B': 'Internal uP Temp',
    '000C': 'Internal uP Temp:  Degrees Celcius',
    '000D': 'External Temp',
    '000E': 'External Temp: Degrees Celcius',
    '000F': 'Barometer',
    '0010': 'Barometer: mmHg',
    '0011': 'Conductivity',
    '0012': 'Conductivity: us/cm',
    '0013': 'Conductivity: Salinity',
    '0014': 'Turbidity',
    '0015': 'Turbidity: FNU',
    '0016': 'Turbidity: TSS',
    '0017': 'Turbidity: RAW',
    '0018': 'Conductivity: Specific Conductivity',
    '0019': 'Chlorophyll',
    '001A': 'Chlorophyll:  ug/L',
    '001B': 'BGA-PE',
    '001C': 'BGA-PE: cells/mL  - replaced with ug/L  (0x003B)',
    '001D': 'BGA-PC',
    '001E': 'BGA-PC: cells/mL  - replaced with ug/L (0x003A)',
    '001F': 'Chlorophyll:  RFU',
    '0020': 'BGA-PE: RFU',
    '0021': 'BGA-PC: RFU',
    '0022': 'Pressure:',
    '0023': 'Pressure: psi a',
    '0024': 'Pressure: depth',
    '0025': 'Etime',
    '0026': 'Wiper:',
    '0027': 'Wiper: Position Volts',
    '0028': 'Sonde: Date and Time',
    '0029': 'Sonde: Battery Voltage',
    '002A': 'Sonde: External Voltage',
    '002B': 'Sonde: Internal Pressure Voltage',
    '002C': 'fDOM:',
    '002D': 'fDOM: RAW',
    '002E': 'fDOM: RFU',
    '002F': 'Chlorophyll:  RAW',
    '0030': 'BGA-PE: RAW',
    '0031': 'BGA-PC: RAW',
    '0032': 'Wiper: Current(mA)',
    '0033': 'Wiper: Profile Time(s)',
    '0034': 'Pressure: RAW',
    '0035': 'ODO: RAW %Sat',
    '0036': 'ODO: RAW mg/L',
    '0037': 'fDOM: QSU',
    '0038': 'Wiper: Peak Current (mA)',
    '0039': 'Wiper: Parking Retries',
    '003A': 'BGA-PC: ug/L',
    '003B': 'BGA-PE: ug/L',
    '003C': 'GPS Latitude',
    '003D': 'GPS Longitude',
    '003E': 'Conductivity: RAW us/cm',
    '003F': 'Pressure: psi g',
    '0040': 'Reference Temp',
    '0041': 'ODO: % EU',
    '0042': 'Ammonium',
    '0043': 'Ammonium (NH4+) mV',
    '0044': 'Ammonium (NH4+) mg/L',
    '0048': 'Nitrate',
    '0049': 'Nitrate (NO-3) mV',
    '004A': 'Nitrate (NO-3) mg/L',
    '004B': 'Chloride',
    '004C': 'Chloride (Cl-) mV',
    '004D': 'Chloride (Cl-) mg/L',
    '004E': 'Ammonia (NH3)',
    '004F': 'ODO: % Local',
    '0050': 'Conductivity: nLF us/cm',
    '0051': 'Sonde: Sensor Power mW',
    '0052': 'Sonde: RTC Battery Voltage',
    '0053': 'Variable Flourescent  (VF) meter',
    '0054': 'VF: Units TBD',
    '0055': 'Conductivity:TDS mg/L',
    '0056': 'Pressure: vert pos',
    '0057': 'GPS Date',
    '0058': 'GPS Time',
    '0059': 'GPS Altitude',
    '005A': 'GPS Speed Over Ground (SOG)',
    '005B': 'GPS Course Over Ground (COG)',
    '005C': 'Barometer Temperature',
    '005D': 'Conductivity Resistance (ohms)',
    '005E': 'ODO ppm',
    '005F': 'Turbidity NTU',
    '0060': 'Temprorary Calibration Value',
    '0061': 'Sigma',
    '0062': 'Sigma-T',
    '0063': 'Deep UV Wastewater: Channel A',
    '0064': 'Deep UV Wastewater: Channel A Raw',
    '0065': 'Deep UV Wastewater: Channel A RFU',
    '0066': 'Deep UV Wastewater: Channel A Concentration',
    '0067': 'Deep UV Wastewater: Channel T',
    '0068': 'Deep UV Wastewater: Channel T Raw',
    '0069': 'Deep UV Wastewater: Channel T RFU',
    '006A': 'Deep UV Wastewater: Channel T Concentration',
    '006B': 'Deep UV Wastewater: Ratio',
    '006C': 'Deep UV NOx Ch238',
    '006D': 'Deep UV NOx Ch238 Raw',
    '006E': 'Deep UV NOx Ch238Ref',
    '006F': 'Deep UV NOx Ch238Ref Raw',
    '0070': 'Deep UV NOx Ch238 Absorbance',
    '0071': 'Deep UV NOx Ch238 Absorbance Turb Corrected',
    '0072': 'Deep UV NOx Ch275',
    '0073': 'Deep UV NOx Ch275 Raw',
    '0074': 'Deep UV NOx Ch275Ref',
    '0075': 'Deep UV NOx Ch275Ref Raw',
    '0076': 'Deep UV NOx Ch275 Absorbance',
    '0077': 'Deep UV NOx Ch275 Absorbance Turb Corrected',
    '0078': 'Deep UV NOx',
    '0079': 'Deep UV NOx RAW',
    '007A': 'Deep UV NOx mg/L',
    '007B': 'fDOM ppb',
    '9900': 'SOA/DCP',
    'FF00': 'Handheld',
    'FF01': 'Hipster',
    'FF11': 'Conductivity Manufacturing Tester',
  };

  /// Takes a hex code string and returns its human-readable description.
  /// If the code is not found, it returns 'UNKNOWN'.
  static String getDescription(String hexCode) {
    // The '??' operator provides a default value if the key is not in the map.
    return _parameterMap[hexCode.toUpperCase()] ?? 'UNKNOWN';
  }
}