export type CarState =
  | 'idle'
  | 'running'
  | 'charging'
  | 'paused'
  | 'fault'
  | 'offline'

export interface Car {
  id: string
  rawId?: number
  name: string
  typeName: string
  x: number
  y: number
  theta: number
  batterySoc: number
  state: CarState
  missionId?: string
  lastUpdate: string
  group?: string
  address?: string
  ip?: string
  onboardUrl?: string
  lstatus?: string
}

/** 车队健康探测行（优先 GET /api/fleet/health；延迟为 WatchDog TCP RTT） */
export interface FleetHealthRow {
  carId: number
  carName?: string
  ip?: string
  onboardUrl?: string
  latencyMs?: number
  reachable?: boolean
  probedAt?: string
  uptimeSecs?: number
  alarmActiveSecs?: number
  faultRatePercent?: number
  isAlarmActive?: boolean
  cpuPercent?: number
  memPercent?: number
  /** watchdog | onboard | none */
  latencySource?: string
}

/** 车辆运维卡片合并模型 */
export interface VehicleCardModel extends Car {
  latencyMs?: number
  reachable?: boolean
  faultRatePercent?: number
  isAlarmActive?: boolean
  cpuPercent?: number
  memPercent?: number
  maintenanceMode?: 'online' | 'offline' | 'repair' | 'blown'
}
