package com.ssj.bean.conch.conch.dto;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author: chchen
 * @Description
 * @Date Create in 11:39 2019/10/30
 * @Modified By
 */
public class KmtExerciseQuestionProblemDto implements Serializable {
    private static final long serialVersionUID = 1L;

    private String questionId;

    private String question;

    private String answerJson;

    private String bigQuestionIndex;

    private String questionPath;

    private List<ExerciseQuestionAnswerSpaceDto>  answers = new ArrayList<>();

    public String getQuestionId() {
        return questionId;
    }

    public void setQuestionId(String questionId) {
        this.questionId = questionId;
    }

    @JSONField(serialize=false)
    public String getAnswerJson() {
        return answerJson;
    }

    public void setAnswerJson(String answerJson) {
        this.answerJson = answerJson;
        this.answers = JSON.parseArray(answerJson, ExerciseQuestionAnswerSpaceDto.class);
        int index = 1;
        if (this.answers != null && this.answers.size() > 0) {
            for (ExerciseQuestionAnswerSpaceDto questionAnswer : this.answers) {
                questionAnswer.setIndex(index);
                index++;
            }
        }
    }

    @JSONField(serialize=false)
    public String getBigQuestionIndex() {
        return bigQuestionIndex;
    }

    public void setBigQuestionIndex(String bigQuestionIndex) {
        this.bigQuestionIndex = bigQuestionIndex;
    }

    public String getQuestion() {
        return question;
    }

    public void setQuestion(String question) {
        this.question = question;
    }

    public List<ExerciseQuestionAnswerSpaceDto> getAnswers() {
        return answers;
    }

    public void setAnswers(List<ExerciseQuestionAnswerSpaceDto> answers) {
        this.answers = answers;
    }

    @JSONField(serialize=false)
    public String getQuestionPath() {
        return questionPath;
    }

    public void setQuestionPath(String questionPath) {
        this.questionPath = questionPath;
    }
}
