using Furion.DynamicApiController;
using Microsoft.AspNetCore.Mvc;
using Nirvana.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Waste.Application.ReportInfo
{
    /// <summary>
    /// 统计报表
    /// </summary>
    public class ReportAppService : IDynamicApiController
    {
        private readonly IReportService _reportService;
        public ReportAppService(IReportService reportService)
        {
            _reportService = reportService;
        }
        /// <summary>
        /// 统计列表
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PageParms<ReportList>> GetListAsync(QueryParams param)
        {
            return await _reportService.GetListAsync(param);
        }

        /// <summary>
        /// 根据商户和垃圾类型进行汇总
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PageParms<ReportList>> GetListByBusinessAsync(QueryParams param)
        {
            return await _reportService.GetListByBusinessAsync(param);
        }
        /// <summary>
        /// 获取一定时间段内的统计数据,第三方接口对接使用
        /// </summary>
        /// <param name="appid"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost]
        [QueryParameters]
        [ApiDescriptionSettings("Api")]
        [ApiAsyncActionFilter]
        [NonUnify]
        public async Task<ResultInfo> GetDataAsync([FromQuery]string appid, [FromBody]ApiReportRequestData param)
        {
            return await _reportService.GetDataAsync(param,appid);
        }
    }
}
