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

namespace CMSMicroservice.Application.TransactionsCQ.EventHandlers.VerifyTransactionEventHandlers;

public class VerifyTransactionEventHandler : INotificationHandler<VerifyTransactionEvent>
{
    private readonly ILogger<VerifyTransactionEventHandler> _logger;

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

    public Task Handle(VerifyTransactionEvent notification, CancellationToken cancellationToken)
    {
        _logger.LogInformation("Transaction {TransactionId} verified with status {Status} and RefId {RefId}", 
            notification.Item.Id, 
            notification.Item.PaymentStatus,
            notification.Item.RefId);
        
        return Task.CompletedTask;
    }
}
