/**
 * @ai-summary Type definitions for vehicles feature
 */

export interface Vehicle {
  id: string;
  userId: string;
  vin: string;
  make?: string;
  model?: string;
  year?: number;
  engine?: string;
  transmission?: string;
  trimLevel?: string;
  driveType?: string;
  fuelType?: string;
  nickname?: string;
  color?: string;
  licensePlate?: string;
  odometerReading: number;
  isActive: boolean;
  createdAt: string;
  updatedAt: string;
  imageUrl?: string;
  purchasePrice?: number;
  purchaseDate?: string;
}

export interface CreateVehicleRequest {
  vin: string;
  year?: number;
  make?: string;
  model?: string;
  engine?: string;
  transmission?: string;
  trimLevel?: string;
  driveType?: string;
  fuelType?: string;
  nickname?: string;
  color?: string;
  licensePlate?: string;
  odometerReading?: number;
  purchasePrice?: number;
  purchaseDate?: string;
}

export interface UpdateVehicleRequest {
  vin?: string;
  year?: number;
  make?: string;
  model?: string;
  engine?: string;
  transmission?: string;
  trimLevel?: string;
  driveType?: string;
  fuelType?: string;
  nickname?: string;
  color?: string;
  licensePlate?: string;
  odometerReading?: number;
  purchasePrice?: number | null;
  purchaseDate?: string | null;
}

/**
 * Confidence level for matched dropdown values from VIN decode
 */
export type MatchConfidence = 'high' | 'medium' | 'none';

/**
 * Matched field with confidence indicator
 */
export interface MatchedField<T> {
  value: T | null;
  nhtsaValue: string | null;
  confidence: MatchConfidence;
}

/**
 * Decoded vehicle data from NHTSA vPIC API
 * with match confidence per field
 */
export interface DecodedVehicleData {
  year: MatchedField<number>;
  make: MatchedField<string>;
  model: MatchedField<string>;
  trimLevel: MatchedField<string>;
  bodyType: MatchedField<string>;
  driveType: MatchedField<string>;
  fuelType: MatchedField<string>;
  engine: MatchedField<string>;
  transmission: MatchedField<string>;
}
