import type { Vehicle } from '../../vehicles/types/vehicles.types';

export const getVehicleLabel = (vehicle: Vehicle | undefined): string => {
  if (!vehicle) return 'Unknown Vehicle';
  if (vehicle.nickname?.trim()) return vehicle.nickname.trim();
  const parts = [vehicle.year, vehicle.make, vehicle.model, vehicle.trimLevel].filter(Boolean);
  const primary = parts.join(' ').trim();
  if (primary.length > 0) return primary;
  if (vehicle.vin?.length > 0) return vehicle.vin;
  return vehicle.id.slice(0, 8) + '...';
};
