package cn.reghao.tnb.content.app.exam.model.po;

import cn.reghao.jutil.jdk.db.BaseObject;
import cn.reghao.tnb.content.app.exam.model.dto.QuestionAddDto;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 试题
 *
 * @author reghao
 * @date 2024-08-24 23:28:02
 */
@NoArgsConstructor
@Getter
public class Question extends BaseObject<Integer> {
    private Integer subjectId;
    private Integer type;
    private Integer level;
    private String content;
    private String analysis;
    private Long createBy;
    private Integer pid;
    private Boolean child;
    private Integer pos;

    public Question(QuestionAddDto questionAddDto) {
        this.subjectId = questionAddDto.getSubjectId();
        this.type = questionAddDto.getQuestionType();
        this.level = questionAddDto.getQuestionLevel();
        this.content = questionAddDto.getQuestionContent();
        this.analysis = questionAddDto.getAnalysis();
        this.pid = 0;
        this.child = false;
        this.pos = 0;
    }

    public Question(QuestionAddDto questionAddDto, boolean child) {
        this.subjectId = questionAddDto.getSubjectId();
        this.type = questionAddDto.getQuestionType();
        this.level = questionAddDto.getQuestionLevel();
        this.content = questionAddDto.getQuestionContent();
        this.analysis = questionAddDto.getAnalysis();
        this.pid = 0;
        this.child = child;
        this.pos = 0;
    }

    public void setSubjectId(Integer subjectId) {
        this.subjectId = subjectId;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    public void setPos(Integer pos) {
        this.pos = pos;
    }
}
