package tech.easyflow.chatlog.domain.query;

import java.io.Serializable;

public class ChatPageQuery implements Serializable {

    private long pageNumber = 1;
    private long pageSize = 20;

    public long getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(long pageNumber) {
        this.pageNumber = Math.max(pageNumber, 1);
    }

    public long getPageSize() {
        return pageSize;
    }

    public void setPageSize(long pageSize) {
        this.pageSize = pageSize <= 0 ? 20 : Math.min(pageSize, 200);
    }

    public long getOffset() {
        return (pageNumber - 1) * pageSize;
    }
}
