package jnpf.model.cultivate.vo.learn;

import jnpf.model.cultivate.po.exam.FtbCultivateExamUser;
import jnpf.model.cultivate.po.learn.FtbCultivateLearnTaskExam;
import lombok.Data;

/**
 * @Author: peng.hao
 * @create: 2024/9/9:14:12
 */
@Data
public class FtbCultivateLearnTaskExamInfoVO {
    /** 考试主键id */
    private String examId;
    /**
     *考试名称
     */
    private String examName;

    /**
     *试卷名称
     */
    private String paperName;
    /**
     *考试类型,0岗位学习考试,1常规考试
     */
    private Integer examType;
    /**
     *考试时长 秒
     */
    private Integer examTime;

    /**
     *用户实际考试时长 秒
     */
    private Long duration;
    /**
     *考试状态 （0待考试，1待批阅，2已逾期，3合格，4不合格 5优秀）
     */
    private Integer examStatus;
    /**
     * 考试总分
     */
    private Integer examScore;
    /**
     * 考试得分
     */
    private Integer examResult;
    /**
     * 用户考试Id
     */
    private String userExamId;

    /** 是否合格才完成任务，1-是  0-否 */
    private Integer isPassComplete;

    public static  FtbCultivateLearnTaskExamInfoVO convert(FtbCultivateExamUser examUser) {
        if (examUser == null) {
            return null;
        }
        FtbCultivateLearnTaskExamInfoVO ftbCultivateLearnTaskExamInfoVO = new FtbCultivateLearnTaskExamInfoVO();
        ftbCultivateLearnTaskExamInfoVO.setExamId(examUser.getExamId());
        ftbCultivateLearnTaskExamInfoVO.setExamType(examUser.getExamType());
        ftbCultivateLearnTaskExamInfoVO.setExamStatus(examUser.getStatus());
        ftbCultivateLearnTaskExamInfoVO.setExamResult(examUser.getScore());
        ftbCultivateLearnTaskExamInfoVO.setUserExamId(examUser.getId());
        ftbCultivateLearnTaskExamInfoVO.setDuration(examUser.getDuration());

        return ftbCultivateLearnTaskExamInfoVO;
    }

    public static FtbCultivateLearnTaskExamInfoVO convertExam(FtbCultivateLearnTaskExam taskExam) {
        if (taskExam == null) {
            return null;
        }
        FtbCultivateLearnTaskExamInfoVO ftbCultivateLearnTaskExamInfoVO = new FtbCultivateLearnTaskExamInfoVO();
        ftbCultivateLearnTaskExamInfoVO.setExamId(taskExam.getExamId());
        ftbCultivateLearnTaskExamInfoVO.setIsPassComplete(taskExam.getIsPassComplete());
        return ftbCultivateLearnTaskExamInfoVO;
    }
}
