namespace PARR.API.Contracts.V1.Requests.Queries
{
    public class PaginationQuery
    {
        private int pageSizeMax = 100;
        private int pageSizeDefault = 10;

        private int pageNumberMin = 1;

        public PaginationQuery()
        {
            PageNumber = pageNumberMin;
            PageSize = pageSizeDefault;
        }

        public PaginationQuery(int pageNumber, int pageSize)
        {
            PageNumber = pageNumber;
            PageSize = pageSize;
        }

        private int _pageNumber;
        public int PageNumber
        {
            get
            {
                return _pageNumber;
            }
            set
            {
                if (value < pageNumberMin)
                    _pageNumber = pageNumberMin;
                else
                    _pageNumber = value;
            }
        }

        private int _pageSize;
        public int PageSize
        {
            get
            {
                return _pageSize;
            }
            set
            {
                if (value > pageSizeMax)
                    _pageSize = pageSizeMax;
                else
                    _pageSize = value;

                if (_pageSize < 1)
                    _pageSize = pageSizeDefault;
            }
        }

        ///// <summary>
        ///// Выключить пагинацию
        ///// </summary>
        //public bool IsDisabledPagination { get; set; } = false;
    }
}
