import { WagonStatus } from '@edr/types';
import { IsString, IsUUID, IsOptional, IsInt, Min, IsEnum } from 'class-validator';

export class CreateWagonDto {
  @IsString()
  wagonNumber!: string;

  @IsUUID()
  wagonTypeId!: string;

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

  @IsOptional()
  @IsInt()
  @Min(1)
  sequenceNumber?: number;

  // Tare weight and payload capacity are not accepted here: they belong to the
  // wagon type and are resolved through wagonTypeId.

  /** EXPORT run number — odd, Ethiopia → Djibouti (e.g. 8001). */
  @IsOptional()
  @IsString()
  exportTrainNumber?: string;

  /** IMPORT run number — even, Djibouti → Ethiopia (e.g. 8002). */
  @IsOptional()
  @IsString()
  importTrainNumber?: string;

  @IsOptional()
  @IsEnum(WagonStatus)
  status?: WagonStatus;

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

  @IsOptional()
  @IsString()
  notes?: string;
}
