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

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

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

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