using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.Extensions.DependencyInjection;
using ScadaLink.CentralUI.Auth;

namespace ScadaLink.CentralUI;

public static class ServiceCollectionExtensions
{
    public static IServiceCollection AddCentralUI(this IServiceCollection services)
    {
        services.AddRazorComponents()
            .AddInteractiveServerComponents();

        services.AddHttpContextAccessor();

        services.AddScoped<AuthenticationStateProvider, CookieAuthenticationStateProvider>();
        services.AddCascadingAuthenticationState();

        return services;
    }
}
