using Microsoft.Extensions.DependencyInjection;
using OmsorgCore.Engine.Events;
using OmsorgCore.Engine.Handlers;

namespace OmsorgCore.Engine;

public static class DependencyInjection
{
    public static IServiceCollection AddEngine(this IServiceCollection services)
    {
        services.AddSingleton<IDomainEventDispatcher, DomainEventDispatcher>();
        services.AddScoped<IDomainEventHandler<EmployeeCreatedEvent>, EmployeeCreatedHandler>();
        services.AddScoped<IDomainEventHandler<FacilityCreatedEvent>, FacilityCreatedHandler>();
        services.AddScoped<IDomainEventHandler<ContractCreatedEvent>, ContractCreatedHandler>();
        services.AddScoped<IDomainEventHandler<OrderCreatedEvent>, OrderCreatedHandler>();
        services.AddScoped<IDomainEventHandler<PasswordResetRequestedEvent>, PasswordResetRequestedHandler>();
        services.AddScoped<IDomainEventHandler<UserInvitedEvent>, UserInvitedHandler>();
        services.AddScoped<IDomainEventHandler<AuditEvent>, AuditEventHandler>();

        return services;
    }
}
