using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using UserManagement.MediatR.Queries;
using UserManagement.Repository;

namespace UserManagement.MediatR.Handlers
{
    public class GetAllUserNotificationQueryHandler : IRequestHandler<GetAllUserNotificationQuery, NotificationList>
    {
        private readonly IUserNotificationRepository _userNotificationRepository;
        public GetAllUserNotificationQueryHandler(
           IUserNotificationRepository userNotificationRepository
            )
        {
            _userNotificationRepository = userNotificationRepository;

        }
        public async Task<NotificationList> Handle(GetAllUserNotificationQuery request, CancellationToken cancellationToken)
        {
            return await _userNotificationRepository.GetUserNotifications(request.NotificationResource);
        }
    }
}
