import type {
  Battery,
  Exterior,
  Fuel,
  Health,
  Location,
  VehicleMaster,
  WarningLevel,
} from "@/lib/fleet/types";

const now = Date.now();
const minutesAgo = (m: number) => new Date(now - m * 60_000).toISOString();
const hoursAgo = (h: number) => new Date(now - h * 3_600_000).toISOString();

function loc(
  lat: number,
  lon: number,
  timestamp: string,
  heading = 90,
): Location {
  return {
    type: "Feature",
    geometry: { type: "Point", coordinates: [lon, lat, 520] },
    properties: { heading, timestamp },
  };
}

function closedExterior(ts: string, lock: Exterior["centralLock"] = "LOCKED"): Exterior {
  return {
    timestamp: ts,
    centralLock: lock,
    frontLeftDoor: "CLOSED",
    frontRightDoor: "CLOSED",
    rearLeftDoor: "CLOSED",
    rearRightDoor: "CLOSED",
    frontLeftWindow: "CLOSED",
    frontRightWindow: "CLOSED",
    rearLeftWindow: "CLOSED",
    rearRightWindow: "CLOSED",
    hood: "CLOSED",
    tailgate: "CLOSED",
    tankLid: "CLOSED",
    sunroof: "CLOSED",
  };
}

function healthOk(ts: string, overrides: Partial<Health> = {}): Health {
  const base: Health = {
    timestamp: ts,
    engineHoursToService: 120,
    daysToService: 90,
    distanceToServiceKm: 8500,
    serviceWarning: "NO_WARNING",
    brakeFluidLevelWarning: "NO_WARNING",
    engineCoolantLevelWarning: "NO_WARNING",
    oilLevelWarning: "NO_WARNING",
    frontLeftTyrePressureWarning: "NO_WARNING",
    frontRightTyrePressureWarning: "NO_WARNING",
    rearLeftTyrePressureWarning: "NO_WARNING",
    rearRightTyrePressureWarning: "NO_WARNING",
    lowVoltageBatteryWarning: "NO_WARNING",
  };
  return { ...base, ...overrides };
}

function battery(
  pct: number,
  ts: string,
  extras: Partial<Battery> = {},
): Battery {
  return {
    timestamp: ts,
    batteryChargeLevelPercentage: pct,
    averageEnergyConsumptionKwhPer100Km: 18.4,
    averageEnergyConsumptionKwhPer100KmManual: 19.1,
    estimatedDistanceToEmptyKm: Math.round(pct * 4.2),
    estimatedDistanceToEmptyMiles: Math.round(pct * 2.6),
    estimatedChargingTimeToFullMinutes: Math.max(0, Math.round((100 - pct) * 1.8)),
    chargerConnectionStatus: "DISCONNECTED",
    chargingStatus: "IDLE",
    ...extras,
  };
}

function fuel(pct: number, ts: string): Fuel {
  return {
    timestamp: ts,
    distanceToEmptyKm: Math.round(pct * 6.5),
    distanceToEmptyMiles: Math.round(pct * 4),
    averageFuelConsumptionLitersPer100Km: 7.2,
    averageFuelConsumptionLitersPer100KmManual: 7.8,
    fuelAmountLiters: Math.round((pct / 100) * 70),
    fuelLeftPercentage: pct,
  };
}

function warn(level: WarningLevel): WarningLevel {
  return level;
}

/**
 * ~20 vehicles with mixed readiness / evening-check scenarios.
 * Coordinates sit inside or deliberately outside expected zones.
 */
export const seedVehicles: VehicleMaster[] = [
  // --- München Nord: ready BEV ---
  {
    vin: "YV1XZ81V5P1234501",
    licensePlate: "M-VN 101",
    model: "EX30 Twin Motor",
    modelYear: 2025,
    color: "Crystal White",
    powertrain: "BEV",
    group: "bestand",
    expectedSiteId: "muc-nord",
    expectedZoneId: "verkauf",
    inventory: {
      vin: "YV1XZ81V5P1234501",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(5),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: true,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: true,
    },
    carInformation: {
      fuelTankCapacity: null,
      driveBatteryCapacity: 69,
      currentCarSoftwareVersion: "3.2.4",
      latestAvailableCarSoftwareVersion: "3.2.4",
    },
    odometer: {
      timestamp: minutesAgo(8),
      odometerMeters: 420_000,
      tripMeterManualKm: 12.4,
      tripMeterAutomaticKm: 48.2,
      averageSpeedKmPerHour: 38,
    },
    fuel: null,
    battery: battery(88, minutesAgo(8)),
    health: healthOk(minutesAgo(8)),
    exterior: closedExterior(minutesAgo(8)),
    availability: {
      timestamp: minutesAgo(8),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "IDLE",
    },
    location: loc(48.1897, 11.5642, minutesAgo(8)),
    parkingClimatization: {
      timestamp: minutesAgo(8),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  // --- Low SoC + charging fault ---
  {
    vin: "YV1XZ81V5P1234502",
    licensePlate: "M-VN 102",
    model: "EX40 Single Motor",
    modelYear: 2024,
    color: "Thunder Grey",
    powertrain: "BEV",
    group: "vorfuehr",
    expectedSiteId: "muc-nord",
    expectedZoneId: "hof",
    inventory: {
      vin: "YV1XZ81V5P1234502",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(12),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: false,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: false,
    },
    carInformation: {
      fuelTankCapacity: null,
      driveBatteryCapacity: 82,
      currentCarSoftwareVersion: "2.11.1",
      latestAvailableCarSoftwareVersion: "3.0.0",
    },
    odometer: {
      timestamp: minutesAgo(15),
      odometerMeters: 18_450_000,
      tripMeterManualKm: 3.1,
      tripMeterAutomaticKm: 210.5,
      averageSpeedKmPerHour: 42,
    },
    fuel: null,
    battery: battery(18, minutesAgo(15), {
      chargerConnectionStatus: "CONNECTED",
      chargingStatus: "ERROR",
      estimatedChargingTimeToFullMinutes: 0,
    }),
    health: healthOk(minutesAgo(15)),
    exterior: closedExterior(minutesAgo(15)),
    availability: {
      timestamp: minutesAgo(15),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "CHARGING",
    },
    location: loc(48.1887, 11.5652, minutesAgo(15)),
    parkingClimatization: {
      timestamp: minutesAgo(15),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  // --- Open door / unlocked ---
  {
    vin: "YV1XZ81V5P1234503",
    licensePlate: "M-VN 103",
    model: "XC60 B5",
    modelYear: 2023,
    color: "Denim Blue",
    powertrain: "ICE",
    group: "ersatz_miet",
    expectedSiteId: "muc-nord",
    expectedZoneId: "auslieferung",
    inventory: {
      vin: "YV1XZ81V5P1234503",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(3),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: true,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: true,
    },
    carInformation: {
      fuelTankCapacity: 71,
      driveBatteryCapacity: null,
      currentCarSoftwareVersion: "2.8.0",
      latestAvailableCarSoftwareVersion: "2.8.0",
    },
    odometer: {
      timestamp: minutesAgo(4),
      odometerMeters: 42_100_000,
      tripMeterManualKm: 55,
      tripMeterAutomaticKm: 120,
      averageSpeedKmPerHour: 51,
    },
    fuel: fuel(62, minutesAgo(4)),
    battery: null,
    health: healthOk(minutesAgo(4)),
    exterior: {
      ...closedExterior(minutesAgo(4), "UNLOCKED"),
      frontLeftDoor: "OPEN",
    },
    availability: {
      timestamp: minutesAgo(4),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "IDLE",
    },
    location: loc(48.19, 11.5657, minutesAgo(4)),
    parkingClimatization: {
      timestamp: minutesAgo(4),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  // --- Health warning + service due ---
  {
    vin: "YV1XZ81V5P1234504",
    licensePlate: "M-VN 104",
    model: "XC90 T8",
    modelYear: 2022,
    color: "Onyx Black",
    powertrain: "PHEV",
    group: "pool",
    expectedSiteId: "muc-nord",
    expectedZoneId: "werkstatt",
    inventory: {
      vin: "YV1XZ81V5P1234504",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(20),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: true,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: true,
    },
    carInformation: {
      fuelTankCapacity: 70,
      driveBatteryCapacity: 18.8,
      currentCarSoftwareVersion: "2.5.2",
      latestAvailableCarSoftwareVersion: "2.9.1",
    },
    odometer: {
      timestamp: minutesAgo(22),
      odometerMeters: 98_200_000,
      tripMeterManualKm: 8,
      tripMeterAutomaticKm: 400,
      averageSpeedKmPerHour: 47,
    },
    fuel: fuel(34, minutesAgo(22)),
    battery: battery(42, minutesAgo(22)),
    health: healthOk(minutesAgo(22), {
      daysToService: 2,
      distanceToServiceKm: 180,
      serviceWarning: warn("WARNING"),
      lowVoltageBatteryWarning: warn("CRITICAL"),
      frontLeftTyrePressureWarning: warn("WARNING"),
    }),
    exterior: closedExterior(minutesAgo(22)),
    availability: {
      timestamp: minutesAgo(22),
      availabilityStatus: "UNAVAILABLE",
      unavailableReason: "SERVICE_BOOKED",
      usageMode: "SERVICE",
    },
    location: loc(48.1887, 11.5639, minutesAgo(22)),
    parkingClimatization: {
      timestamp: minutesAgo(22),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  // --- Zone mismatch (expected verkauf, parked far) ---
  {
    vin: "YV1XZ81V5P1234505",
    licensePlate: "M-VN 105",
    model: "C40 Recharge",
    modelYear: 2023,
    color: "Fjord Blue",
    powertrain: "BEV",
    group: "bestand",
    expectedSiteId: "muc-nord",
    expectedZoneId: "verkauf",
    inventory: {
      vin: "YV1XZ81V5P1234505",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(10),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: false,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: false,
    },
    carInformation: {
      fuelTankCapacity: null,
      driveBatteryCapacity: 78,
      currentCarSoftwareVersion: "3.1.0",
      latestAvailableCarSoftwareVersion: "3.1.0",
    },
    odometer: {
      timestamp: minutesAgo(11),
      odometerMeters: 9_800_000,
      tripMeterManualKm: 1.2,
      tripMeterAutomaticKm: 88,
      averageSpeedKmPerHour: 35,
    },
    fuel: null,
    battery: battery(71, minutesAgo(11)),
    health: healthOk(minutesAgo(11)),
    exterior: closedExterior(minutesAgo(11)),
    availability: {
      timestamp: minutesAgo(11),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "IDLE",
    },
    // Outside all Nord zones
    location: loc(48.1955, 11.572, minutesAgo(11)),
    parkingClimatization: {
      timestamp: minutesAgo(11),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  // --- Stale telematics ---
  {
    vin: "YV1XZ81V5P1234506",
    licensePlate: "M-VN 106",
    model: "V60 B4",
    modelYear: 2021,
    color: "Silver Dawn",
    powertrain: "ICE",
    group: "vorfuehr",
    expectedSiteId: "muc-nord",
    expectedZoneId: "hof",
    inventory: {
      vin: "YV1XZ81V5P1234506",
      market: "DE",
      active: true,
      updatedAt: hoursAgo(14),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: false,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: false,
    },
    carInformation: {
      fuelTankCapacity: 60,
      driveBatteryCapacity: null,
      currentCarSoftwareVersion: "2.3.0",
      latestAvailableCarSoftwareVersion: "2.8.0",
    },
    odometer: {
      timestamp: hoursAgo(14),
      odometerMeters: 55_000_000,
      tripMeterManualKm: 20,
      tripMeterAutomaticKm: 300,
      averageSpeedKmPerHour: 55,
    },
    fuel: fuel(48, hoursAgo(14)),
    battery: null,
    health: healthOk(hoursAgo(14)),
    exterior: closedExterior(hoursAgo(14)),
    availability: {
      timestamp: hoursAgo(14),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "UNKNOWN",
    },
    location: loc(48.1886, 11.5651, hoursAgo(14)),
    parkingClimatization: {
      timestamp: hoursAgo(14),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  // --- Charging OK, mid SoC ---
  {
    vin: "YV1XZ81V5P1234507",
    licensePlate: "M-VN 107",
    model: "EX90 Twin Motor",
    modelYear: 2025,
    color: "Vapour Grey",
    powertrain: "BEV",
    group: "bestand",
    expectedSiteId: "muc-nord",
    expectedZoneId: "auslieferung",
    inventory: {
      vin: "YV1XZ81V5P1234507",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(6),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: true,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: true,
    },
    carInformation: {
      fuelTankCapacity: null,
      driveBatteryCapacity: 111,
      currentCarSoftwareVersion: "1.4.2",
      latestAvailableCarSoftwareVersion: "1.4.2",
    },
    odometer: {
      timestamp: minutesAgo(6),
      odometerMeters: 1_200_000,
      tripMeterManualKm: 0.5,
      tripMeterAutomaticKm: 15,
      averageSpeedKmPerHour: 28,
    },
    fuel: null,
    battery: battery(54, minutesAgo(6), {
      chargerConnectionStatus: "CONNECTED",
      chargingStatus: "CHARGING",
      estimatedChargingTimeToFullMinutes: 85,
    }),
    health: healthOk(minutesAgo(6)),
    exterior: closedExterior(minutesAgo(6)),
    availability: {
      timestamp: minutesAgo(6),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "CHARGING",
    },
    location: loc(48.19, 11.5658, minutesAgo(6)),
    parkingClimatization: {
      timestamp: minutesAgo(6),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  // --- Ready ICE ---
  {
    vin: "YV1XZ81V5P1234508",
    licensePlate: "M-VN 108",
    model: "XC40 B3",
    modelYear: 2024,
    color: "Fusion Red",
    powertrain: "ICE",
    group: "ersatz_miet",
    expectedSiteId: "muc-nord",
    expectedZoneId: "hof",
    inventory: {
      vin: "YV1XZ81V5P1234508",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(9),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: false,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: false,
    },
    carInformation: {
      fuelTankCapacity: 54,
      driveBatteryCapacity: null,
      currentCarSoftwareVersion: "2.9.0",
      latestAvailableCarSoftwareVersion: "2.9.0",
    },
    odometer: {
      timestamp: minutesAgo(9),
      odometerMeters: 12_300_000,
      tripMeterManualKm: 42,
      tripMeterAutomaticKm: 180,
      averageSpeedKmPerHour: 44,
    },
    fuel: fuel(81, minutesAgo(9)),
    battery: null,
    health: healthOk(minutesAgo(9)),
    exterior: closedExterior(minutesAgo(9)),
    availability: {
      timestamp: minutesAgo(9),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "IDLE",
    },
    location: loc(48.1887, 11.5653, minutesAgo(9)),
    parkingClimatization: {
      timestamp: minutesAgo(9),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  // --- Connected but not charging (low SoC) ---
  {
    vin: "YV1XZ81V5P1234509",
    licensePlate: "M-VN 109",
    model: "EC40 Twin Motor",
    modelYear: 2025,
    color: "Bright Dusk",
    powertrain: "BEV",
    group: "vorfuehr",
    expectedSiteId: "muc-nord",
    expectedZoneId: "verkauf",
    inventory: {
      vin: "YV1XZ81V5P1234509",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(7),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: true,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: true,
    },
    carInformation: {
      fuelTankCapacity: null,
      driveBatteryCapacity: 82,
      currentCarSoftwareVersion: "3.0.1",
      latestAvailableCarSoftwareVersion: "3.0.1",
    },
    odometer: {
      timestamp: minutesAgo(7),
      odometerMeters: 6_700_000,
      tripMeterManualKm: 9,
      tripMeterAutomaticKm: 95,
      averageSpeedKmPerHour: 40,
    },
    fuel: null,
    battery: battery(22, minutesAgo(7), {
      chargerConnectionStatus: "CONNECTED",
      chargingStatus: "IDLE",
    }),
    health: healthOk(minutesAgo(7)),
    exterior: closedExterior(minutesAgo(7)),
    availability: {
      timestamp: minutesAgo(7),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "IDLE",
    },
    location: loc(48.1897, 11.5644, minutesAgo(7)),
    parkingClimatization: {
      timestamp: minutesAgo(7),
      runningStatus: "RUNNING",
      runtimeLeftMinutes: 18,
      errors: [],
    },
  },
  // --- Pool ready PHEV ---
  {
    vin: "YV1XZ81V5P1234510",
    licensePlate: "M-VN 110",
    model: "V90 T6",
    modelYear: 2023,
    color: "Pine Grey",
    powertrain: "PHEV",
    group: "pool",
    expectedSiteId: "muc-nord",
    expectedZoneId: "hof",
    inventory: {
      vin: "YV1XZ81V5P1234510",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(14),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: true,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: true,
    },
    carInformation: {
      fuelTankCapacity: 60,
      driveBatteryCapacity: 18.8,
      currentCarSoftwareVersion: "2.7.3",
      latestAvailableCarSoftwareVersion: "2.7.3",
    },
    odometer: {
      timestamp: minutesAgo(14),
      odometerMeters: 33_400_000,
      tripMeterManualKm: 15,
      tripMeterAutomaticKm: 220,
      averageSpeedKmPerHour: 49,
    },
    fuel: fuel(70, minutesAgo(14)),
    battery: battery(90, minutesAgo(14)),
    health: healthOk(minutesAgo(14)),
    exterior: closedExterior(minutesAgo(14)),
    availability: {
      timestamp: minutesAgo(14),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "IDLE",
    },
    location: loc(48.1886, 11.5654, minutesAgo(14)),
    parkingClimatization: {
      timestamp: minutesAgo(14),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },

  // ========== München Süd ==========
  {
    vin: "YV1XZ81V5P1234511",
    licensePlate: "M-VS 201",
    model: "EX30 Single Motor",
    modelYear: 2025,
    color: "Cloud Blue",
    powertrain: "BEV",
    group: "bestand",
    expectedSiteId: "muc-sued",
    expectedZoneId: "verkauf",
    inventory: {
      vin: "YV1XZ81V5P1234511",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(5),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: true,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: true,
    },
    carInformation: {
      fuelTankCapacity: null,
      driveBatteryCapacity: 51,
      currentCarSoftwareVersion: "3.2.4",
      latestAvailableCarSoftwareVersion: "3.2.4",
    },
    odometer: {
      timestamp: minutesAgo(5),
      odometerMeters: 890_000,
      tripMeterManualKm: 4,
      tripMeterAutomaticKm: 22,
      averageSpeedKmPerHour: 32,
    },
    fuel: null,
    battery: battery(92, minutesAgo(5)),
    health: healthOk(minutesAgo(5)),
    exterior: closedExterior(minutesAgo(5)),
    availability: {
      timestamp: minutesAgo(5),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "IDLE",
    },
    location: loc(48.1014, 11.5368, minutesAgo(5)),
    parkingClimatization: {
      timestamp: minutesAgo(5),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  {
    vin: "YV1XZ81V5P1234512",
    licensePlate: "M-VS 202",
    model: "XC60 T8",
    modelYear: 2024,
    color: "Bright Silver",
    powertrain: "PHEV",
    group: "vorfuehr",
    expectedSiteId: "muc-sued",
    expectedZoneId: "hof",
    inventory: {
      vin: "YV1XZ81V5P1234512",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(18),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: true,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: true,
    },
    carInformation: {
      fuelTankCapacity: 70,
      driveBatteryCapacity: 18.8,
      currentCarSoftwareVersion: "2.9.0",
      latestAvailableCarSoftwareVersion: "3.0.0",
    },
    odometer: {
      timestamp: minutesAgo(18),
      odometerMeters: 21_000_000,
      tripMeterManualKm: 30,
      tripMeterAutomaticKm: 150,
      averageSpeedKmPerHour: 46,
    },
    fuel: fuel(55, minutesAgo(18)),
    battery: battery(28, minutesAgo(18)),
    health: healthOk(minutesAgo(18), {
      oilLevelWarning: warn("WARNING"),
    }),
    exterior: closedExterior(minutesAgo(18)),
    availability: {
      timestamp: minutesAgo(18),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "IDLE",
    },
    location: loc(48.1004, 11.5378, minutesAgo(18)),
    parkingClimatization: {
      timestamp: minutesAgo(18),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  {
    vin: "YV1XZ81V5P1234513",
    licensePlate: "M-VS 203",
    model: "XC40 Recharge",
    modelYear: 2022,
    color: "Glacier Silver",
    powertrain: "BEV",
    group: "ersatz_miet",
    expectedSiteId: "muc-sued",
    expectedZoneId: "auslieferung",
    inventory: {
      vin: "YV1XZ81V5P1234513",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(2),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: false,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: false,
    },
    carInformation: {
      fuelTankCapacity: null,
      driveBatteryCapacity: 78,
      currentCarSoftwareVersion: "2.4.1",
      latestAvailableCarSoftwareVersion: "2.4.1",
    },
    odometer: {
      timestamp: minutesAgo(2),
      odometerMeters: 47_800_000,
      tripMeterManualKm: 60,
      tripMeterAutomaticKm: 500,
      averageSpeedKmPerHour: 52,
    },
    fuel: null,
    battery: battery(12, minutesAgo(2), {
      chargerConnectionStatus: "DISCONNECTED",
      chargingStatus: "IDLE",
    }),
    health: healthOk(minutesAgo(2)),
    exterior: {
      ...closedExterior(minutesAgo(2), "UNLOCKED"),
      rearRightWindow: "OPEN",
      tailgate: "OPEN",
    },
    availability: {
      timestamp: minutesAgo(2),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "IDLE",
    },
    location: loc(48.1017, 11.5383, minutesAgo(2)),
    parkingClimatization: {
      timestamp: minutesAgo(2),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  {
    vin: "YV1XZ81V5P1234514",
    licensePlate: "M-VS 204",
    model: "S90 B5",
    modelYear: 2023,
    color: "Platinum Grey",
    powertrain: "ICE",
    group: "pool",
    expectedSiteId: "muc-sued",
    expectedZoneId: "werkstatt",
    inventory: {
      vin: "YV1XZ81V5P1234514",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(30),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: false,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: false,
    },
    carInformation: {
      fuelTankCapacity: 60,
      driveBatteryCapacity: null,
      currentCarSoftwareVersion: "2.6.0",
      latestAvailableCarSoftwareVersion: "2.9.0",
    },
    odometer: {
      timestamp: minutesAgo(30),
      odometerMeters: 67_200_000,
      tripMeterManualKm: 10,
      tripMeterAutomaticKm: 280,
      averageSpeedKmPerHour: 58,
    },
    fuel: fuel(25, minutesAgo(30)),
    battery: null,
    health: healthOk(minutesAgo(30), {
      brakeFluidLevelWarning: warn("CRITICAL"),
      serviceWarning: warn("WARNING"),
      daysToService: -3,
      distanceToServiceKm: 0,
    }),
    exterior: closedExterior(minutesAgo(30)),
    availability: {
      timestamp: minutesAgo(30),
      availabilityStatus: "UNAVAILABLE",
      unavailableReason: "WORKSHOP",
      usageMode: "SERVICE",
    },
    location: loc(48.1005, 11.5365, minutesAgo(30)),
    parkingClimatization: {
      timestamp: minutesAgo(30),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  {
    vin: "YV1XZ81V5P1234515",
    licensePlate: "M-VS 205",
    model: "EX40 Twin Motor",
    modelYear: 2025,
    color: "Onyx Black",
    powertrain: "BEV",
    group: "bestand",
    expectedSiteId: "muc-sued",
    expectedZoneId: "verkauf",
    inventory: {
      vin: "YV1XZ81V5P1234515",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(8),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: true,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: true,
    },
    carInformation: {
      fuelTankCapacity: null,
      driveBatteryCapacity: 82,
      currentCarSoftwareVersion: "3.1.2",
      latestAvailableCarSoftwareVersion: "3.1.2",
    },
    odometer: {
      timestamp: minutesAgo(8),
      odometerMeters: 2_400_000,
      tripMeterManualKm: 2,
      tripMeterAutomaticKm: 40,
      averageSpeedKmPerHour: 30,
    },
    fuel: null,
    battery: battery(76, minutesAgo(8)),
    health: healthOk(minutesAgo(8)),
    exterior: closedExterior(minutesAgo(8)),
    availability: {
      timestamp: minutesAgo(8),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "IDLE",
    },
    // Wrong site entirely (at Nord while expected Süd)
    location: loc(48.1897, 11.564, minutesAgo(8)),
    parkingClimatization: {
      timestamp: minutesAgo(8),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  {
    vin: "YV1XZ81V5P1234516",
    licensePlate: "M-VS 206",
    model: "XC90 B5",
    modelYear: 2024,
    color: "Denim Blue",
    powertrain: "ICE",
    group: "vorfuehr",
    expectedSiteId: "muc-sued",
    expectedZoneId: "hof",
    inventory: {
      vin: "YV1XZ81V5P1234516",
      market: "DE",
      active: true,
      updatedAt: hoursAgo(10),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: true,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: true,
    },
    carInformation: {
      fuelTankCapacity: 71,
      driveBatteryCapacity: null,
      currentCarSoftwareVersion: "2.8.5",
      latestAvailableCarSoftwareVersion: "2.8.5",
    },
    odometer: {
      timestamp: hoursAgo(10),
      odometerMeters: 15_600_000,
      tripMeterManualKm: 70,
      tripMeterAutomaticKm: 190,
      averageSpeedKmPerHour: 48,
    },
    fuel: fuel(66, hoursAgo(10)),
    battery: null,
    health: healthOk(hoursAgo(10)),
    exterior: closedExterior(hoursAgo(10)),
    availability: {
      timestamp: hoursAgo(10),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "UNKNOWN",
    },
    location: loc(48.1004, 11.5377, hoursAgo(10)),
    parkingClimatization: {
      timestamp: hoursAgo(10),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  {
    vin: "YV1XZ81V5P1234517",
    licensePlate: "M-VS 207",
    model: "EM90",
    modelYear: 2025,
    color: "Crystal White",
    powertrain: "BEV",
    group: "bestand",
    expectedSiteId: "muc-sued",
    expectedZoneId: "auslieferung",
    inventory: {
      vin: "YV1XZ81V5P1234517",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(4),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: true,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: true,
    },
    carInformation: {
      fuelTankCapacity: null,
      driveBatteryCapacity: 116,
      currentCarSoftwareVersion: "1.2.0",
      latestAvailableCarSoftwareVersion: "1.2.0",
    },
    odometer: {
      timestamp: minutesAgo(4),
      odometerMeters: 350_000,
      tripMeterManualKm: 0,
      tripMeterAutomaticKm: 8,
      averageSpeedKmPerHour: 22,
    },
    fuel: null,
    battery: battery(95, minutesAgo(4), {
      chargerConnectionStatus: "CONNECTED",
      chargingStatus: "DONE",
    }),
    health: healthOk(minutesAgo(4)),
    exterior: closedExterior(minutesAgo(4)),
    availability: {
      timestamp: minutesAgo(4),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "IDLE",
    },
    location: loc(48.1017, 11.5384, minutesAgo(4)),
    parkingClimatization: {
      timestamp: minutesAgo(4),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  {
    vin: "YV1XZ81V5P1234518",
    licensePlate: "M-VS 208",
    model: "V60 T8",
    modelYear: 2023,
    color: "Thunder Grey",
    powertrain: "PHEV",
    group: "ersatz_miet",
    expectedSiteId: "muc-sued",
    expectedZoneId: "hof",
    inventory: {
      vin: "YV1XZ81V5P1234518",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(16),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: true,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: true,
    },
    carInformation: {
      fuelTankCapacity: 60,
      driveBatteryCapacity: 18.8,
      currentCarSoftwareVersion: "2.7.0",
      latestAvailableCarSoftwareVersion: "2.7.0",
    },
    odometer: {
      timestamp: minutesAgo(16),
      odometerMeters: 38_900_000,
      tripMeterManualKm: 25,
      tripMeterAutomaticKm: 310,
      averageSpeedKmPerHour: 50,
    },
    fuel: fuel(40, minutesAgo(16)),
    battery: battery(65, minutesAgo(16)),
    health: healthOk(minutesAgo(16)),
    exterior: closedExterior(minutesAgo(16)),
    availability: {
      timestamp: minutesAgo(16),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "IDLE",
    },
    location: loc(48.1004, 11.5379, minutesAgo(16)),
    parkingClimatization: {
      timestamp: minutesAgo(16),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  {
    vin: "YV1XZ81V5P1234519",
    licensePlate: "M-VS 209",
    model: "XC40 B4",
    modelYear: 2024,
    color: "Fusion Red",
    powertrain: "ICE",
    group: "pool",
    expectedSiteId: "muc-sued",
    expectedZoneId: "verkauf",
    inventory: {
      vin: "YV1XZ81V5P1234519",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(11),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: false,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: false,
    },
    carInformation: {
      fuelTankCapacity: 54,
      driveBatteryCapacity: null,
      currentCarSoftwareVersion: "2.9.1",
      latestAvailableCarSoftwareVersion: "2.9.1",
    },
    odometer: {
      timestamp: minutesAgo(11),
      odometerMeters: 8_100_000,
      tripMeterManualKm: 18,
      tripMeterAutomaticKm: 95,
      averageSpeedKmPerHour: 41,
    },
    fuel: fuel(78, minutesAgo(11)),
    battery: null,
    health: healthOk(minutesAgo(11)),
    exterior: closedExterior(minutesAgo(11)),
    availability: {
      timestamp: minutesAgo(11),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "IDLE",
    },
    location: loc(48.1014, 11.5367, minutesAgo(11)),
    parkingClimatization: {
      timestamp: minutesAgo(11),
      runningStatus: "OFF",
      runtimeLeftMinutes: 0,
      errors: [],
    },
  },
  {
    vin: "YV1XZ81V5P1234520",
    licensePlate: "M-VS 210",
    model: "EX90 Performance",
    modelYear: 2025,
    color: "Vapour Grey",
    powertrain: "BEV",
    group: "vorfuehr",
    expectedSiteId: "muc-sued",
    expectedZoneId: "hof",
    inventory: {
      vin: "YV1XZ81V5P1234520",
      market: "DE",
      active: true,
      updatedAt: minutesAgo(1),
    },
    eligibility: {
      region: "EU",
      hasTelematics: true,
      supportsDriverBehaviorData: true,
      supportsRealtimeLocation: true,
      configurableRtlFrequency: true,
    },
    carInformation: {
      fuelTankCapacity: null,
      driveBatteryCapacity: 111,
      currentCarSoftwareVersion: "1.4.0",
      latestAvailableCarSoftwareVersion: "1.4.2",
    },
    odometer: {
      timestamp: minutesAgo(1),
      odometerMeters: 5_500_000,
      tripMeterManualKm: 12,
      tripMeterAutomaticKm: 70,
      averageSpeedKmPerHour: 45,
    },
    fuel: null,
    battery: battery(35, minutesAgo(1), {
      chargerConnectionStatus: "FAULT",
      chargingStatus: "ERROR",
    }),
    health: healthOk(minutesAgo(1), {
      rearRightTyrePressureWarning: warn("WARNING"),
    }),
    exterior: closedExterior(minutesAgo(1)),
    availability: {
      timestamp: minutesAgo(1),
      availabilityStatus: "AVAILABLE",
      unavailableReason: null,
      usageMode: "IDLE",
    },
    location: loc(48.1005, 11.5378, minutesAgo(1)),
    parkingClimatization: {
      timestamp: minutesAgo(1),
      runningStatus: "ERROR",
      runtimeLeftMinutes: 0,
      errors: ["COMPRESSOR_FAULT"],
    },
  },
];
