import { IsString, IsOptional, IsNotEmpty, IsInt } from 'class-validator';
import { Type } from 'class-transformer';

export class CreateVehicleDto {
  @IsString()
  @IsNotEmpty()
  vehicleNumber: string;

  @IsString()
  @IsOptional()
  vehicleType?: string;

  @IsString()
  @IsOptional()
  ownerTransporterName?: string;

  @IsString()
  @IsOptional()
  storageCapacity?: string;

  @IsOptional()
  @IsInt()
  @Type(() => Number)
  manufacturingYear?: number;

  @IsString()
  @IsOptional()
  nationalPermitDetails?: string;

  @IsString()
  @IsOptional()
  roadTaxDetails?: string;

  @IsString()
  @IsOptional()
  explosiveLicense?: string;

  @IsString()
  @IsOptional()
  insuranceDetails?: string;

  // Resolved from the logged-in user for non-admins; required overall
  // (the service rejects a vehicle with no location).
  @IsString()
  @IsOptional()
  warehouseId?: string;
}
