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

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

/**
 * @author reghao
 * @date 2023-09-18 11:36:52
 */
@NoArgsConstructor
@Setter
@Getter
public class QuestionQuery {
    private Integer pageNumber;
    private Integer pageSize;
    private Integer subjectId;
    private Integer type;
    private Integer level;

    private QuestionQuery(Builder builder) {
        this.pageNumber = builder.pageNumber;
        this.pageSize = builder.pageSize;
        this.subjectId = builder.subjectId;
        this.type = builder.type;
        this.level = builder.level;
    }

    public Page getPage() {
        return new Page(pageNumber, pageSize);
    }

    public static final class Builder {
        private Integer pageNumber;
        private Integer pageSize;
        private Integer subjectId;
        private Integer type;
        private Integer level;

        public Builder pageNumber(int pageNumber) {
            this.pageNumber = pageNumber;
            return this;
        }

        public Builder pageSize(int pageSize) {
            this.pageSize = pageSize;
            return this;
        }

        public Builder subjectId(int subjectId) {
            this.subjectId = subjectId;
            return this;
        }

        public Builder level(int level) {
            this.level = level;
            return this;
        }

        public Builder type(int type) {
            this.type = type;
            return this;
        }

        public QuestionQuery build() {
            return new QuestionQuery(this);
        }
    }
}
