using NetworkResurrector.Api.Application.Services.Abstractions;
using NetworkResurrector.Api.Domain.Constants;
using System.Linq;
using System.Threading.Tasks;

namespace NetworkResurrector.Api.Application.Services
{
    internal class UserService : IUserService
    {
        private readonly IUserContext _userContext;

        public UserService(IUserContext userContext)
        {
            _userContext=userContext;
        }

        public async Task<bool> GetIsGuest()
        {
            var permissions = await _userContext.GetUserPermissions();
            var isGuest = permissions == null || permissions.Contains(PermissionCodes.GUEST_ACCESS);
            return isGuest;
        }
    }
}
