import { ApiProperty } from '@nestjs/swagger';
import { IsArray, IsInt, ArrayMinSize, ArrayMaxSize } from 'class-validator';
import { Transform } from 'class-transformer';

export class ArchiveRegistrationDto {
  @ApiProperty({
    description: 'Registration IDs to archive. Accepts a single ID or an array. Max 50 per request.',
    oneOf: [{ type: 'integer', example: 101 }, { type: 'array', items: { type: 'integer' }, example: [101, 102, 103] }],
  })
  @Transform(({ value }) => {
    const arr = Array.isArray(value) ? value : [value];
    return arr.map(Number);
  })
  @IsArray()
  @ArrayMinSize(1)
  @ArrayMaxSize(50)
  @IsInt({ each: true })
  registrationIds!: number[];
}
