using Microsoft.Extensions.Logging;
using CMSMicroservice.Domain.Events;

namespace CMSMicroservice.Application.UserCartsCQ.EventHandlers.ClearCartEventHandlers;

public class ClearCartEventHandler : INotificationHandler<ClearCartEvent>
{
    private readonly ILogger<ClearCartEventHandler> _logger;

    public ClearCartEventHandler(ILogger<ClearCartEventHandler> logger)
    {
        _logger = logger;
    }

    public Task Handle(ClearCartEvent notification, CancellationToken cancellationToken)
    {
        _logger.LogInformation("Cart item {CartId} removed for user {UserId}", 
            notification.Item.Id,
            notification.Item.UserId);
        
        return Task.CompletedTask;
    }
}
