import { ApiProperty } from '@nestjs/swagger';
import { IsJSON, IsNotEmpty } from 'class-validator';
import { CreateDto } from 'src/common/dto/create.dto';

export class CreateQuestionDto extends CreateDto {
  @ApiProperty({ description: '试题类型' })
  @IsNotEmpty({ message: '试题类型名不能为空' })
  type: number;

  @ApiProperty({ description: '难易程度' })
  @IsNotEmpty({ message: '难易程度不能为空' })
  difficultyLevel: number;

  @ApiProperty({ description: '试题分类' })
  @IsNotEmpty({ message: '试题分类不能为空' })
  classifyId: number;

  @ApiProperty({ description: '试题题目' })
  @IsNotEmpty({ message: '试题题目不能为空' })
  title: string;

  @ApiProperty({ description: '试题选项' })
  // @IsNotEmpty({ message: '试题选项不能为空' })
  @IsJSON({ message: '试题选项应为JSON格式' })
  options: string;

  @ApiProperty({ description: '正确答案' })
  // @IsNotEmpty({ message: '正确答案不能为空' })
  @IsJSON({ message: '正确答案应为JSON格式' })
  answer: string;

  @ApiProperty({ description: '知识点ID' })
  knowledgeId: number;

  @ApiProperty({ description: '答案解析' })
  analysis: string;

  @ApiProperty({ description: '是否允许学员使用' })
  student: number;
}
