package ink.wgink.module.examine.pojo.vos.question;

import ink.wgink.annotation.CheckEmptyAnnotation;
import ink.wgink.annotation.CheckNumberAnnotation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: QuestionVO
 * @Description: 试题管理
 * @Author: WenG
 * @Date: 2020-09-09 21:00
 * @Version: 1.0
 **/
@ApiModel
public class QuestionVO {

    @ApiModelProperty(name = "subject", value = "题目")
    @CheckEmptyAnnotation(name = "题目")
    private String subject;
    @ApiModelProperty(name = "questionType", value = "试题类型")
    private String questionType;
    @ApiModelProperty(name = "type", value = "种类")
    @CheckEmptyAnnotation(name = "种类", types = {"choice", "tureOrFalse", "fillInTheBlanks", "answer"})
    private String type;
    @ApiModelProperty(name = "choiceType", value = "选择类别")
    private String choiceType;
    @ApiModelProperty(name = "analysis", value = "解析")
    @CheckEmptyAnnotation(name = "解析")
    private String analysis;
    @ApiModelProperty(name = "parentId", value = "上级试题")
    private String parentId;
    @ApiModelProperty(name = "difficulty", value = "难度")
    @CheckNumberAnnotation(name = "难度")
    private Integer difficulty;
    @ApiModelProperty(name = "source", value = "来源")
    private String source;
    @ApiModelProperty(name = "answer", value = "答案")
    @CheckEmptyAnnotation(name = "答案")
    private String answer;
    @ApiModelProperty(name = "questionOptions", value = "问题选项")
    private List<QuestionOptionsVO> options;

    public String getSubject() {
        return subject == null ? "" : subject.trim();
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getQuestionType() {
        return questionType == null ? "" : questionType.trim();
    }

    public void setQuestionType(String questionType) {
        this.questionType = questionType;
    }

    public String getType() {
        return type == null ? "" : type.trim();
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getChoiceType() {
        return choiceType == null ? "" : choiceType.trim();
    }

    public void setChoiceType(String choiceType) {
        this.choiceType = choiceType;
    }

    public String getAnalysis() {
        return analysis == null ? "" : analysis.trim();
    }

    public void setAnalysis(String analysis) {
        this.analysis = analysis;
    }

    public String getParentId() {
        return parentId == null ? "" : parentId.trim();
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public Integer getDifficulty() {
        return difficulty == null ? 0 : difficulty;
    }

    public void setDifficulty(Integer difficulty) {
        this.difficulty = difficulty;
    }

    public String getSource() {
        return source == null ? "" : source.trim();
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getAnswer() {
        return answer == null ? "" : answer.trim();
    }

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

    public List<QuestionOptionsVO> getOptions() {
        return options == null ? new ArrayList() : options;
    }

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

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"subject\":\"")
                .append(subject).append('\"');
        sb.append(",\"questionType\":\"")
                .append(questionType).append('\"');
        sb.append(",\"type\":\"")
                .append(type).append('\"');
        sb.append(",\"choiceType\":\"")
                .append(choiceType).append('\"');
        sb.append(",\"analysis\":\"")
                .append(analysis).append('\"');
        sb.append(",\"parentId\":\"")
                .append(parentId).append('\"');
        sb.append(",\"difficulty\":")
                .append(difficulty);
        sb.append(",\"source\":\"")
                .append(source).append('\"');
        sb.append(",\"answer\":\"")
                .append(answer).append('\"');
        sb.append(",\"options\":")
                .append(options);
        sb.append('}');
        return sb.toString();
    }
}
