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

namespace OpenAuth.WebApi.Controllers.ServiceControllers;

/**
 * 成果管理
 */
[Route("api/[controller]/[action]")]
[ApiController]
public class InsTifController : ControllerBase
{
    private readonly InsTifApp _app;

    public InsTifController(InsTifApp app)
    {
        _app = app;
    }
    // ai解译成果管理 列表  查询条件
    // 检索条件： 地区 时间段 

    /// <summary>
    /// tif影像列表
    /// </summary>
    /// <param name="req"></param>
    /// <returns></returns>
    [HttpGet]
    public async Task<Response<PageInfo<List<InsTif>>>> Load([FromQuery] InsTifQuery req)
    {
        var result = await _app.Load(req);
        return new Response<PageInfo<List<InsTif>>> { Result = result };
    }

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

    /// <summary>
    /// 更新按钮接口
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    public async Task<Response<bool>> Update()
    {
        return await _app.Update();
    }

    /// <summary>
    ///  插入影像数据
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    public async Task<Response<bool>> Insert([FromBody] List<InsTifInsert> req)
    {
        return await _app.Insert(req);
    }
}