package com.ruoyi.learn.domain;

import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

@ApiModel("答题卷")
@Data
public class AnswerSheet {
    @ApiModelProperty("考生答题卡")
    Long examineeId;
    @Excel(name = "试卷id")
    private Long paperId;
    @Excel(name = "试卷id")
    private Long knowledgeId;
    @ApiModelProperty("测试名称")
    String name;
    @ApiModelProperty("考试开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    Date beginTime;
    @ApiModelProperty("考试结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    Date endTime;
    @ApiModelProperty("阅卷类型 1 自阅卷 2 老师阅卷")
    private String scoringType;
    @ApiModelProperty("考场分钟 90, 120, xxx")
    private Long mode;
    @ApiModelProperty("答卷状态 examinee_status")
    Integer state;
    @ApiModelProperty("答卷状态名称")
    String stateStr;
    @ApiModelProperty("是否可答题")
    Boolean allowAnswer;
    @ApiModelProperty("是否可阅卷")
    Boolean allowScore;

    private Boolean isDone;

    @ApiModelProperty("题定义, time, score, types")
    PaperCond paperInfo;

    @ApiModelProperty("做题时长")
    private Long duration;
    @ApiModelProperty("总题数")
    private Integer totalCount;
    @ApiModelProperty("错误题数")
    private Integer wrongCount;

    @ApiModelProperty("院校id")
    private Long collegeId;
    @ApiModelProperty("院校名称")
    private String collegeName;
    @ApiModelProperty("专业id")
    private Long majorId;
    @ApiModelProperty("专业名称")
    private String majorName;
    @ApiModelProperty("科目ID")
    private Long subjectId;
    @ApiModelProperty("科目名称")
    private String subjectName;

    List<PaperVO.QuestionAnswer> questions;

    JSONObject stats;

    @Data
    public static class PaperCond {
        Integer time; // 秒
        Integer score; // 总分
        List<PaperCondType> types;
    }
    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class PaperCondType {
        String type;
        Integer count;
        Double score; // 本类分
    }
}
