namespace GeoVLog.Core.Models; public static class SensorIdExtensions { /// Map concrete reading types to their enum code. public static SensorId ToSensorId(this ISensorReading r) => r switch { GpsReading => SensorId.Gps, MagReading m when m.Channel == 0 => SensorId.Mag1, MagReading => SensorId.Mag2, VlfReading => SensorId.Vlf, ImuReading => SensorId.Imu, RadarAltReading => SensorId.RadarAltimeter, _ => throw new NotSupportedException($"No SensorId mapping for {r.GetType().Name}") }; }