import { ApiProperty } from '@nestjs/swagger';
import {
  ArrayMinSize,
  IsArray,
  IsInt,
  Min,
  ValidateNested,
} from 'class-validator';
import { Type } from 'class-transformer';

export class PriorityItemDto {
  @ApiProperty()
  @IsInt()
  @Min(1)
  id!: number;

  @ApiProperty()
  @IsInt()
  @Min(0)
  priority!: number;
}

export class BatchPriorityDto {
  @ApiProperty({ type: [PriorityItemDto] })
  @IsArray()
  @ArrayMinSize(1)
  @ValidateNested({ each: true })
  @Type(() => PriorityItemDto)
  items!: PriorityItemDto[];
}
