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

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

  @IsNumber()
  score: number;

  @IsNumber()
  maxScore: number;
}

export class CreateHomeworkScoreDto {
  @IsInt()
  submissionId: number;

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

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