package cn.com.qmth.examcloud.core.questions.service.themispaper;

import cn.com.qmth.examcloud.core.questions.base.question.enums.QuesStructType;
import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetailUnit;
import cn.com.qmth.examcloud.core.questions.dao.entity.Question;

import java.util.List;
import java.util.Map;

/**
 * @author chenken
 * @date 2017年7月25日 上午9:51:37
 * @company QMTH
 * @description ComputerTestQuestion.java
 */
public class ThemisQuestion {

    private String id;
    /**
     * 小题号或套题内子题序号
     */
    private Integer number;

    private Double score;// 小题分数
    /**
     * 1-单选，2-多选，3-判断，4-填空，5-问答，6-套题
     */
    private Long structType;
    /**
     * 是否客观题
     */
    private Boolean objective;
    /**
     * 子题
     */
    private List<ThemisQuestion> subQuestions;

    /**
     * 题干
     */
    private ThemisSections body;

    /**
     * 选项
     */
    private List<ThemisOption> options;

    private Map<String, Object> param;


    public ThemisQuestion() {
    }

    public ThemisQuestion(PaperDetailUnit paperDetailUnit) {
        this.id = paperDetailUnit.getId();
        this.number = paperDetailUnit.getNumber();
        this.score = paperDetailUnit.getScore();
        this.structType = paperDetailUnit.getQuestionType().getId();
        if (paperDetailUnit.getQuestionType() == QuesStructType.SINGLE_ANSWER_QUESTION ||
                paperDetailUnit.getQuestionType() == QuesStructType.MULTIPLE_ANSWER_QUESTION ||
                paperDetailUnit.getQuestionType() == QuesStructType.BOOL_ANSWER_QUESTION) {
            this.objective = true;
        } else {
            this.objective = false;
        }
    }

    public ThemisQuestion(Question question) {
        this.id = question.getId();
        this.score = question.getScore();
        this.structType = question.getQuestionType().getId();
        if (question.getQuestionType() == QuesStructType.SINGLE_ANSWER_QUESTION ||
                question.getQuestionType() == QuesStructType.MULTIPLE_ANSWER_QUESTION ||
                question.getQuestionType() == QuesStructType.BOOL_ANSWER_QUESTION) {
            this.objective = true;
        } else {
            this.objective = false;
        }
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    public Double getScore() {
        return score;
    }

    public void setScore(Double score) {
        this.score = score;
    }

    public Long getStructType() {
        return structType;
    }

    public void setStructType(Long structType) {
        this.structType = structType;
    }

    public Boolean getObjective() {
        return objective;
    }

    public void setObjective(Boolean objective) {
        this.objective = objective;
    }

    public List<ThemisQuestion> getSubQuestions() {
        return subQuestions;
    }

    public void setSubQuestions(List<ThemisQuestion> subQuestions) {
        this.subQuestions = subQuestions;
    }

    public ThemisSections getBody() {
        return body;
    }

    public void setBody(ThemisSections body) {
        this.body = body;
    }

    public List<ThemisOption> getOptions() {
        return options;
    }

    public void setOptions(List<ThemisOption> options) {
        this.options = options;
    }

    public Map<String, Object> getParam() {
        return param;
    }

    public void setParam(Map<String, Object> param) {
        this.param = param;
    }

}

