const rawFrameFieldAliases: Record<string, string[]> = {
  speed_kph: [
    'gb32960.vehicle.speed_kmh',
    'jt808.location.speed_kmh',
    'yutong_mqtt.data.meter_speed'
  ],
  total_mileage_km: [
    'gb32960.vehicle.total_mileage_km',
    'jt808.location.total_mileage_km',
    'yutong_mqtt.data.total_mileage'
  ],
  soc_pct: [
    'gb32960.vehicle.soc_percent',
    'yutong_mqtt.data.battery_capacity_soc'
  ],
  left_hydrogen_kg: [
    'gb32960.gd_fc_vehicle_info.hydrogen_mass_kg',
    'yutong_mqtt.data.left_hydrogen'
  ],
  direction_deg: [
    'jt808.location.direction_deg'
  ],
  lat_lon: [
    'gb32960.position.latitude',
    'gb32960.position.longitude',
    'jt808.location.latitude',
    'jt808.location.longitude',
    'yutong_mqtt.data.latitude',
    'yutong_mqtt.data.longitude'
  ],
  fc_stack: [
    'gb32960.gd_fc_stack.stack_count',
    'gb32960.gd_fc_stack.engine_work_state',
    'gb32960.gd_fc_stack.avg_cell_voltage_v',
    'gb32960.gd_fc_stack.stack_water_outlet_temp_c',
    'gb32960.gd_fc_stack.hydrogen_inlet_pressure_kpa',
    'gb32960.fuel_cell.fuel_cell_voltage_v',
    'gb32960.fuel_cell.fuel_cell_current_a'
  ],
  quality_delay: [
    'gb32960.device_time.device_time',
    'jt808.location.device_time',
    'yutong_mqtt.root.time'
  ]
};

export function expandRawFrameFields(fields: string[]) {
  const expanded = fields.flatMap((field) => rawFrameFieldAliases[field] ?? [field]);
  return Array.from(new Set(expanded));
}
