parameters:
    overblog_graphql_types.config: []

services:
    overblog_graphql.executor.default:
        class: Overblog\GraphQLBundle\Executor\Executor
        public: false

    overblog_graphql.request_executor:
        class: Overblog\GraphQLBundle\Request\Executor
        public: true
        arguments:
            - "@overblog_graphql.executor"
            - "@event_dispatcher"
            - "@overblog_graphql.promise_adapter"
            - "%overblog_graphql.default_resolver%"
        calls:
            - ["setMaxQueryComplexity", ["%overblog_graphql.query_max_complexity%"]]
            - ["setMaxQueryDepth", ["%overblog_graphql.query_max_depth%"]]

    Overblog\GraphQLBundle\Request\Executor:
        alias: overblog_graphql.request_executor

    overblog_graphql.request_parser:
        class: Overblog\GraphQLBundle\Request\Parser
        public: true

    overblog_graphql.request_batch_parser:
        class: Overblog\GraphQLBundle\Request\BatchParser

    overblog_graphql.schema_builder:
        class: Overblog\GraphQLBundle\Definition\Builder\SchemaBuilder
        public: false
        arguments:
            - "@overblog_graphql.type_resolver"
            - false

    overblog_graphql.type_factory:
        class: Overblog\GraphQLBundle\Definition\Builder\TypeFactory
        public: false
        arguments:
            - '@Overblog\GraphQLBundle\Definition\ConfigProcessor'
            - '@Overblog\GraphQLBundle\Definition\GlobalVariables'

    overblog_graphql.type_resolver:
        class: Overblog\GraphQLBundle\Resolver\TypeResolver
        public: true
        tags:
            - { name: overblog_graphql.global_variable, alias: typeResolver }

    Overblog\GraphQLBundle\Resolver\TypeResolver:
        alias: overblog_graphql.type_resolver

    overblog_graphql.resolver_resolver:
        class: Overblog\GraphQLBundle\Resolver\ResolverResolver
        public: true
        tags:
            - { name: overblog_graphql.global_variable, alias: resolverResolver, public: false }

    Overblog\GraphQLBundle\Resolver\ResolverResolver:
        alias: overblog_graphql.resolver_resolver

    overblog_graphql.mutation_resolver:
        class: Overblog\GraphQLBundle\Resolver\MutationResolver
        public: true
        tags:
            - { name: overblog_graphql.global_variable, alias: mutationResolver, public: false }

    Overblog\GraphQLBundle\Resolver\MutationResolver:
        alias: overblog_graphql.mutation_resolver

    overblog_graphql.access_resolver:
        class: Overblog\GraphQLBundle\Resolver\AccessResolver
        public: true
        arguments:
            - "@overblog_graphql.promise_adapter"

    Overblog\GraphQLBundle\Resolver\AccessResolver:
        alias: overblog_graphql.access_resolver

    overblog_graphql.expression_language.default:
        class: Overblog\GraphQLBundle\ExpressionLanguage\ExpressionLanguage
        public: false
        arguments:
            - '@?overblog_graphql.cache_expression_language_parser'

    overblog_graphql.cache_compiler:
        class: Overblog\GraphQLBundle\Generator\TypeGenerator
        public: true
        arguments:
            - "%overblog_graphql.class_namespace%"
            - ["%overblog_graphql.resources_dir%/skeleton"]
            - "%overblog_graphql.cache_dir%"
            - "%overblog_graphql_types.config%"
            - "%overblog_graphql.use_classloader_listener%"
            - ~
            - "%kernel.cache_dir%"
            - "%overblog_graphql.cache_dir_permissions%"
        calls:
            - ['addUseStatement', ['Overblog\GraphQLBundle\Definition\ConfigProcessor']]
            - ['addUseStatement', ['Overblog\GraphQLBundle\Definition\LazyConfig']]
            - ['addUseStatement', ['Overblog\GraphQLBundle\Definition\GlobalVariables']]
            - ["addImplement", ["Overblog\\GraphQLBundle\\Definition\\Type\\GeneratedTypeInterface"]]

            - ["setExpressionLanguage", ["@overblog_graphql.expression_language"]]

    Overblog\GraphQLBundle\EventListener\RequestFilesListener:
        class: Overblog\GraphQLBundle\EventListener\RequestFilesListener
        public: true
        arguments:
            - "@request_stack"
        tags:
            - { name: kernel.event_listener, event: graphql.executor.context, method: onExecutorContextEvent }

    overblog_graphql.promise_adapter.default:
        class: GraphQL\Executor\Promise\Adapter\SyncPromiseAdapter
        public: false

    overblog_graphql.react.promise_adapter:
        class: Overblog\GraphQLBundle\Executor\Promise\Adapter\ReactPromiseAdapter
        public: false

    overblog_graphql.controller.graphql:
        class: Overblog\GraphQLBundle\Controller\GraphController
        public: true
        arguments:
            - "@overblog_graphql.request_batch_parser"
            - "@overblog_graphql.request_executor"
            - "@overblog_graphql.request_parser"
            - "%overblog_graphql.handle_cors%"
            - "%overblog_graphql.batching_method%"

    Overblog\GraphQLBundle\Controller\GraphController:
        public: true
        alias: 'overblog_graphql.controller.graphql'

    overblog_graphql.command.dump_schema:
        class: Overblog\GraphQLBundle\Command\GraphQLDumpSchemaCommand
        public: true
        arguments:
            - "%kernel.cache_dir%/../.."
        calls:
            # "overblog_graphql.request_executor" service must be load lazy since that command service
            # is instanced before ClassLoaderEvent. This issues is fix in Symfony 3.4 introducing lazy commands
            # see https://symfony.com/blog/new-in-symfony-3-4-lazy-commands
            - ['setRequestExecutorFactory', [[['@service_container', 'get'], ['overblog_graphql.request_executor']]]]
        tags:
            - { name: console.command }

    overblog_graphql.command.debug:
        class: Overblog\GraphQLBundle\Command\DebugCommand
        public: true
        arguments:
            - "@overblog_graphql.type_resolver"
            - "@overblog_graphql.mutation_resolver"
            - "@overblog_graphql.resolver_resolver"
        tags:
            - { name: console.command }

    overblog_graphql.command.compile:
        class: Overblog\GraphQLBundle\Command\CompileCommand
        public: true
        arguments:
            - "@overblog_graphql.cache_compiler"
        tags:
            - { name: console.command }

    Overblog\GraphQLBundle\Definition\ConfigProcessor:
        class: Overblog\GraphQLBundle\Definition\ConfigProcessor
        public: false

    Overblog\GraphQLBundle\Definition\GlobalVariables:
        class: Overblog\GraphQLBundle\Definition\GlobalVariables
        public: false
        arguments:
            - []
