using Infrastructure;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.App.ServiceApp.FireManagement;
using OpenAuth.App.ServiceApp.FireManagement.Request;
using OpenAuth.App.ServiceApp.GoView;
using System.Data;

namespace OpenAuth.WebApi.Controllers.ServiceControllers.FireManagement
{
    /// <summary>
    /// 自然资源管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class FireResourcesController : ControllerBase
    {
        private readonly FireResourcesApp _app;

        public FireResourcesController(FireResourcesApp app)
        {
            _app = app;
        }
        /// <summary>
        /// 根据sql获取数据
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        [HttpPost]
        [AllowAnonymous]
        public async Task<Response<DataTable>> GetDataBySql(SqlReq sql)
        {
            return await _app.GetDataBySql(sql);
        }
        /// <summary>
        /// 寻路
        /// </summary>
        /// <param name="startlng"></param>
        /// <param name="startlat"></param>
        /// <param name="endlng"></param>
        /// <param name="endlat"></param>
        /// <param name="areaname"></param>
        /// <returns></returns>
        [HttpPost]
        [AllowAnonymous]
        public async Task<Response<DataTable>> LoadRoad(double startlng, double startlat, double endlng, double endlat, string areaname)
        {
            return await _app.LoadRoad(startlng, startlat, endlng, endlat, areaname);
        }
    }
}
