using YBEE.EQM.Core;

namespace YBEE.EQM.Application
{
    /// <summary>
    /// 角色用户
    /// </summary>
    [ApiDescriptionSettings(Name = "sys-role-user")]
    [Route("sys/role/user")]
    [AppAuthorize]
    public class SysRoleUserAppService : IDynamicApiController
    {
        private readonly ISysRoleUserService _roleUserService;
        public SysRoleUserAppService(ISysRoleUserService roleUserService)
        {
            _roleUserService = roleUserService;
        }

        /// <summary>
        /// 添加用户到角色
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task AddRoleUser(SysRoleUserInput input)
        {
            await _roleUserService.AddRoleUser(input);
        }
        /// <summary>
        /// 移出角色中的用户
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task RemoveRoleUser(SysRoleUserInput input)
        {
            await _roleUserService.RemoveRoleUser(input);
        }
        /// <summary>
        /// 获取指定角色中的用户列表
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>
        [DisableOpLog]
        public async Task<List<SysUserOutput>> GetInRoleUserList([Required] int roleId)
        {
            return await _roleUserService.GetInRoleUserList(roleId);
        }
        /// <summary>
        /// 分页查询角色用户列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [DisableOpLog]
        public async Task<PageResult<SysUserOutput>> QueryInRoleUserPageList(SysRoleUserPageInput input)
        {
            return await _roleUserService.QueryInRoleUserPageList(input);
        }
        /// <summary>
        /// 获取未在指定角色中的用户列表
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>
        [DisableOpLog]
        public async Task<List<SysUserOutput>> GetNotInRoleUserList([Required] int roleId)
        {
            return await _roleUserService.GetNotInRoleUserList(roleId);
        }
        /// <summary>
        /// 通过权限标识获取人员列表
        /// </summary>
        /// <param name="permission">权限标识</param>
        /// <returns></returns>
        [DisableOpLog]
        public async Task<List<SysUserLiteOutput>> GetUserListByPermission([Required] string permission)
        {
            return await _roleUserService.GetUserListByPermission(permission);
        }
    }
}