package cn.com.qmth.stmms.admin.dto;

import org.apache.commons.lang.StringUtils;

import cn.com.qmth.stmms.common.annotation.ExcelField;
import cn.com.qmth.stmms.common.enums.PaperType;

public class ObjectiveQuestionDTO2 {

    @ExcelField(title = "科目代码", align = 2, sort = 10)
    private String subjectCode;

    @ExcelField(title = "AB卷(0-不分;1-A卷;2-B卷)", align = 2, sort = 20)
    private Integer paperType;

    @ExcelField(title = "大题名称", align = 2, sort = 30)
    private String title;

    @ExcelField(title = "大题号(只能用小写数字)", align = 2, sort = 40)
    private Integer mainNumber;

    @ExcelField(title = "小题名称", align = 2, sort = 50)
    private String subTitle;

    @ExcelField(title = "标准答案", align = 2, sort = 60)
    private String answer;

    @ExcelField(title = "是否单项选择题 是:true 否:false", align = 2, sort = 70)
    private Boolean single;

    @ExcelField(title = "选项个数", align = 2, sort = 80)
    private Integer optionCount;

    @ExcelField(title = "小题满分", align = 2, sort = 90)
    private Double totalScore;

    @ExcelField(title = "漏选得分", align = 2, sort = 100)
    private Double missScore;

    @ExcelField(title = "是否选做题 是:true 否:false", align = 2, sort = 110)
    private Boolean selective;

    @ExcelField(title = "选做题必选个数", align = 2, sort = 120)
    private Integer selectCount;

    public boolean validate() {
        if (StringUtils.isBlank(subjectCode)) {
            return false;
        }
        if (StringUtils.isBlank(title)) {
            return false;
        }
        if (StringUtils.isBlank(subTitle)) {
            return false;
        }
        if (StringUtils.isBlank(answer)) {
            return false;
        }
        if (paperType == null || mainNumber == null || single == null || optionCount == null || totalScore == null
                || missScore == null) {
            return false;
        }
        PaperType paperType = PaperType.findByValue(this.paperType);
        if (paperType == null) {
            return false;
        }
        if (this.selective != null && this.selective.booleanValue()) {
            if (this.selectCount == null) {
                return false;
            }
        }
        return true;
    }

    public String getSubjectCode() {
        return subjectCode;
    }

    public void setSubjectCode(String subjectCode) {
        this.subjectCode = subjectCode;
    }

    public Integer getMainNumber() {
        return mainNumber;
    }

    public void setMainNumber(Integer mainNumber) {
        this.mainNumber = mainNumber;
    }

    public String getAnswer() {
        return answer;
    }

    public void setAnswer(String answer) {
        this.answer = answer;
    }

    public Integer getOptionCount() {
        return optionCount;
    }

    public void setOptionCount(Integer optionCount) {
        this.optionCount = optionCount;
    }

    public Double getTotalScore() {
        return totalScore;
    }

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

    public Double getMissScore() {
        return missScore;
    }

    public void setMissScore(Double missScore) {
        this.missScore = missScore;
    }

    public Boolean getSingle() {
        return single;
    }

    public void setSingle(Boolean single) {
        this.single = single;
    }

    public Integer getPaperType() {
        return paperType;
    }

    public void setPaperType(Integer paperType) {
        this.paperType = paperType;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getSubTitle() {
        return subTitle;
    }

    public void setSubTitle(String subTitle) {
        this.subTitle = subTitle;
    }

    public Boolean getSelective() {
        return selective;
    }

    public void setSelective(Boolean selective) {
        this.selective = selective;
    }

    public Integer getSelectCount() {
        return selectCount;
    }

    public void setSelectCount(Integer selectCount) {
        this.selectCount = selectCount;
    }
}
