import { IsString, IsNumber, IsOptional, IsUUID, IsDateString, Min, IsEnum } from 'class-validator';
import { Freight } from '@edr/types';

export class CreateTrainDto {
  @IsString()
  code!: string;

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

  @IsOptional()
  @IsEnum(Freight.TrainStatus)
  status?: Freight.TrainStatus;   // ✅ uses enum, not string

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

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

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

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

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

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

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

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

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

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