import {
  IsString,
  IsOptional,
  IsNumber,
  MaxLength,
  Min,
} from 'class-validator';

/**
 * DTO for finding tarifa by lane
 */
export class FindTarifaByLaneDto {
  @IsString()
  @MaxLength(100)
  origenCiudad: string;

  @IsString()
  @MaxLength(100)
  destinoCiudad: string;

  @IsString()
  @MaxLength(50)
  tipoCarga: string;

  @IsOptional()
  @IsString()
  @MaxLength(50)
  tipoEquipo?: string;
}

/**
 * DTO for basic tarifa quotation
 */
export class CotizarTarifaDto {
  @IsOptional()
  @IsNumber()
  @Min(0)
  km?: number;

  @IsOptional()
  @IsNumber()
  @Min(0)
  toneladas?: number;

  @IsOptional()
  @IsNumber()
  @Min(0)
  m3?: number;

  @IsOptional()
  @IsNumber()
  @Min(0)
  pallets?: number;

  @IsOptional()
  @IsNumber()
  @Min(0)
  horas?: number;
}

/**
 * DTO for full shipping cost calculation
 */
export class CalcularCostoEnvioDto {
  @IsString()
  @MaxLength(100)
  origenCiudad: string;

  @IsString()
  @MaxLength(100)
  destinoCiudad: string;

  @IsString()
  @MaxLength(50)
  tipoCarga: string;

  @IsString()
  @MaxLength(50)
  tipoEquipo: string;

  @IsOptional()
  @IsNumber()
  @Min(0)
  pesoKg?: number;

  @IsOptional()
  @IsNumber()
  @Min(0)
  volumenM3?: number;

  @IsOptional()
  @IsNumber()
  @Min(0)
  valorDeclarado?: number;
}

/**
 * DTO for calculating surcharges
 */
export class CalcularRecargosDto {
  @IsNumber()
  @Min(0)
  montoBase: number;

  @IsOptional()
  @IsNumber()
  @Min(0)
  valorDeclarado?: number;

  @IsOptional()
  incluirFuelSurcharge?: boolean;
}
