import { ApiProperty } from '@nestjs/swagger';
import { IsBoolean, ValidateIf } from 'class-validator';
import { Transform } from 'class-transformer';
import { FilterQueueEntity } from 'src/modules/queue/domain/entities/filter.entity';

export class QueueDto implements FilterQueueEntity {
  @ApiProperty({
    isArray: true,
    required: false,
  })
  // @IsString()
  @ValidateIf((body) => body.status)
  @Transform(({ value }) => {
    if (!value) return [];
    return Array.isArray(value) ? value : [value];
  })
  status: string[];

  @ApiProperty({ type: Boolean, required: false })
  @Transform((body) => body.value == 'true')
  @IsBoolean()
  @ValidateIf((body) => body.vip)
  vip: boolean;
}
