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

/**
 * 学员课程课后习题
 */
export class CourseStudyExerciseDto extends CreateDto {
  @ApiProperty({ description: '所属的记录ID' })
  @IsNotEmpty({ message: '所属的记录ID不能为空' })
  @IsNumber()
  recordId: number;

  @ApiProperty({ description: '练习题ID' })
  @IsNotEmpty({ message: '练习题ID不能为空' })
  @IsNumber()
  exerciseId: number;

  @ApiProperty({ description: '答案信息' })
  @IsNotEmpty({ message: '答案信息不可为空' })
  answer: string;
  @ApiProperty({ description: '是否正确' })
  @IsNotEmpty({ message: '是否正确不可为空' })
  isRight: number;
}

export class updateExercise {
  @ApiProperty({ description: '练习题答案信息提交' })
  @IsNotEmpty({ message: '答题不可为空' })
  answer: [{ questionId: number; answer: [string] }];
  @ApiProperty({ description: '当前答案所属的课程id' })
  @IsNotEmpty({ message: '当前问题所属的课程id不可为空' })
  coureseId: number;
  @ApiProperty({ description: '当前答案所属的记录id' })
  @IsNotEmpty({ message: '当前答案所属的记录id不可为空' })
  recordId: number;
  @ApiProperty({ description: '开始时间' })
  createTime: Date;
}
