import { IsOptional, IsString, IsEnum, IsInt, Min, Max } from 'class-validator';
import { Type } from 'class-transformer';

export enum WorkStatus {
  SUBMITTED = 'submitted',
  LOCKED = 'locked',
  REVIEWING = 'reviewing',
  ACCEPTED = 'accepted',
  REJECTED = 'rejected',
}

export class QueryWorkDto {
  @IsInt()
  @Min(1)
  @Type(() => Number)
  @IsOptional()
  page?: number = 1;

  @IsInt()
  @Min(1)
  @Max(100)
  @Type(() => Number)
  @IsOptional()
  pageSize?: number = 10;

  @IsInt()
  @Type(() => Number)
  @IsOptional()
  contestId?: number;

  @IsInt()
  @Type(() => Number)
  @IsOptional()
  registrationId?: number;

  @IsEnum(WorkStatus)
  @IsOptional()
  status?: WorkStatus;

  @IsString()
  @IsOptional()
  title?: string;

  @IsString()
  @IsOptional()
  workNo?: string;

  @IsString()
  @IsOptional()
  username?: string;

  @IsString()
  @IsOptional()
  keyword?: string; // 搜索作品编号、提交者姓名
}

