package cn.reghao.tnb.content.app.exam.model.vo;

import cn.reghao.jutil.jdk.converter.DateTimeConverter;
import cn.reghao.tnb.content.app.exam.model.po.Paper;
import lombok.Getter;

/**
 * @author reghao
 * @date 2024-08-28 09:02:59
 */
@Getter
public class EvalPaper {
    private Integer examId;
    private String examName;
    private Boolean needPasscode;
    private String password;
    private Integer duration;
    private String startTime;
    private Integer totalScore;
    private String myScore;
    private Integer evalStatus;

    public EvalPaper(Paper paper, int status, int userScore) {
        this.needPasscode = false;
        this.examId = paper.getId();
        this.examName = paper.getName();
        this.password = paper.getPasscode();
        this.duration = paper.getDuration();
        this.startTime = paper.getStartTime() != null ? DateTimeConverter.format(paper.getStartTime()) : "Anytime";
        this.totalScore = paper.getTotalScore();
        this.myScore = userScore != 0 ? ""+userScore : "N/A";
        this.evalStatus = status;
    }
}
