using Infrastructure;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.App.ServiceApp.Achievement;
using OpenAuth.App.ServiceApp.Achievement.Request;
using OpenAuth.Repository.Domain;

namespace OpenAuth.WebApi.Controllers.ServiceControllers.AchievementManage;

/**
 * ai解译成果管理（shp）
 */
[Route("api/[controller]/[action]")]
[ApiController]
public class InAiShpController : ControllerBase
{
    private readonly InsAiShpApp _app;

    public InAiShpController(InsAiShpApp app)
    {
        _app = app;
    }

    /// <summary>
    /// ai解译成果管理列表
    /// </summary>
    /// <param name="req">地区 时间段 文件名称</param>
    /// <returns></returns>
    [HttpGet]
    public async Task<Response<PageInfo<List<InsAishp>>>> Load([FromQuery] InsAishpQuery req)
    {
        var result = await _app.Load(req);
        return new Response<PageInfo<List<InsAishp>>> { Result = result };
    }

    /// <summary>
    /// insAiShp详情
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    [HttpGet]
    public async Task<Response<InsAishp>> GetAiShp(string id)
    {
        return await _app.GetAiShp(id);
    }

    /// <summary>
    /// 更新按钮接口
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    public async Task<Response<bool>> Update()
    {
        return await _app.Update();
    }
    
    /// <summary>
    ///  插入shp信息
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    public async Task<Response<bool>> Insert([FromBody] List<InsAiShpInsert> req)
    {
        return await _app.Insert(req);
    }
}