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

namespace OpenAuth.WebApi.Controllers.ServiceControllers;

/// <summary>
/// 大飞机信息
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class LasaAircraftController : ControllerBase
{
    private readonly LasaAircraftServiceApp _app;

    public LasaAircraftController(LasaAircraftServiceApp app)
    {
        _app = app;
    }

    /// <summary>
    /// 添加大飞机信息
    /// </summary>
    /// <param name="info"></param>
    /// <returns></returns>
    [HttpPost]
    public async Task<Response<bool>> AddLasaAircraft(LasaAircraft info)
    {
        return await _app.AddLasaAircraft(info);
    }

    /// <summary>
    /// 删除大飞机信息
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    [HttpPost]
    public async Task<Response<bool>> DeleteLasaAircraft(string id)
    {
        return await _app.DeleteLasaAircraft(id);
    }

    /// <summary>
    /// 修改大飞机信息
    /// </summary>
    /// <param name="info"></param>
    /// <returns></returns>
    [HttpPost]
    public async Task<Response<bool>> UpdateLasaAircraft(LasaAircraft info)
    {
        return await _app.UpdateLasaAircraft(info);
    }

    /// <summary>
    /// 获取大飞机信息列表
    /// </summary>
    /// <param name="key"></param>
    /// <param name="page"></param>
    /// <param name="limit"></param>
    /// <returns></returns>
    [HttpGet]
    public async Task<Response<PageInfo<IEnumerable<LasaAircraft>>>> GetLasaAircraftList(
        [FromQuery] string key, [FromQuery] int page = 1, [FromQuery] int limit = 10)
    {
        return await _app.GetLasaAircraftList(key, page, limit);
    }

    /// <summary>
    /// 获取大飞机信息详情
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    [HttpGet]
    public async Task<Response<LasaAircraft>> GetLasaAircraft(string id)
    {
        return await _app.GetLasaAircraft(id);
    }
    [HttpPost]
    public async Task<Response<bool>> StartLiveStreaming(string id)
    {
        return await _app.StartLiveStreaming(id);
    }
    [HttpPost]
    public async Task<Response<bool>> StopLiveStreaming(string id)
    {
        return await _app.StopLiveStreaming(id);
    }
}