/**
 * DTO used to determine how records should be filtered
 * based on user association.
 *
 * This DTO specifies whether the data should be fetched
 * using `created_by` or `updated_by` user relationships.
 */
import { IsIn, IsNotEmpty } from 'class-validator';
import { ByUserType } from 'src/utils/enums/enum';
import { ApiProperty } from '@nestjs/swagger';

export class FetchByUsersDto {
  /**
   * User filter type.
   *
   * Indicates which user reference should be used
   * when fetching records.
   *
   * Allowed values are restricted to the ByUserType enum:
   * - created  → Fetch records created by users
   * - updated  → Fetch records updated by users
   *
   * Validation:
   * - Required field
   * - Must match one of the enum values
   *
   * Swagger:
   * - Rendered as an enum dropdown in API documentation
   */
  @ApiProperty({ enum: ByUserType })
  @IsNotEmpty()
  @IsIn(Object.values(ByUserType))
  by: ByUserType;
}
