using Managing.Infrastructure.Evm.Abstractions;
using Managing.Infrastructure.Evm.Services;
using Microsoft.Extensions.DependencyInjection;
using static Managing.Common.Enums;

namespace Managing.Infrastructure.Evm.Subgraphs;

public static class SubgraphExtensions
{
    public static void AddUniswapV2(this IServiceCollection services)
    {
        services.AddSingleton<IUniswap>(ctx =>
        {
            return new Uniswap(SubgraphService.GetSubgraphClient(SubgraphProvider.UniswapV2));
        });
    }

    public static void AddChainlink(this IServiceCollection services)
    {
        services.AddSingleton<ISubgraphPrices>(ctx =>
        {
            return new Chainlink(SubgraphService.GetSubgraphClient(SubgraphProvider.ChainlinkPrice));
        });
    }

    public static void AddGbcFeed(this IServiceCollection services)
    {
        services.AddSingleton<ISubgraphPrices>(ctx =>
        {
            return new Gbc(SubgraphService.GetSubgraphClient(SubgraphProvider.Gbc));
        });
    }

    public static void AddChainlinkGmx(this IServiceCollection services)
    {
        services.AddSingleton<ISubgraphPrices>(ctx =>
        {
            return new ChainlinkGmx(SubgraphService.GetSubgraphClient(SubgraphProvider.ChainlinkGmx));
        });
    }
}
