using System;
using Microsoft.Extensions.DependencyInjection;
using StellaOps.Plugin;

namespace StellaOps.Feedser.Source.Vndr.Chromium;

public sealed class VndrChromiumConnectorPlugin : IConnectorPlugin
{
    public const string SourceName = "vndr-chromium";

    public string Name => SourceName;

    public bool IsAvailable(IServiceProvider services) => services.GetService<ChromiumConnector>() is not null;

    public IFeedConnector Create(IServiceProvider services)
    {
        ArgumentNullException.ThrowIfNull(services);
        return services.GetRequiredService<ChromiumConnector>();
    }
}
