using Furion.DynamicApiController;
using Microsoft.AspNetCore.Mvc;
using Nirvana.Common;
using System.Threading.Tasks;
using Waste.Application.SubscribeInfo;

namespace Waste.Application.ResultInfos
{
    /// <summary>
    /// 投放记录
    /// </summary>
    public class ResultAppService : IDynamicApiController
    {
        private readonly IResultService _resultService;

        public ResultAppService(IResultService resultService)
        {
            _resultService = resultService;
        }

        /// <summary>
        /// 投放记录列表
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PageParms<ResultList>> GetListAsync(QueryParams param)
        {
            return await _resultService.GetListAsync(param);
        }

        /// <summary>
        /// 添加记录
        /// </summary>
        /// <param name="myPackage"></param>
        /// <returns></returns>
        public async Task<ResultInfo> InsertResultAsync(MyPackage myPackage)
        {
            return await _resultService.InsertResultAsync(myPackage);
        }

        /// <summary>
        /// wifi模块测量结果增加
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public async Task InsertResultByWifiAsync(WifiPackage data)
        {
            await _resultService.InsertResultByWifiAsync(data);
        }

        /// <summary>
        /// 查询历史投放记录
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("api/open/getresultlist")]
        [ApiDescriptionSettings("DevApi")]
        public async Task<PageParms<ResultListByEquS2CDto>> GetListByEquAsync(ResultListByEquC2SDto input)
        {
            return await _resultService.GetListByEquAsync(input);
        }
    }
}