import {
  IsString,
  IsEnum,
  IsOptional,
  IsInt,
  IsBoolean,
  IsArray,
  Min,
  Max,
} from 'class-validator';
import {
  QuestionType,
  DifficultyLevel,
} from '../../../entities/assessment-question.entity';

export class CreateQuestionDto {
  @IsString()
  question: string;

  @IsEnum(QuestionType)
  type: QuestionType;

  @IsOptional()
  @IsEnum(DifficultyLevel)
  difficulty?: DifficultyLevel;

  @IsOptional()
  @IsArray()
  options?: string[];

  @IsOptional()
  @IsArray()
  correctAnswers?: any[];

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

  @IsOptional()
  @IsInt()
  @Min(1)
  @Max(100)
  points?: number;

  @IsOptional()
  @IsInt()
  @Min(0)
  @Max(3600)
  timeLimit?: number;

  @IsOptional()
  codeTemplate?: any;

  @IsOptional()
  @IsArray()
  testCases?: any[];

  @IsOptional()
  @IsArray()
  @IsString({ each: true })
  mediaFiles?: string[];

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

  @IsOptional()
  @IsBoolean()
  isRequired?: boolean;

  @IsOptional()
  @IsInt()
  @Min(0)
  order?: number;

  @IsOptional()
  @IsArray()
  @IsString({ each: true })
  tags?: string[];
}
