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

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

/**
 * @author reghao
 * @date 2024-08-27 17:24:31
 */
@Setter
@Getter
public class PaperQuery {
    private Integer pageNumber;
    private Integer pageSize;
    private Integer subjectId;
    private Integer scope;

    public PaperQuery() {
        this.pageNumber = 1;
        this.pageSize = 10;
    }

    private PaperQuery(Builder builder) {
        this.pageNumber = builder.pageNumber;
        this.pageSize = builder.pageSize;
        this.subjectId = builder.subjectId;
        this.scope = builder.scope;
    }

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

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

        public Builder() {
            this.pageNumber = 1;
            this.pageSize = 10;
        }

        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 scope(int scope) {
            this.scope = scope;
            return this;
        }

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