using BPA.SAAS.Manage.Application.Org.Dtos.Users;
using BPA.SAAS.Manage.Application.Org.Interface;
using BPA.SAAS.Manage.Core.Base;
using BPA.SAAS.Manage.Core.Org;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.Org
{
    [ApiDescriptionSettings("Org", Tag = "用户账号信息")]
    public class UserServices: IDynamicApiController
    {
        IUserService _userService;
        public UserServices(IUserService userService) 
        {
            _userService=userService;
        }
        [HttpPost("/api/user/userpage")]
        public async Task<PageUtil> UserPage(UserDtoPageInput input)
        {
            return await _userService.UserPage(input);
        }
        [HttpPost("/api/user/add")]
        public async Task<bool> AddUser(UserDtoInput input)
        {
            return await _userService.AddUser(input);
        }
        [HttpPost("/api/user/update")]
        public async Task<bool> UpdateUser(UserDtoInput input)
        {
            return await _userService.UpdateUser(input);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("/api/user/delete")]
        public async Task<bool> DeleteUser(List<string> input)
        {
            return await _userService.DeleteUser(input);
        }
        /// <summary>
        /// 启用
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        [HttpGet("/api/user/enable")]
        public async Task<bool> Enable(string Id)
        {
            return await _userService.Enable(Id);
        }
        /// <summary>
        /// 禁用
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        [HttpGet("/api/user/disable")]
        public async Task<bool> Disable(string Id)
        {
            return await _userService.Disable(Id);
        }
        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        [HttpGet("/api/user/resetuserpwd")]
        public async Task<bool> ResetPwd(string Id)
        {
            return await _userService.ResetPwd(Id);
        }
        /// <summary>
        /// 变更密码
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("/api/user/updatepwd")]
        public async Task<bool> UpdatePwd(UserPwdDtoInput input)
        {
            return await _userService.UpdatePwd(input);
        }
        /// <summary>
        /// 获取当前用户的角色
        /// </summary>
        /// <param name="UserId"></param>
        /// <returns></returns>
        [HttpGet("/api/user/getuserrole")]
        public async Task<UserRoleDtoInput> GetUserRole(string UserId)
        {
            return await _userService.GetUserRole(UserId);
        }
        /// <summary>
        /// 新增用户角色
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("/api/user/adduserrole")]
        public async Task<bool> AddUserRole(UserRoleDtoInput input)
        {
            return await _userService.AddUserRole(input);

        }
    }
}
