using BBWY.Client.Models;
using BBWY.Common.Http;
using BBWY.Common.Models;
using System;
using System.Net.Http;

namespace BBWY.Client.APIServices
{
    public class StatisticsService : BaseApiService, IDenpendency
    {
        public StatisticsService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext)
        {

        }

        /// <summary>
        /// 今日业绩统计
        /// </summary>
        /// <returns></returns>
        public ApiResponse<ToDayOrderAchievementResponse> GetTodayAchievementStatistics(DateTime startTime, DateTime endTime)
        {
            return SendRequest<ToDayOrderAchievementResponse>(globalContext.BBYWApiHost, "Api/Statistics/GetOrderAchievementStatistics", new
            {
                globalContext.User.Shop.ShopId,
                startTime,
                endTime
            },
            null, HttpMethod.Post);
        }

        public ApiResponse<OrderCountStatisticsResponse> GetOrderCountStatistics(long shopId, DateTime startDate, DateTime endDate)
        {
            return SendRequest<OrderCountStatisticsResponse>(globalContext.BBYWApiHost, "Api/Statistics/GetOrderCountStatistics", $"shopId={shopId}&startDate={startDate:yyyy-MM-dd}&endDate={endDate:yyyy-MM-dd}", null, HttpMethod.Get);
        }
    }
}