using Microsoft.Extensions.DependencyInjection;
namespace ScadaLink.DeploymentManager;
public static class ServiceCollectionExtensions
{
///
/// Configuration section that is bound to.
/// The Host binds this section to appsettings.json (see
/// Program.cs); component libraries do not depend on
/// IConfiguration directly, consistent with the Options-pattern
/// convention enforced by OptionsTests.
///
public const string OptionsSection = "ScadaLink:DeploymentManager";
///
/// Registers the Deployment Manager services.
/// is registered via so
/// IOptions<DeploymentManagerOptions> is always resolvable; the Host
/// binds to configuration so the operation-lock and
/// artifact-deployment timeouts are tunable via appsettings.json.
///
public static IServiceCollection AddDeploymentManager(this IServiceCollection services)
{
// DeploymentManager-008: ensure the options class is always resolvable.
// The Host binds OptionsSection to appsettings.json; absent that binding
// the declared option-class defaults apply.
services.AddOptions();
services.AddSingleton();
// CentralUI-006: push-based deployment-status notification. Registered
// as a singleton so the scoped DeploymentService and the Central UI's
// scoped Blazor page component share one instance — both run in the
// same central Host process. The deployment-status page subscribes to
// it instead of polling the database every 10 seconds.
services.AddSingleton();
services.AddScoped();
services.AddScoped();
services.AddScoped();
return services;
}
public static IServiceCollection AddDeploymentManagerActors(this IServiceCollection services)
{
// Akka actor registration is handled by Host component during actor system startup
return services;
}
}