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

import cn.reghao.jutil.jdk.web.db.Page;
import cn.reghao.tnb.common.auth.UserContext;
import lombok.Getter;
import lombok.Setter;

/**
 * @author reghao
 * @date 2024-08-27 17:24:31
 */
@Setter
@Getter
public class ExamQuery {
    private Integer pageNumber;
    private Integer pageSize;
    private Long loginUser;
    private Integer paperId;
    private Boolean marked;

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

    private ExamQuery(Builder builder) {
        this.pageNumber = builder.pageNumber;
        this.pageSize = builder.pageSize;
        this.loginUser = builder.loginUser;
        this.paperId = builder.paperId;
        this.marked = builder.marked;
    }

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

    public static final class Builder {
        private Integer pageNumber;
        private Integer pageSize;
        private Long loginUser;
        private Integer paperId;
        private Boolean marked;

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

        public Builder loginUser(long loginUser) {
            this.loginUser = loginUser;
            return this;
        }

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

        public Builder marked(boolean marked) {
            this.marked = marked;
            return this;
        }

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