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

export class CreateExamDto {
  @IsString() @IsNotEmpty() examType: string;
  @IsString() @IsNotEmpty() examName: string;
  @IsString() @IsNotEmpty() subject: string;
  @IsDateString() examDate: string;
  @IsInt() @Min(1) classId: number;
}

export class QueryExamDto {
  @IsOptional() @IsString() keyword?: string;
  @IsOptional() @IsString() examType?: string;
  @IsOptional() @Type(() => Number) @IsInt() @Min(1) classId?: number;
}

export class UpdateExamScoreValueDto {
  @IsOptional() @IsNumber() @Min(0) @Max(999.99) score?: number | null;
}
