using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using UserManagement.Data.Dto;
using UserManagement.MediatR.Commands;
using UserManagement.Repository;

namespace UserManagement.MediatR.Handlers
{
    public class MarkAsReadHandler : IRequestHandler<MarkAsReadCommand, UserNotificationDto>
    {
        private readonly IUserNotificationRepository _userNotificationRepository;
        public MarkAsReadHandler(IUserNotificationRepository userNotificationRepository)
        {
            _userNotificationRepository = userNotificationRepository;
        }
        public async Task<UserNotificationDto> Handle(MarkAsReadCommand request, CancellationToken cancellationToken)
        {
            await _userNotificationRepository.MarkAsRead(request.Id);
            return new UserNotificationDto();
        }

    }
}
