using Microsoft.Extensions.DependencyInjection;

namespace ScadaLink.InboundAPI;

public static class ServiceCollectionExtensions
{
    public static IServiceCollection AddInboundAPI(this IServiceCollection services)
    {
        services.AddScoped<ApiKeyValidator>();
        services.AddSingleton<InboundScriptExecutor>();
        services.AddScoped<RouteHelper>();

        // InboundAPI-006 / InboundAPI-008: endpoint filter enforcing the request
        // body size cap and active-node gating for POST /api/{methodName}.
        services.AddSingleton<InboundApiEndpointFilter>();

        return services;
    }
}
