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

namespace StellaOps.Feedser.Source.Vndr.Apple;

public sealed class VndrAppleConnectorPlugin : IConnectorPlugin
{
    public const string SourceName = "vndr-apple";

    public string Name => SourceName;

    public bool IsAvailable(IServiceProvider services)
    {
        ArgumentNullException.ThrowIfNull(services);
        return services.GetService<AppleConnector>() is not null;
    }

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