namespace HoneyBox.Admin.Business.Models;

/// <summary>
/// 分页请求基类
/// </summary>
public class PagedRequest
{
    private int _page = 1;
    private int _pageSize = 20;

    /// <summary>
    /// 页码，从 1 开始
    /// </summary>
    public int Page
    {
        get => _page;
        set => _page = value < 1 ? 1 : value;
    }

    /// <summary>
    /// 每页数量，默认 20，最大 100
    /// </summary>
    public int PageSize
    {
        get => _pageSize;
        set => _pageSize = value < 1 ? 20 : (value > 100 ? 100 : value);
    }

    /// <summary>
    /// 计算跳过的记录数
    /// </summary>
    public int Skip => (Page - 1) * PageSize;
}
