package com.ruoyi.sim.domain;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 考试对象 sim_real_exam
 *
 * @author tom
 * @date 2024-12-15
 */
public class RealExam extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 考试ID
     */
    private Long examId;

    /**
     * 考试集合ID
     */
    @Excel(name = "考试集合ID")
    private Long examCollectionId;

    /**
     * 学员ID/用户ID
     */
    @Excel(name = "学员ID/用户ID")
    private Long userId;

    /**
     * 座ID
     */
    @Excel(name = "座ID")
    private Long seatId;

    /**
     * 模拟器ID
     */
    @Excel(name = "模拟器ID")
    private Long simId;

    /**
     * 考试状态:
     * [0]-未登录,
     * [1]-已登录,
     * [2]-模拟器检查并下发故障中,
     * [3]:模拟器检查OK可开考,
     * [4]-答题中,
     * [5]-已交卷,
     * [6]-计算成绩中,
     * [7]-获取到成绩报告,
     * [80]-教师标记缺考,
     * [81]-登录未开始答题,
     * [90]-模拟器异常结束
     */
    @Excel(name = "考试状态")
    private String examStatus;

    /**
     * 总分:累加扣分和计算出总分
     */
    @Excel(name = "总分:累加扣分和计算出总分")
    private Long totalScore;

    /**
     * 扣分总计,不计超时扣分
     */
    @Excel(name = "扣分总计,不计超时扣分")
    private Long deductionTotalScore;

    /**
     * 考试实际开始时间(毫秒)
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "考试实际开始时间(毫秒)", width = 30, dateFormat = "yyyy-MM-dd")
    private Date startTime;

    /**
     * 考试实际结束时间(毫秒)
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "考试实际结束时间(毫秒)", width = 30, dateFormat = "yyyy-MM-dd")
    private Date endTime;

    /**
     * 登录时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "登录时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date loginTime;

    /**
     * 登出时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "登出时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date logoutTime;

    public void setExamId(Long examId) {
        this.examId = examId;
    }

    public Long getExamId() {
        return examId;
    }

    public void setExamCollectionId(Long examCollectionId) {
        this.examCollectionId = examCollectionId;
    }

    public Long getExamCollectionId() {
        return examCollectionId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setSeatId(Long seatId) {
        this.seatId = seatId;
    }

    public Long getSeatId() {
        return seatId;
    }

    public void setSimId(Long simId) {
        this.simId = simId;
    }

    public Long getSimId() {
        return simId;
    }

    public void setExamStatus(String examStatus) {
        this.examStatus = examStatus;
    }

    public String getExamStatus() {
        return examStatus;
    }

    public void setTotalScore(Long totalScore) {
        this.totalScore = totalScore;
    }

    public Long getTotalScore() {
        return totalScore;
    }

    public void setDeductionTotalScore(Long deductionTotalScore) {
        this.deductionTotalScore = deductionTotalScore;
    }

    public Long getDeductionTotalScore() {
        return deductionTotalScore;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setLoginTime(Date loginTime) {
        this.loginTime = loginTime;
    }

    public Date getLoginTime() {
        return loginTime;
    }

    public void setLogoutTime(Date logoutTime) {
        this.logoutTime = logoutTime;
    }

    public Date getLogoutTime() {
        return logoutTime;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("examId", getExamId())
                .append("examCollectionId", getExamCollectionId())
                .append("userId", getUserId())
                .append("seatId", getSeatId())
                .append("simId", getSimId())
                .append("examStatus", getExamStatus())
                .append("totalScore", getTotalScore())
                .append("deductionTotalScore", getDeductionTotalScore())
                .append("startTime", getStartTime())
                .append("endTime", getEndTime())
                .append("loginTime", getLoginTime())
                .append("logoutTime", getLogoutTime())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("remark", getRemark())
                .toString();
    }

    // -------------------------------- tom add  --------------------------------
    public static long EXAM_TIMEOUT_LIMIT = 1000 * 60 * 5;

    public interface State {
        String NOT_LOGGED_IN = "0";

        String LOGGED_IN = "1";
        String SIM_WRITING = "2";
        String SIM_PREPARE_OK = "3";
        String ANSWERING = "4";
        String SUBMITTED = "5";
        String CALCULATING_SCORE = "6";
        String GOT_REPORT = "7";
        String ABSENCE_BY_TEACHER = "80";
        String LOGIN_NOT_STARTED_ANSWERING_QUESTIONS = "81";
        String SIMULATOR_ERROR = "90";
    }
}
