using BBM.ChatGLM.Dtos;
using BBM.ChatGLM.User.Repositorys;

namespace BBM.ChatGLM.User
{
    public class UsersManager : ChatGLMDomainService
    {
        private readonly IUserFreeSqlRepository _userFreeSqlRepository;
        public UsersManager(IUserFreeSqlRepository userFreeSqlRepository)
        {
            _userFreeSqlRepository = userFreeSqlRepository;
        }

        public async Task<List<UserDto>> PageAsync(string name, int pageSize, int pageIndex, bool? enabled = null)
        {
            return await _userFreeSqlRepository.PageAsync(name, pageSize, pageIndex, CurrentTenant.Id, enabled);
        }

        public async Task<long> CountAsync(string name, bool? enabled = null)
        {
            return await _userFreeSqlRepository.CountAsync(name, CurrentTenant.Id, enabled);
        }

        public async Task<List<IdNameDto>> GetRolesAsync() 
        {
            return await _userFreeSqlRepository.GetRolesAsync(CurrentTenant.Id);
        }
    }
}
