import { IsString, IsUUID, IsOptional, IsNumber, Min, IsIn, IsDateString } from 'class-validator';

export class CreateCargoDto {
  @IsString()
  cargoReference!: string;

  @IsUUID()
  shipmentId!: string;

  @IsUUID()
  containerId!: string;

  @IsOptional()
  @IsUUID()
  cargoTypeId?: string;

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

  @IsNumber()
  @Min(0.001)
  quantity!: number;

  @IsNumber()
  @Min(0)
  weight!: number;

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

  @IsOptional()
  @IsIn(['PENDING', 'LOADED', 'IN_TRANSIT', 'DELIVERED', 'UNLOADED'])
  status?: string;

  @IsOptional()
  @IsDateString()
  loadedAt?: string;

  @IsOptional()
  @IsDateString()
  unloadedAt?: string;
}