using Microsoft.Extensions.DependencyInjection;
using Tiku.Application.Jobs;
using Tiku.Infrastructure.Jobs;

namespace Tiku.Infrastructure;

internal static class JobsModule
{
    internal static IServiceCollection AddJobsModule(this IServiceCollection services)
    {
        services.AddScoped<BackgroundJobService>();
        services.AddScoped<IBackgroundJobService>(provider => provider.GetRequiredService<BackgroundJobService>());
        services.AddScoped<IBackgroundJobQueue>(provider => provider.GetRequiredService<BackgroundJobService>());
        services.AddScoped<IBackgroundJobProcessor>(provider => provider.GetRequiredService<BackgroundJobService>());
        services.AddScoped<IBackgroundJobOperations>(provider => provider.GetRequiredService<BackgroundJobService>());
        services.AddScoped<BackgroundJobHandlerRegistry>();
        return services;
    }
}
