import { IncrementIdEntity } from 'src/common/entities/increment-id.entity';
import { Column, Entity } from 'typeorm';

/**
 * 考试表
 */
@Entity()
export class Exam extends IncrementIdEntity {
  @Column({ comment: '考试名称' })
  title: string;

  @Column({ name: 'classify_id', comment: '考试分类' })
  classifyId: number;

  @Column({ name: 'exam_desc', comment: '考试描述' })
  examDesc: string;

  @Column({ name: 'exam_start_time', comment: '考试开始时间' })
  examStartTime: Date;

  @Column({ name: 'exam_end_time', comment: '考试结束时间' })
  examEndTime: Date;

  @Column({ name: 'exam_duration', comment: '答题时长' })
  examDuration: number;

  @Column({ name: 'exam_times', comment: '考试次数' })
  examTimes: number;

  @Column({ name: 'pass_percent', comment: '及格分占总分百分比' })
  passPercent: number;

  @Column({
    name: 'questions_is_random_sort',
    comment: '试题是否乱序',
    default: 0,
  })
  questionsIsRandomSort: number;

  @Column({
    name: 'options_is_random_sort',
    comment: '选项是否乱序',
    default: 0,
  })
  optionsIsRandomSort: number;

  @Column({ name: 'success_tips', comment: '及格提示消息' })
  successTips: string;

  @Column({ name: 'failed_tips', comment: '不及格提示消息' })
  failedTips: string;

  @Column({ name: 'waiting_tips', comment: '等待人工评卷提示消息' })
  waitingTips: string;

  @Column({ name: 'exam_paper_id', comment: '所选试卷ID' })
  examPaperId: number;

  @Column({ name: 'exam_mode', comment: '试卷模式（0整卷、1逐题）' })
  examMode: number;

  @Column({ name: 'total_score', comment: '总分' })
  totalScore: number;

  @Column({ name: 'grade_paper_mode', comment: '阅卷方式（0机器、1人工）' })
  gradePaperMode: number;

  @Column({
    name: 'is_anonymous',
    comment: '是否匿名（0否 1是）',
    default: 0,
  })
  isAnonymous: number;

  @Column({ name: 'examiner_id', comment: '判卷人ID' })
  examinerId: string;

  @Column({
    name: 'join_mode',
    comment: '参加方式（暂时不做的功能 0账号密码、1口令）',
    default: 0,
  })
  joinMode: number;

  @Column({
    name: 'join_password',
    comment: '参加口令6位（暂时不做的功能）',
    default: null,
  })
  joinPassword: string;

  @Column({ comment: '试卷状态（0待开考，1已开考，2已结束等）', default: 0 })
  status: number;
}
