using Microsoft.Extensions.Logging;
using Tiobon.Core.Common;
using Tiobon.Core.EventBus.EventHandling;

namespace Tiobon.Core.EventBus;

public class TiobonQueryIntegrationEventHandler : IIntegrationEventHandler<TiobonQueryIntegrationEvent>
{
    private readonly ILogger<TiobonQueryIntegrationEventHandler> _logger;

    public TiobonQueryIntegrationEventHandler(
        ILogger<TiobonQueryIntegrationEventHandler> logger)
    {
        _logger = logger ?? throw new ArgumentNullException(nameof(logger));
    }

    public async Task Handle(TiobonQueryIntegrationEvent @event)
    {
        _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, "Tiobon.Core", @event);

        ConsoleHelper.WriteSuccessLine($"----- Handling integration event: {@event.Id} at Tiobon.Core - ({@event})");

    }

}
