package jnpf.model.cultivate.req.questionbank;

import jnpf.model.cultivate.po.question.FtbCultivateQuestionOption;
import jnpf.model.enums.CourseEnums;
import jnpf.util.FtbUtil;
import jnpf.util.StringUtil;
import lombok.Data;

@Data
public class QuestionOptionReq {
    /**
     * 选项ID
     */
    private String id;
    /**
     * 文案
     */

    private String content;

    /**
     * 图片
     */

    private String image;

    /**
     * 描述
     */

    private String description;


    /**
     * 排序码
     */

    private Long sortCode;


    /**
     * 是否是正确选项（0否，1是）,只用于：单选 多选 判断
     */
    private Integer isRightOption;


    /**
     * 正确文本答案，只用于：填空题
     */
    private String rightAnswer;

    public FtbCultivateQuestionOption convertData(String questionId) {
        FtbCultivateQuestionOption questionOption = new FtbCultivateQuestionOption();
        if (StringUtil.isEmpty(questionOption.getId())) {
            questionOption.setId(FtbUtil.getId());
        }
        questionOption.setQuestionId(questionId);
        questionOption.setContent(getContent());
        questionOption.setImage(getImage());
        questionOption.setDescription(getDescription());
        questionOption.setSortCode(getSortCode());
        questionOption.setIsRightOption(getIsRightOption());
        questionOption.setRightAnswer(getRightAnswer());
        questionOption.setEnabledMark(CourseEnums.EnabledMarkType.VALID.getCode());
        return questionOption;
    }
}
