using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Http;
using Microsoft.Extensions.Options;
namespace Cleanuparr.Infrastructure.Http.DynamicHttpClientSystem;
///
/// Service collection extensions for the dynamic HTTP client system
///
public static class DynamicHttpClientServiceCollectionExtensions
{
///
/// Adds the dynamic HTTP client system to the service collection
/// This replaces the traditional AddHttpClients method
///
public static IServiceCollection AddDynamicHttpClients(this IServiceCollection services)
{
// Register the dynamic system components
services.AddSingleton();
services.AddSingleton, DynamicHttpClientConfiguration>();
services.AddSingleton();
// Register the cache invalidation service
services.AddSingleton();
// Add base HttpClient factory
services.AddHttpClient();
// Pre-register standard configurations using a hosted service
services.AddHostedService();
return services;
}
}