package ink.wgink.module.examine.listener.question;

import com.alibaba.excel.annotation.ExcelProperty;

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

/**
 * @ClassName: TestQuestionExcel
 * @Description: 题目Excel
 * @Author: WangGeng
 * @Date: 2021/4/2 21:16
 * @Version: 1.0
 **/
public class QuestionExcel {

    @ExcelProperty(index = 0)
    private Integer no;
    @ExcelProperty(index = 1)
    private String title;
    @ExcelProperty(index = 2)
    private String type;
    @ExcelProperty(index = 3)
    private String kind;
    @ExcelProperty(index = 4)
    private String option;
    private List<String> options;
    @ExcelProperty(index = 5)
    private String answer;
    @ExcelProperty(index = 6)
    private Integer difficulty;
    @ExcelProperty(index = 7)
    private String source;
    @ExcelProperty(index = 8)
    private String analysis;

    public Integer getNo() {
        return no;
    }

    public void setNo(Integer no) {
        this.no = no;
    }

    public String getTitle() {
        return title == null ? "" : title.trim();
    }

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

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

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

    public String getKind() {
        return kind == null ? "" : kind.trim();
    }

    public void setKind(String kind) {
        this.kind = kind;
    }

    public String getOption() {
        return option == null ? "" : option.trim();
    }

    public void setOption(String option) {
        this.option = option;
    }

    public List<String> getOptions() {
        if (options == null) {
            return new ArrayList<>();
        }
        return options;
    }

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

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

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

    public Integer getDifficulty() {
        return difficulty == null ? 1 : 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 getAnalysis() {
        return analysis == null ? "" : analysis.trim();
    }

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

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"no\":")
                .append(no);
        sb.append(",\"title\":\"")
                .append(title).append('\"');
        sb.append(",\"type\":\"")
                .append(type).append('\"');
        sb.append(",\"kind\":\"")
                .append(kind).append('\"');
        sb.append(",\"option\":\"")
                .append(option).append('\"');
        sb.append(",\"options\":")
                .append(options);
        sb.append(",\"answer\":\"")
                .append(answer).append('\"');
        sb.append(",\"difficulty\":")
                .append(difficulty);
        sb.append(",\"source\":\"")
                .append(source).append('\"');
        sb.append(",\"analysis\":\"")
                .append(analysis).append('\"');
        sb.append('}');
        return sb.toString();
    }

}
