using Nostr.Client.Messages;

namespace NostrServices.Services.EventHandlers;

public interface IEventHandler
{
    /// <summary>
    /// Handle an event from the network
    /// </summary>
    /// <param name="ev"></param>
    /// <returns></returns>
    ValueTask HandleEvent(NostrEvent ev);
}


public static class EventHandlerStartup
{
    public static void AddNostrEventHandlers(this IServiceCollection services)
    {
        services.AddSingleton<IEventHandler, RedisEventCache>();
        services.AddSingleton<IEventHandler, RedisStreamPublisher>();
    }
}