using ClipForge.Core.Interfaces; using ClipForge.Core.Interfaces.Services; using ClipForge.Infrastructure.Configuration; using ClipForge.Infrastructure.Data; using ClipForge.Infrastructure.Repositories; using ClipForge.Infrastructure.Services; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace ClipForge.Infrastructure; public static class DependencyInjection { public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration) { // Configuration services.Configure(configuration.GetSection(OpenAiSettings.SectionName)); services.Configure(configuration.GetSection(PexelsSettings.SectionName)); services.Configure(configuration.GetSection(StorageSettings.SectionName)); // Database services.AddDbContext(options => options.UseNpgsql(configuration.GetConnectionString("DefaultConnection"))); // Repositories services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(typeof(IRepository<>), typeof(BaseRepository<>)); // HTTP Clients services.AddHttpClient(); services.AddHttpClient(); // Services services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); return services; } }