using MediatR;
using System.Threading;
using System.Threading.Tasks;
using UserManagement.Data;
using UserManagement.Helper;
using UserManagement.MediatR.CommandAndQuery;
using UserManagement.Repository;

namespace UserManagement.MediatR.Handlers
{
    public class GetAllReminderNotificationQueryHandler : IRequestHandler<GetAllReminderNotificationQuery, PagedList<ReminderScheduler>>
    {
        private readonly IReminderSchedulerRepository _reminderSchedulerRepository;

        public GetAllReminderNotificationQueryHandler(
            IReminderSchedulerRepository reminderSchedulerRepository
           )
        {
            _reminderSchedulerRepository = reminderSchedulerRepository;
        }

        public async Task<PagedList<ReminderScheduler>> Handle(GetAllReminderNotificationQuery request, CancellationToken cancellationToken)
        {
            return await _reminderSchedulerRepository.GetReminders(request.ReminderResource);
        }
    }
}
