import { IsIn, IsInt, IsNotEmpty } from 'class-validator';
import { Type } from 'class-transformer';
import { AssociationType, ByUserType } from 'src/utils/enums/enum';
import { ApiProperty } from '@nestjs/swagger';

export class FetchByUsersDto {
  @ApiProperty({ enum: ByUserType })
  @IsNotEmpty()
  @IsIn(Object.values(ByUserType))
  by: ByUserType;

  @ApiProperty({
    enum: AssociationType,
    example: AssociationType.INSTITUTE,
  })
  @IsNotEmpty()
  @Type(() => Number)
  @IsInt()
  @IsIn(Object.values(AssociationType).filter((v) => typeof v === 'number'))
  type: AssociationType;
}
