using Infrastructure;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.App.ServiceApp.DroneSsnydManage;
using OpenAuth.App.ServiceApp.DroneSsnydManage.Export;
using OpenAuth.App.ServiceApp.DroneSsnydManage.Request;
using OpenAuth.Repository.Domain;

namespace OpenAuth.WebApi.Controllers.ServiceControllers
{
    /// <summary>
    /// 批后监管--数据统计
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class DroneSsnyStatisticsController : ControllerBase
    {
        DroneSsnyStatisticsApp _app;
        public DroneSsnyStatisticsController(DroneSsnyStatisticsApp app)
        {
            _app = app;
        }

        #region 统计
        /// <summary>
        /// 统计分析
        /// </summary>
        /// <param name="xiangmu_yt">项目名称</param>
        /// <returns></returns>
        [HttpGet]
        public Response<List<OffenceResp>> CaseOffenceForSsny(string xiangmu_yt)
        {
            Response<List<OffenceResp>> response = new Response<List<OffenceResp>>();
            try
            {
                response = _app.CaseOffence(xiangmu_yt);
            }
            catch (Exception ex)
            {
                response.Code = 500;
                response.Message = ex.InnerException?.Message ?? ex.Message;
            }
            return response;
        }
        /// <summary>
        /// 获取穿透案件信息 
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        [HttpGet]
        [AllowAnonymous]
        public async Task<Response<PageInfo<List<QueryCaseOffenceListResp>>>> GetCaseInfo([FromQuery] QuerySsnyListReq req)
        {
            return await _app.GetCaseInfo(req);
        }
        #endregion
    }
}
