using SafeCampus.Application.Services.Business.CameraGroupService;

namespace SafeCampus.Web.Core.Controllers.Application.Business;
/// <summary>
/// 摄像头分组管理接口
/// </summary>
[ApiDescriptionSettings(ApiGroupConsts.SYSTEM_Business, Order = 90, Tag = "摄像头分组管理")]
[Route("/business/cameraGroup")]
[RolePermission]
public class CameraGroupController
{
    private readonly ICameraGroupService _cameraGroupService;

    public CameraGroupController(ICameraGroupService cameraGroupService)
    {
        _cameraGroupService = cameraGroupService;
    }

    /// <summary>
    /// 添加分组
    /// </summary>
    /// <param name="input">添加参数</param>
    /// <returns></returns>
    public Task<bool> Add(CameraGroupAddInput input)
    {
        return _cameraGroupService.Add(input);
    }

    /// <summary>
    /// 修改分组
    /// </summary>
    /// <param name="input">添加参数</param>
    /// <returns></returns>
    public Task<bool> Update(CameraGroupInput input)
    {
        return _cameraGroupService.Update(input);
    }

    /// <summary>
    /// 删除分组
    /// </summary>
    /// <param name="id">id</param>
    /// <returns></returns>
    public Task<bool> Delete(long id)
    {
        return _cameraGroupService.Delete(id);
    }

    /// <summary>
    /// 获取分组列表
    /// </summary>
    /// <returns></returns>
    public async Task<List<CameraGroup>> GetNoPageList()
    {
        var list =await _cameraGroupService.GetNoPageList();
        list.Insert(0, new CameraGroup { Name = "无分组", Id = -1 });
        return list;
    }
}