using JiaZhiQuan.Common.Utils;
using Senparc.Weixin.Entities;
using Wicture.DbRESTFul;

namespace JiaZhiQuan.Common.Response
{
    public class ResultObject
    {
        public int statusCode { get; set; }
        public string errorMessage { get; set; }
        public object data { get; set; }

        public ResultObject()
        {
            statusCode = ErrorCodes.Success;
            errorMessage = string.Empty;
        }

        public static QueryResult BuildOkQuery(object data, Pagination pagination = null)
        {
            return new QueryResult
            {
                items = data,
                pagination = pagination
            };
        }

        public static OperateResult BuildOkCommand(int count)
        {
            return new OperateResult
            {
                count = count
            };
        }
    }

}
