using System;
using System.Collections.Generic;

namespace CncModels.Dto
{
    /// <summary>
    /// 分页结果
    /// </summary>
    /// <typeparam name="T">数据项类型</typeparam>
    public class PagedResult<T>
    {
        /// <summary>数据列表</summary>
        public List<T> Items { get; set; } = new List<T>();

        /// <summary>总记录数</summary>
        public int Total { get; set; }

        /// <summary>当前页码（从1开始）</summary>
        public int Page { get; set; }

        /// <summary>每页条数</summary>
        public int PageSize { get; set; }

        /// <summary>总页数</summary>
        public int TotalPages => PageSize > 0 ? (int)Math.Ceiling((double)Total / PageSize) : 0;
    }
}
