using YBEE.EQM.Core;

namespace YBEE.EQM.Application
{
    /// <summary>
    /// 角色菜单
    /// </summary>
    [ApiDescriptionSettings(Name = "sys-role-menu")]
    [Route("sys/role/menu")]
    [AppAuthorize]
    public class SysRoleMenuAppService : IDynamicApiController
    {
        private readonly ISysRoleMenuService _roleMenuService;
        public SysRoleMenuAppService(ISysRoleMenuService roleMenuService)
        {
            _roleMenuService = roleMenuService;
        }

        /// <summary>
        /// 获取角色的菜单Id集合
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>
        [DisableOpLog]
        public async Task<List<int>> GetRoleMenuIdList(int roleId)
        {
            return await _roleMenuService.GetRoleMenuIdList(new List<int> { roleId });
        }
        /// <summary>
        /// 获取角色对象菜单列表
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>
        [DisableOpLog]
        public async Task<List<SysRoleMenuOutput>> GetRoleMenuList(int roleId)
        {
            return await _roleMenuService.GetRoleMenuList(roleId);
        }
        /// <summary>
        /// 授权角色菜单
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task GrantRoleMenu(GrantSysRoleMenuInput input)
        {
            await _roleMenuService.GrantRoleMenu(input);
        }
    }
}