import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsIn, IsOptional, IsUUID } from 'class-validator';

import {
  LOCOMOTIVE_STATUSES,
  LOCOMOTIVE_TYPES,
} from '../entities/locomotive.entity';

export class FilterLocomotivesDto {
  @ApiPropertyOptional({ enum: LOCOMOTIVE_STATUSES })
  @IsOptional()
  @IsIn([...LOCOMOTIVE_STATUSES])
  status?: string;

  @ApiPropertyOptional({ enum: LOCOMOTIVE_TYPES })
  @IsOptional()
  @IsIn([...LOCOMOTIVE_TYPES])
  locomotiveType?: string;

  @ApiPropertyOptional({ description: 'Filter by current yard' })
  @IsOptional()
  @IsUUID()
  currentYardId?: string;
}
