using System.Text;

namespace Quadarax.Foundation.Core.Data
{
    public class Paging : IPaging
    {
        #region *** Properties ***
        public int Page { get; protected set; }
        public int PageSize { get; protected set; }
        public bool IsDisabled { get; protected set; }
        public static IPaging NoPaging => new Paging(0, 0);
        #endregion

        #region *** Constructors ***
        public Paging(int page, int pageSize)
        {
            Page = page;
            PageSize = pageSize;
            IsDisabled = (PageSize == 0);
        }
        #endregion

        #region *** Operations ***
        public override string ToString()
        {
            var sb = new StringBuilder();
            sb.Append("Paging:").Append(IsDisabled ? "Disabled" : "Enabled").Append(";Page=").Append(Page).Append(";PageSize=").Append(PageSize);
            return sb.ToString();
        }
        #endregion
    }
}
