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

import java.util.LinkedList;

import cn.com.qmth.stmms.biz.exam.model.ObjectiveBlock;
import cn.com.qmth.stmms.biz.exam.model.ObjectiveQuestion;
import cn.com.qmth.stmms.common.enums.PaperType;

public class ObjecticeBlockVO {

    private String title;

    private int number;

    private int baseSubjectId;

    private double questionScore;

    private double missScore;

    private int questionCount;

    private int optionCount;

    private boolean isSingle;

    private boolean isSelective;

    private int selectCount;

    private String[] answerArray;

    public String getTitle() {
        return title;
    }

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

    public int getNumber() {
        return number;
    }

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

    public int getQuestionCount() {
        return questionCount;
    }

    public void setQuestionCount(int questionCount) {
        this.questionCount = questionCount;
    }

    public int getOptionCount() {
        return optionCount;
    }

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

    public boolean isSingle() {
        return isSingle;
    }

    public void setSingle(boolean isSingle) {
        this.isSingle = isSingle;
    }

    public boolean isSelective() {
        return isSelective;
    }

    public void setSelective(boolean isSelective) {
        this.isSelective = isSelective;
    }

    public int isSelectCount() {
        return selectCount;
    }

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

    public String[] getAnswerArray() {
        return answerArray;
    }

    public void setAnswerArray(String[] answerArray) {
        this.answerArray = answerArray;
    }

    public int getBaseSubjectId() {
        return baseSubjectId;
    }

    public void setBaseSubjectId(int baseSubjectId) {
        this.baseSubjectId = baseSubjectId;
    }

    public double getMissScore() {
        return missScore;
    }

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

    public int getSelectCount() {
        return selectCount;
    }

    public ObjectiveBlock buildBlockDO(int examId, String subjectCode, PaperType paperType) {
        ObjectiveBlock block = new ObjectiveBlock();
        block.setExamId(examId);
        block.setSubjectCode(subjectCode);
        block.setTitle(title);
        block.setNumber(number);
        block.setQuestionScore(questionScore);
        block.setMissScore(missScore);
        block.setOptionCount(optionCount);
        block.setSingle(isSingle);
        block.setSelective(isSelective);
        block.setSelectCount(selectCount);
        block.setQuestionList(new LinkedList<ObjectiveQuestion>());
        for (int i = 0; i < questionCount; i++) {
            ObjectiveQuestion question = new ObjectiveQuestion();
            question.setNumber(i + 1);
            question.setAnswer(answerArray[i]);
            block.getQuestionList().add(question);
        }
        return block;
    }

    public double getQuestionScore() {
        return questionScore;
    }

    public void setQuestionScore(double questionScore) {
        this.questionScore = questionScore;
    }

}
