import {
  IsString,
  IsOptional,
  IsArray,
  ValidateNested,
  IsNumber,
} from 'class-validator';
import { Type } from 'class-transformer';

export class CriterionDto {
  @IsString()
  name: string;

  @IsNumber()
  maxScore: number;

  @IsOptional()
  @IsString()
  description?: string;
}

export class CreateHomeworkReviewRuleDto {
  @IsString()
  name: string;

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

  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => CriterionDto)
  criteria: CriterionDto[];
}
