<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <services>
        <service id="api_platform.graphql.executor" class="ApiPlatform\GraphQl\Executor" public="false">
            <argument>%api_platform.graphql.introspection.enabled%</argument>
        </service>

        <!-- Resolvers -->

        <service id="api_platform.graphql.query_resolver_locator" class="Symfony\Component\DependencyInjection\ServiceLocator">
            <tag name="container.service_locator" />
        </service>

        <service id="api_platform.graphql.mutation_resolver_locator" class="Symfony\Component\DependencyInjection\ServiceLocator">
            <tag name="container.service_locator" />
        </service>

        <service id="api_platform.graphql.resolver_locator" class="Symfony\Component\DependencyInjection\ServiceLocator">
            <tag name="container.service_locator" />
        </service>
        <!-- Type -->

        <service id="api_platform.graphql.iterable_type" class="ApiPlatform\GraphQl\Type\Definition\IterableType">
            <tag name="api_platform.graphql.type" />
        </service>

        <service id="api_platform.graphql.upload_type" class="ApiPlatform\GraphQl\Type\Definition\UploadType">
            <tag name="api_platform.graphql.type" />
        </service>

        <service id="api_platform.graphql.type_locator" class="Symfony\Component\DependencyInjection\ServiceLocator">
            <tag name="container.service_locator" />
        </service>

        <service id="api_platform.graphql.types_container" class="ApiPlatform\GraphQl\Type\TypesContainer" />

        <service id="api_platform.graphql.types_factory" class="ApiPlatform\GraphQl\Type\TypesFactory">
            <argument type="service" id="api_platform.graphql.type_locator" />
        </service>

        <service id="api_platform.graphql.fields_builder_locator" class="Symfony\Component\DependencyInjection\ServiceLocator" public="false">
            <argument type="collection">
                <argument type="service" id="api_platform.graphql.fields_builder" />
            </argument>
            <tag name="container.service_locator"/>
        </service>

        <!-- Action -->

        <service id="api_platform.graphql.action.entrypoint" class="ApiPlatform\GraphQl\Action\EntrypointAction" public="true">
            <argument type="service" id="api_platform.graphql.schema_builder" />
            <argument type="service" id="api_platform.graphql.executor" />
            <argument type="service" id="api_platform.graphql.action.graphiql" on-invalid="null"/>
            <argument type="service" id="api_platform.graphql.action.graphql_playground" on-invalid="null"/>
            <argument type="service" id="serializer" />
            <argument type="service" id="api_platform.graphql.error_handler" />
            <argument>%kernel.debug%</argument>
            <argument>%api_platform.graphql.graphiql.enabled%</argument>
            <argument>%api_platform.graphql.graphql_playground.enabled%</argument>
            <argument>%api_platform.graphql.default_ide%</argument>
        </service>

        <service id="api_platform.graphql.action.graphiql" class="ApiPlatform\GraphQl\Action\GraphiQlAction" public="true">
            <argument type="service" id="twig" />
            <argument type="service" id="api_platform.router" />
            <argument>%api_platform.graphql.graphiql.enabled%</argument>
            <argument>%api_platform.title%</argument>
            <argument>%api_platform.asset_package%</argument>
        </service>

        <service id="api_platform.graphql.action.graphql_playground" class="ApiPlatform\GraphQl\Action\GraphQlPlaygroundAction" public="true">
            <argument type="service" id="twig" />
            <argument type="service" id="api_platform.router" />
            <argument>%api_platform.graphql.graphql_playground.enabled%</argument>
            <argument>%api_platform.title%</argument>
            <argument>%api_platform.asset_package%</argument>
        </service>

        <!-- Error -->

        <service id="api_platform.graphql.error_handler" class="ApiPlatform\GraphQl\Error\ErrorHandler" public="false" />

        <service id="api_platform.graphql.subscription.subscription_identifier_generator" class="ApiPlatform\GraphQl\Subscription\SubscriptionIdentifierGenerator" />

        <service id="api_platform.graphql.cache.subscription" parent="cache.system" public="false">
            <tag name="cache.pool" />
        </service>

        <!-- Command -->

        <service id="api_platform.graphql.command.export_command" class="ApiPlatform\Symfony\Bundle\Command\GraphQlExportCommand">
            <argument type="service" id="api_platform.graphql.schema_builder" />
            <tag name="console.command" />
        </service>

        <service id="api_platform.graphql.type_converter" class="ApiPlatform\GraphQl\Type\TypeConverter">
            <argument type="service" id="api_platform.graphql.type_builder" />
            <argument type="service" id="api_platform.graphql.types_container" />
            <argument type="service" id="api_platform.metadata.resource.metadata_collection_factory" />
            <argument type="service" id="api_platform.metadata.property.metadata_factory" />
        </service>

        <service id="api_platform.graphql.type_builder" class="ApiPlatform\GraphQl\Type\TypeBuilder" public="false">
            <argument type="service" id="api_platform.graphql.types_container" />
            <argument type="service" id="api_platform.graphql.resolver.resource_field" />
            <argument type="service" id="api_platform.graphql.fields_builder_locator" />
            <argument type="service" id="api_platform.pagination" />
        </service>

        <service id="api_platform.graphql.fields_builder" class="ApiPlatform\GraphQl\Type\FieldsBuilder" public="false">
            <argument type="service" id="api_platform.metadata.property.name_collection_factory" />
            <argument type="service" id="api_platform.metadata.property.metadata_factory" />
            <argument type="service" id="api_platform.metadata.resource.metadata_collection_factory" />
            <argument type="service" id="api_platform.resource_class_resolver" />
            <argument type="service" id="api_platform.graphql.types_container" />
            <argument type="service" id="api_platform.graphql.type_builder" />
            <argument type="service" id="api_platform.graphql.type_converter" />
            <argument type="service" id="api_platform.graphql.resolver.factory" />
            <argument type="service" id="api_platform.filter_locator" />
            <argument type="service" id="api_platform.pagination" />
            <argument type="service" id="api_platform.name_converter" on-invalid="ignore" />
            <argument>%api_platform.graphql.nesting_separator%</argument>
            <argument type="service" id="api_platform.inflector" on-invalid="null" />
        </service>

        <service id="api_platform.graphql.schema_builder" class="ApiPlatform\GraphQl\Type\SchemaBuilder" public="false">
            <argument type="service" id="api_platform.metadata.resource.name_collection_factory" />
            <argument type="service" id="api_platform.metadata.resource.metadata_collection_factory" />
            <argument type="service" id="api_platform.graphql.types_factory" />
            <argument type="service" id="api_platform.graphql.types_container" />
            <argument type="service" id="api_platform.graphql.fields_builder" />
        </service>

        <service id="api_platform.graphql.serializer.context_builder" class="ApiPlatform\GraphQl\Serializer\SerializerContextBuilder" public="false">
            <argument type="service" id="api_platform.name_converter" on-invalid="ignore" />
        </service>
        <service id="ApiPlatform\GraphQl\Serializer\SerializerContextBuilderInterface" alias="api_platform.graphql.serializer.context_builder" />

        <service id="api_platform.graphql.state_provider" alias="api_platform.state_provider.locator" />
        <service id="api_platform.graphql.state_processor" alias="api_platform.graphql.state_processor.normalize" />

        <service id="api_platform.graphql.state_provider.read" class="ApiPlatform\GraphQl\State\Provider\ReadProvider" decorates="api_platform.graphql.state_provider" decoration-priority="500">
            <argument type="service" id="api_platform.graphql.state_provider.read.inner" />
            <argument type="service" id="api_platform.symfony.iri_converter" />
            <argument type="service" id="api_platform.graphql.serializer.context_builder" on-invalid="ignore" />
            <argument>%api_platform.graphql.nesting_separator%</argument>
        </service>

        <service id="api_platform.graphql.state_provider.parameter" class="ApiPlatform\State\Provider\ParameterProvider" decorates="api_platform.graphql.state_provider" decoration-priority="300">
            <argument type="service" id="api_platform.graphql.state_provider.parameter.inner" />
            <argument type="tagged_locator" tag="api_platform.parameter_provider" index-by="key" />
        </service>

        <!-- Validation occurs at 200, we want validation to be over when we reach custom resolvers -->
        <service id="api_platform.graphql.state_provider.resolver" class="ApiPlatform\GraphQl\State\Provider\ResolverProvider" decorates="api_platform.graphql.state_provider" decoration-priority="190">
            <argument type="service" id="api_platform.graphql.state_provider.resolver.inner" />
            <argument type="service" id="api_platform.graphql.resolver_locator" />
        </service>

        <service id="api_platform.graphql.state_provider.denormalizer" class="ApiPlatform\GraphQl\State\Provider\DenormalizeProvider" decorates="api_platform.graphql.state_provider" decoration-priority="300">
            <argument type="service" id="api_platform.graphql.state_provider.denormalizer.inner" />
            <argument type="service" id="serializer" />
            <argument type="service" id="api_platform.graphql.serializer.context_builder" />
        </service>

        <service id="api_platform.graphql.state_processor.subscription" class="ApiPlatform\GraphQl\State\Processor\SubscriptionProcessor" decorates="api_platform.graphql.state_processor" decoration-priority="200">
            <argument type="service" id="api_platform.graphql.state_processor.subscription.inner" />
            <argument type="service" id="api_platform.graphql.subscription.subscription_manager" />
            <argument type="service" id="api_platform.graphql.subscription.mercure_iri_generator" on-invalid="ignore" />
        </service>

        <service id="api_platform.graphql.state_processor.write" class="ApiPlatform\State\Processor\WriteProcessor" decorates="api_platform.graphql.state_processor" decoration-priority="100">
            <argument type="service" id="api_platform.graphql.state_processor.write.inner" />
            <argument type="service" id="api_platform.state_processor.locator" />
        </service>

        <service id="api_platform.graphql.state_processor.normalize" class="ApiPlatform\GraphQl\State\Processor\NormalizeProcessor">
            <argument type="service" id="serializer" />
            <argument type="service" id="api_platform.graphql.serializer.context_builder" />
            <argument type="service" id="api_platform.pagination" />
        </service>

        <service id="api_platform.graphql.resolver.factory" class="ApiPlatform\GraphQl\Resolver\Factory\ResolverFactory" public="false">
            <argument type="service" id="api_platform.graphql.state_provider" />
            <argument type="service" id="api_platform.graphql.state_processor" />
        </service>

        <!-- Resolver Stages -->
        <service id="api_platform.graphql.resolver.resource_field" class="ApiPlatform\GraphQl\Resolver\ResourceFieldResolver" public="false">
            <argument type="service" id="api_platform.symfony.iri_converter" />
        </service>

        <service id="api_platform.graphql.normalizer.item" class="ApiPlatform\GraphQl\Serializer\ItemNormalizer" public="false">
            <argument type="service" id="api_platform.metadata.property.name_collection_factory" />
            <argument type="service" id="api_platform.metadata.property.metadata_factory" />
            <argument type="service" id="api_platform.symfony.iri_converter" />
            <argument type="service" id="api_platform.api.identifiers_extractor" />
            <argument type="service" id="api_platform.resource_class_resolver" />
            <argument type="service" id="api_platform.property_accessor" />
            <argument type="service" id="api_platform.name_converter" on-invalid="ignore" />
            <argument type="service" id="serializer.mapping.class_metadata_factory" on-invalid="ignore" />
            <argument>null</argument>
            <argument type="service" id="api_platform.metadata.resource.metadata_collection_factory" on-invalid="ignore" />
            <argument type="service" id="api_platform.security.resource_access_checker" on-invalid="ignore" />

            <!-- Run before serializer.normalizer.json_serializable and before serializer.normalizer.backed_enum which is at 880 -->
            <tag name="serializer.normalizer" priority="-890" />
        </service>

        <service id="api_platform.graphql.normalizer.object" class="ApiPlatform\GraphQl\Serializer\ObjectNormalizer" public="false">
            <argument type="service" id="serializer.normalizer.object" />
            <argument type="service" id="api_platform.symfony.iri_converter" />
            <argument type="service" id="api_platform.api.identifiers_extractor" />

            <!-- Run after serializer.denormalizer.array but before serializer.normalizer.object -->
            <tag name="serializer.normalizer" priority="-995" />
        </service>

        <!-- Subscription -->

        <service id="api_platform.graphql.subscription.subscription_manager" class="ApiPlatform\GraphQl\Subscription\SubscriptionManager">
            <argument type="service" id="api_platform.graphql.cache.subscription" />
            <argument type="service" id="api_platform.graphql.subscription.subscription_identifier_generator" />
            <argument type="service" id="api_platform.graphql.state_processor.normalize" on-invalid="ignore" />
            <argument type="service" id="api_platform.symfony.iri_converter" />
            <argument type="service" id="api_platform.metadata.resource.metadata_collection_factory" />
        </service>

        <!-- Serializer -->

        <service id="api_platform.graphql.normalizer.error" class="ApiPlatform\GraphQl\Serializer\Exception\ErrorNormalizer">
            <tag name="serializer.normalizer" priority="-790" />
        </service>

        <service id="api_platform.graphql.normalizer.validation_exception" class="ApiPlatform\GraphQl\Serializer\Exception\ValidationExceptionNormalizer">
            <argument>%api_platform.exception_to_status%</argument>

            <tag name="serializer.normalizer" priority="-780" />
        </service>

        <service id="api_platform.graphql.normalizer.http_exception" class="ApiPlatform\GraphQl\Serializer\Exception\HttpExceptionNormalizer">
            <tag name="serializer.normalizer" priority="-780" />
        </service>

        <service id="api_platform.graphql.normalizer.runtime_exception" class="ApiPlatform\GraphQl\Serializer\Exception\RuntimeExceptionNormalizer">
            <tag name="serializer.normalizer" priority="-780" />
        </service>
    </services>
</container>
