using ColaFlow.Modules.Identity.Domain.Aggregates.Invitations.Events;
using MediatR;
using Microsoft.Extensions.Logging;

namespace ColaFlow.Modules.Identity.Application.EventHandlers;

/// <summary>
/// Event handler for InvitationCancelledEvent - logs cancellation
/// </summary>
public class InvitationCancelledEventHandler : INotificationHandler<InvitationCancelledEvent>
{
    private readonly ILogger<InvitationCancelledEventHandler> _logger;

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

    public Task Handle(InvitationCancelledEvent notification, CancellationToken cancellationToken)
    {
        _logger.LogInformation(
            "Invitation cancelled: Email={Email}, Tenant={TenantId}",
            notification.Email,
            notification.TenantId);

        // Future: Could notify invited user, track cancellation metrics, etc.

        return Task.CompletedTask;
    }
}
