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

import cn.reghao.jutil.jdk.web.db.BaseObject;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * @author reghao
 * @date 2024-08-28 08:48:47
 */
@NoArgsConstructor
@Setter
@Getter
public class PaperQuestion extends BaseObject<Integer> {
    private Integer paperId;
    @NotNull
    private Integer pos;
    @NotNull
    private Long questionId;
    @NotNull
    private Integer type;
    @NotNull
    private Integer score;
    // 组合题
    @Size(max = 20)
    private transient List<PaperQuestion> children = new ArrayList<>();

    public PaperQuestion(int pos, Question question, int score) {
        this.questionId = question.getQuestionId();
        this.type = question.getType();
        this.pos = pos;
        this.score = score;
    }

    public void setPaperId(Integer paperId) {
        this.paperId = paperId;
    }
}
