using System.Collections.Generic;
using System.Threading.Tasks;
using GxPress.Result.DataCenter;
using GxPress.Service.Interface.PlatformData;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace GxPress.Api.AdminControllers
{
    /// <summary>
    /// 平台数据
    /// </summary>
    [Route("api/admin/platform")]
    [ApiController]
    [Authorize]
    public class AdminPlatformDataController : Controller
    {
        private readonly IPlatformDataService platformDataService;
        public AdminPlatformDataController(IPlatformDataService platformDataService)
        {
            this.platformDataService = platformDataService;
        }
        /// <summary>
        /// 平台数据
        /// </summary>
        /// <returns></returns>
        [HttpGet("data")]
        public async Task<PlatformDataResult> GetPlatformDataResult()
        {
            var result = new PlatformDataResult();
            result.PlatformOperationDataResult = await platformDataService.GetPlatformDataAsync();
            result.UserIncreaseResult = await platformDataService.GetUserIncreaseResult();
            result.UserAreaDistributingResults = await platformDataService.GetUserAreaDistributingResults();
            result.UserVipProportionResult = await platformDataService.GetUserVipProportionResult();
            result.OnlineUserResult = await platformDataService.GetOnlineUserResult();
            result.PlatformContentDataResult = await platformDataService.GetPlatformContentDataResult();
            result.ContentTypeDistributingResult = await platformDataService.GetContentTypeDistributingResults();
            result.ContentOlogyDistributingResult = new List<ContentOlogyDistributingResult>();
            result.PayContentstatisticsResult = await platformDataService.GetPayContentstatisticsResult();
            result.ContentIncreaseResult = await platformDataService.GetContentIncreaseResult();
            result.PlatformAccumulativeVisitResult = await platformDataService.GetPlatformAccumulativeVisitResult();
            result.VisitPortResult = new List<VisitPortResult>();
            result.PlatformCommerceResult = await platformDataService.GetPlatformCommerceResult();
            result.ContentSaleRankingResults = await platformDataService.GetContentSaleRankingResults();
            result.ContentSaleProportionResults = await platformDataService.GetContentSaleProportionResults();
            return result;
        }
        /// <summary>
        /// 内容数据
        /// </summary>
        /// <returns></returns>
        [HttpGet("content-data")]
        public async Task<ContentDataResult> GetContentDataResult()
        {
            var result = new ContentDataResult();
            result.PlatformContentDataInfoResult = await platformDataService.GetPlatformContentDataInfoResults();
            result.ContentTypeDistributingResult = await platformDataService.GetContentTypeDistributingResults();
            result.ContentOlogyDistributingResult = new List<ContentOlogyDistributingResult>();
            result.PayContentstatisticsResult = await platformDataService.GetPayContentstatisticsResult();
            result.ContentIncreaseResult = await platformDataService.GetContentIncreaseResult();
            return result;
        }
        /// <summary>
        /// 访问数据
        /// /// </summary>
        /// <returns></returns>
        [HttpGet("visit-data")]
        public async Task<VisitDataResult> GetVisitDataResult()
        {
            var result = new VisitDataResult();
            result.PlatformAccumulativeVisitResult = await platformDataService.GetPlatformAccumulativeVisitResult();
            result.VisitPortResult = new List<VisitPortResult>();
            result.PlatformTodayVisitResult = await platformDataService.GetPlatformTodayVisitResult();
            return result;
        }
        /// <summary>
        /// 商务数据
        /// </summary>
        /// <returns></returns>
        [HttpGet("commerce-data")]
        public async Task<CommerceDataResult> GetCommerceDataResult()
        {
            return await platformDataService.GetCommerceDataResult();
        }
        /// <summary>
        /// 运营数据
        /// </summary>
        /// <returns></returns>
        [HttpGet("operation-data")]
        public async Task<OperationDataResult> GetOperationDataResult()
        {
            var result = new OperationDataResult();
            result.PlatformOperationDataResult = await platformDataService.GetPlatformDataAsync();
            result.UserIncreaseResult = await platformDataService.GetUserIncreaseResult();
            result.UserAreaDistributingResults = await platformDataService.GetUserAreaDistributingResults();
            result.UserVipProportionResult = await platformDataService.GetUserVipProportionResult();
            result.OnlineUserResult = await platformDataService.GetOnlineUserResult();
            return result;
        }
    }
}