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

export class AnswerDto {
  @IsInt()
  questionId: number;

  @IsOptional()
  answer?: any; // Can be string, number, array, or object depending on question type

  @IsOptional()
  @IsInt()
  timeSpent?: number; // Time spent on this question in seconds
}

export class SubmitAssessmentDto {
  @IsInt()
  assessmentId: number;

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

  @IsOptional()
  @IsInt()
  totalTimeSpent?: number; // Total time spent on assessment in seconds
}
