<?php

namespace KupShop\GraphQLBundle\DependencyInjection;

use KupShop\GraphQLBundle\GraphiQL\EndpointResolver;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

class GraphiQLEndpointWiringPass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container): void
    {
        $endPointDefinition = new Definition(EndpointResolver::class);
        $endPointDefinition->addArgument(new Reference('request_stack'));

        $container->setDefinition('overblog_graphiql.controller.graphql.endpoint', $endPointDefinition);
    }
}
