parameters:
    nelmio_api_doc.twig.extension.extra_markdown.class: Oro\Bundle\ApiBundle\Twig\MarkdownExtension

    # The names of API views.
    # They are set by Oro\Bundle\ApiBundle\DependencyInjection\OroApiExtension
    oro_api.api_doc.views: []

    # The name of default API view.
    # It is set by Oro\Bundle\ApiBundle\DependencyInjection\OroApiExtension
    oro_api.api_doc.default_view: ~

    # The default page size. It is used when the page size is not specified in a request explicitly.
    # It is set by Oro\Bundle\ApiBundle\DependencyInjection\OroApiExtension
    oro_api.default_page_size: ~

    # The maximum number of primary entities that can be retrieved by a request.
    # It is set by Oro\Bundle\ApiBundle\DependencyInjection\OroApiExtension
    oro_api.max_entities: ~

    # The maximum number of related entities that can be retrieved by a request.
    # It is set by Oro\Bundle\ApiBundle\DependencyInjection\OroApiExtension
    oro_api.max_related_entities: ~

    # The maximum number of entities that can be deleted by one request.
    # It is set by Oro\Bundle\ApiBundle\DependencyInjection\OroApiExtension
    oro_api.max_delete_entities: ~

services:
    oro_api.action_processor_bag:
        class: Oro\Bundle\ApiBundle\Processor\ActionProcessorBag

    oro_api.processor_bag:
        class: Oro\Bundle\ApiBundle\Processor\OptimizedProcessorBag
        arguments:
            - '@oro_api.processor_bag_config_provider'
            - '@oro_api.processor_registry'
            - '%kernel.debug%'
            - '@oro_api.processor_applicable_checker_factory'
            - '@oro_api.processor_iterator_factory'
            - '@oro_api.processor_iterator_factory.ungrouped'

    oro_api.processor_bag_config_provider:
        class: Oro\Component\ChainProcessor\LazyProcessorBagConfigProvider
        arguments:
            - [] # actions. They are set by Oro\Bundle\ApiBundle\DependencyInjection\Compiler\ProcessorBagCompilerPass
            - [] # providers. They are set by Oro\Bundle\ApiBundle\DependencyInjection\Compiler\ProcessorBagCompilerPass

    oro_api.processor_iterator_factory:
        class: Oro\Bundle\ApiBundle\Processor\OptimizedProcessorIteratorFactory

    oro_api.processor_iterator_factory.ungrouped:
        class: Oro\Component\ChainProcessor\ProcessorIteratorFactory
        calls:
            - [setActionsWithApplicableCache, [['customize_loaded_data.identifier_only', 'customize_loaded_data.item', 'customize_loaded_data.collection']]]

    oro_api.processor_applicable_checker_factory:
        class: Oro\Bundle\ApiBundle\Processor\ProcessorApplicableCheckerFactory

    oro_api.processor_registry:
        class: Oro\Component\ChainProcessor\DependencyInjection\ProcessorRegistry
        arguments:
            - ~ # service locator. It is set by Oro\Component\ChainProcessor\DependencyInjection\CleanUpProcessorsCompilerPass

    oro_api.simple_processor_registry:
        class: Oro\Component\ChainProcessor\SimpleProcessorRegistry
        decorates: oro_api.processor_registry
        arguments:
            - [] # processors. They are set by Oro\Component\ChainProcessor\DependencyInjection\CleanUpProcessorsCompilerPass
            - '@.inner'

    oro_api.criteria_connector:
        class: Oro\Bundle\ApiBundle\Util\CriteriaConnector
        arguments:
            - '@oro_api.criteria_normalizer'
            - '@oro_api.criteria_placeholders_resolver'
            - '@oro_api.query.expression_visitor_factory'
            - '@oro_entity.orm.entity_class_resolver'

    oro_api.criteria_normalizer:
        class: Oro\Bundle\ApiBundle\Util\CriteriaNormalizer
        arguments:
            - '@oro_api.doctrine_helper'
            - '@oro_api.query.require_joins_field_visitor_factory'
            - '@oro_api.query.optimize_joins_field_visitor_factory'

    oro_api.criteria_placeholders_resolver:
        class: Oro\Bundle\ApiBundle\Util\CriteriaPlaceholdersResolver

    oro_api.query.require_joins_field_visitor_factory:
        class: Oro\Bundle\ApiBundle\Util\RequireJoinsFieldVisitorFactory
        arguments:
            - '@oro_api.query.require_joins_decision_maker'

    oro_api.query.require_joins_decision_maker:
        class: Oro\Bundle\ApiBundle\Util\RequireJoinsDecisionMaker

    oro_api.query.optimize_joins_field_visitor_factory:
        class: Oro\Bundle\ApiBundle\Util\OptimizeJoinsFieldVisitorFactory
        arguments:
            - '@oro_api.query.optimize_joins_decision_maker'

    oro_api.query.optimize_joins_decision_maker:
        class: Oro\Bundle\ApiBundle\Util\OptimizeJoinsDecisionMaker

    oro_api.doctrine_helper:
        class: Oro\Bundle\ApiBundle\Util\DoctrineHelper
        arguments:
            - '@doctrine'

    oro_api.validation_helper:
        class: Oro\Bundle\ApiBundle\Util\ValidationHelper
        arguments:
            - '@validator.mapping.class_metadata_factory'

    oro_api.entity_instantiator:
        class: Oro\Bundle\ApiBundle\Util\EntityInstantiator
        arguments:
            - '@oro_api.doctrine_helper'

    oro_api.entity_loader:
        class: Oro\Bundle\ApiBundle\Util\EntityLoader
        arguments:
            - '@oro_api.doctrine_helper'

    oro_api.acl_protected_entity_loader:
        class: Oro\Bundle\ApiBundle\Util\AclProtectedEntityLoader
        arguments:
            - '@oro_api.doctrine_helper'
            - '@oro_api.entity_id_helper'
            - '@oro_api.query_acl_helper'

    oro_api.entity_accessor:
        class: Oro\Bundle\ApiBundle\Util\EntityDataAccessor

    oro_api.entity_id_helper:
        class: Oro\Bundle\ApiBundle\Util\EntityIdHelper

    oro_api.upsert_criteria_builder:
        class: Oro\Bundle\ApiBundle\Util\UpsertCriteriaBuilder
        arguments:
            - '@oro_api.value_normalizer'

    oro_api.entity_metadata_factory:
        class: Oro\Bundle\ApiBundle\Metadata\EntityMetadataFactory
        arguments:
            - '@oro_api.doctrine_helper'

    oro_api.entity_field_filtering_helper:
        class: Oro\Bundle\ApiBundle\Util\EntityFieldFilteringHelper
        arguments:
            - '@oro_entity_config.config_manager'

    oro_api.save_data_handler:
        class: Oro\Bundle\ApiBundle\Processor\CustomizeFormData\FlushDataHandler
        arguments:
            - '@oro_api.customize_form_data_event_dispatcher'
            - '@oro_api.collect_form_errors'
            - '@oro_api.subresource.collect_form_errors'
            - '@logger'
        tags:
            - { name: monolog.logger, channel: api }

    oro_api.request_helper:
        class: Oro\Bundle\ApiBundle\Request\ApiRequestHelper
        arguments:
            - '%oro_api.rest.pattern%'

    oro_api.value_normalizer:
        class: Oro\Bundle\ApiBundle\Request\ValueNormalizer
        arguments:
            - '@oro_api.normalize_value.processor'

    oro_api.value_transformer:
        class: Oro\Bundle\ApiBundle\Request\ValueTransformer
        arguments:
            - '@oro_api.data_transformer_registry'
            - '@oro_api.entity_serializer.data_transformer'

    oro_api.request_data_accessor:
        class: Oro\Bundle\ApiBundle\Util\RequestDataAccessor

    oro_api.query_resolver:
        class: Oro\Bundle\ApiBundle\Util\AclProtectedQueryResolver
        arguments:
            - '@oro_entity.query_hint_resolver'
            - '@oro_security.acl_helper'

    oro_api.object_normalizer:
        class: Oro\Bundle\ApiBundle\Normalizer\ObjectNormalizer
        arguments:
            - '@oro_api.object_normalizer_registry'
            - '@oro_api.doctrine_helper'
            - '@oro_api.entity_serializer.serialization_helper'
            - '@oro_api.entity_accessor'
            - '@oro_api.object_normalizer.config_normalizer'
            - '@oro_api.object_normalizer.data_normalizer'
            - '@security.authorization_checker'
            - '@oro_api.association_access_exclusion_provider_registry'

    oro_api.object_normalizer.config_normalizer:
        class: Oro\Bundle\ApiBundle\Normalizer\ConfigNormalizer

    oro_api.object_normalizer.data_normalizer:
        class: Oro\Component\EntitySerializer\DataNormalizer

    oro_api.object_normalizer_registry:
        class: Oro\Bundle\ApiBundle\Normalizer\ObjectNormalizerRegistry
        arguments:
            - [] # normalizers
            - ~ # service locator
            - '@oro_api.request_expression_matcher'

    oro_api.datetime_normalizer:
        class: Oro\Bundle\ApiBundle\Normalizer\DateTimeNormalizer
        arguments:
            - '@oro_api.data_transformer_registry'
        tags:
            - { name: oro.api.object_normalizer, class: DateTimeInterface }

    oro_api.system.cache_warmer:
        class: Oro\Component\Config\Cache\ConfigCacheWarmer
        arguments:
            - '@oro_api.config_cache_warmer'
            - false
        tags:
            - { name: kernel.cache_warmer }

    oro_api.entity_alias.cache_warmer:
        class: Oro\Component\Config\Cache\ConfigCacheWarmer
        arguments:
            - '@oro_api.entity_alias_resolver_registry'
        tags:
            - { name: kernel.cache_warmer, priority: -10 }

    oro_api.resources.cache_warmer:
        class: Oro\Bundle\ApiBundle\Provider\ResourcesCacheWarmer
        arguments:
            - '@oro_api.resources_provider'
            - '@oro_api.subresources_provider'
            - [] # request types. They are set by Oro\Bundle\ApiBundle\DependencyInjection\Compiler\ResourcesCacheWarmerCompilerPass
        tags:
            - { name: kernel.cache_warmer, priority: -15 }

    # do not use this service directly, it is an extension point (via service decoration)
    # for the isResourceEnabled() method of the "oro_api.resources_provider" service
    oro_api.resource_checker.chain:
        class: Oro\Bundle\ApiBundle\Provider\ChainResourceChecker
        arguments:
            - '@oro_api.resource_checker_registry'

    oro_api.resource_checker_registry:
        class: Oro\Bundle\ApiBundle\Provider\ResourceCheckerRegistry
        arguments:
            - !abstract '$config defined in Oro\Bundle\ApiBundle\DependencyInjection\ConfigurationLoader'
            - !abstract '$container defined in Oro\Bundle\ApiBundle\DependencyInjection\ConfigurationLoader'
            - '@oro_api.request_expression_matcher'

    oro_api.resource_checker:
        class: Oro\Bundle\ApiBundle\Provider\ResourceChecker
        arguments:
            - '@oro_featuretoggle.checker.feature_checker'
            - '@oro_api.resource_checker_config_provider'
            - 'api_resources'

    oro_api.resource_checker_config_provider:
        class: Oro\Bundle\ApiBundle\Provider\ResourceCheckerConfigProvider
        arguments:
            - '%kernel.cache_dir%/oro/feature_api_resources.php'

    oro_api.resource_checker.default:
        abstract: true
        tags:
            -
                name: oro.api.resource_checker
                requestType: ~
                resourceType: api_resources
                resourceChecker: oro_api.resource_checker
                resourceCheckerConfigProvider: oro_api.resource_checker_config_provider
                priority: -10

    oro_api.resources_provider:
        class: Oro\Bundle\ApiBundle\Provider\ResourcesProvider
        arguments:
            - '@oro_api.collect_resources.processor'
            - '@oro_api.resources_cache'
            - '@oro_api.resources_without_identifier_loader'
            - '@oro_api.resource_checker.chain'

    oro_api.subresources_provider:
        class: Oro\Bundle\ApiBundle\Provider\SubresourcesProvider
        arguments:
            - '@oro_api.collect_subresources.processor'
            - '@oro_api.resources_provider'
            - '@oro_api.resources_cache'

    oro_api.resources_cache:
        class: Oro\Bundle\ApiBundle\Provider\ResourcesCache
        arguments:
            - '@oro_api.resources_cache_accessor'

    oro_api.resources_cache_accessor:
        class: Oro\Bundle\ApiBundle\Provider\ResourcesCacheAccessor
        arguments:
            - '@oro_api.resources_cache.impl'

    oro_api.resources_cache.impl:
        parent: oro.data.cache.without_memory_cache
        tags:
            - { name: 'cache.pool', namespace: 'oro_api_resources' }

    oro_api.resources_without_identifier_loader:
        class: Oro\Bundle\ApiBundle\Provider\ResourcesWithoutIdentifierLoader
        arguments:
            - '@oro_api.config_provider'

    oro_api.listener.api_source:
        class: Oro\Bundle\ApiBundle\EventListener\ApiSourceListener
        arguments:
            - '@oro_api.cache_manager'
            - !abstract '$excludedFeatures defined in Oro\Bundle\ApiBundle\DependencyInjection\Compiler\ApiDocCompilerPass'
        tags:
            - { name: kernel.event_listener, event: oro.entity_extend.entity.schema.update, method: clearCache }
            - { name: kernel.event_listener, event: oro_featuretoggle.features.change, method: onFeaturesChange }
            - { name: kernel.event_listener, event: oro.entity_config.post_flush, method: onEntityConfigPostFlush }

    oro_api.listener.api_source.open_api:
        class: Oro\Bundle\ApiBundle\EventListener\OpenApiSourceListener
        arguments:
            - '@doctrine'
            - '@oro_message_queue.client.message_producer'
            - !abstract '$excludedFeatures defined in Oro\Bundle\ApiBundle\DependencyInjection\Compiler\ApiDocCompilerPass'
        tags:
            - { name: kernel.event_listener, event: oro.entity_extend.entity.schema.update, method: renewOpenApiSpecifications }
            - { name: kernel.event_listener, event: oro_featuretoggle.features.change, method: onFeaturesChange }
            - { name: kernel.event_listener, event: oro.entity_config.post_flush, method: onEntityConfigPostFlush }

    oro_api.config_extension_registry:
        class: Oro\Bundle\ApiBundle\Config\Extension\ConfigExtensionRegistry
        arguments:
            - 0 # config_max_nesting_level. It is set by Oro\Bundle\ApiBundle\DependencyInjection\OroApiExtension

    oro_api.config_extension.filters:
        class: Oro\Bundle\ApiBundle\Config\Extension\FiltersConfigExtension
        arguments:
            - '@oro_api.filter_operator_registry'

    oro_api.config_extension.sorters:
        class: Oro\Bundle\ApiBundle\Config\Extension\SortersConfigExtension

    oro_api.config_extension.actions:
        class: Oro\Bundle\ApiBundle\Config\Extension\ActionsConfigExtension
        arguments:
            - '@oro_api.action_processor_bag'

    oro_api.config_extension.subresources:
        class: Oro\Bundle\ApiBundle\Config\Extension\SubresourcesConfigExtension
        arguments:
            - '@oro_api.action_processor_bag'
            - '@oro_api.filter_operator_registry'

    oro_api.config_extension.post_processor:
        class: Oro\Bundle\ApiBundle\Config\Extension\PostProcessorConfigExtension
        arguments:
            - '@oro_api.post_processor_registry'

    oro_api.config_extension.post_processor.twig:
        class: Oro\Bundle\ApiBundle\Config\Extension\TwigPostProcessorConfigExtension

    oro_api.config_extension.feature:
        class: Oro\Bundle\ApiBundle\Config\Extension\FeatureConfigurationExtension
        arguments:
            - '@oro_api.action_processor_bag'
            - '@oro_api.resource_checker_config_provider'
            - 'api_resources'
            - 'A list of entity FQCNs that are available as API resources.'
        tags:
            - { name: oro_feature.config_extension }

    oro_api.config_merger.entity:
        class: Oro\Bundle\ApiBundle\Config\EntityConfigMerger
        arguments:
            - '@oro_api.config_extension_registry'

    oro_api.config_cache_factory:
        class: Oro\Bundle\ApiBundle\Provider\ConfigCacheFactory
        arguments:
            - '%kernel.cache_dir%/oro/api'
            - '%kernel.debug%'
        calls:
            - [setConfigCacheWarmer, ['@oro_api.config_cache_warmer']]

    oro_api.config_cache_warmer:
        class: Oro\Bundle\ApiBundle\Provider\ConfigCacheWarmer
        arguments:
            - [] # config files. They are set by Oro\Bundle\ApiBundle\DependencyInjection\OroApiExtension
            - '@oro_api.config_extension_registry'
            - '@oro_api.config_cache_factory'
            - '%kernel.debug%'
            - '%kernel.environment%'

    oro_api.cache_manager:
        class: Oro\Bundle\ApiBundle\Provider\CacheManager
        arguments:
            - [] # config keys. They are set by Oro\Bundle\ApiBundle\DependencyInjection\OroApiExtension
            - [] # api doc views. They are set by Oro\Bundle\ApiBundle\DependencyInjection\OroApiExtension
            - '@oro_api.request_expression_matcher'
            - '@oro_api.config_cache_factory'
            - '@oro_api.config_cache_warmer'
            - '@oro_api.entity_alias_resolver_registry'
            - '@oro_api.resources.cache_warmer'
            - '@nelmio_api_doc.extractor.api_doc_extractor'
            - '@oro_api.config_provider'
        calls:
            - [addResettableService, ['@oro_api.rest.chain_routing_options_resolver']]
            - [addResettableService, ['@oro_api.resources_provider']]
            - [addResettableService, ['@oro_api.config_provider']]
            - [addResettableService, ['@oro_api.metadata_provider']]
            - [addResettableService, ['@oro_api.value_normalizer']]
            - [addResettableService, ['@oro_api.config_bag_registry']]
            - [addResettableService, ['@oro_api.api_doc.filters_sorter_registry']]

    oro_api.config_bag_registry:
        class: Oro\Bundle\ApiBundle\Provider\ConfigBagRegistry
        arguments:
            - !abstract '$configBags defined in Oro\Bundle\ApiBundle\DependencyInjection\ConfigurationLoader'
            - !abstract '$container defined in Oro\Bundle\ApiBundle\DependencyInjection\ConfigurationLoader'
            - '@oro_api.request_expression_matcher'

    oro_api.config_loader_factory:
        class: Oro\Bundle\ApiBundle\Config\Loader\ConfigLoaderFactory
        arguments:
            - '@oro_api.config_extension_registry'

    oro_api.config_provider:
        class: Oro\Bundle\ApiBundle\Provider\ConfigProvider
        arguments:
            - '@oro_api.get_config.processor'

    oro_api.metadata_provider:
        class: Oro\Bundle\ApiBundle\Provider\MetadataProvider
        arguments:
            - '@oro_api.get_metadata.processor'

    oro_api.entity_alias_resolver_registry:
        class: Oro\Bundle\ApiBundle\Provider\EntityAliasResolverRegistry
        arguments:
            - !abstract '$entityAliasResolvers defined in Oro\Bundle\ApiBundle\DependencyInjection\ConfigurationLoader'
            - !abstract '$container defined in Oro\Bundle\ApiBundle\DependencyInjection\ConfigurationLoader'
            - '@oro_api.request_expression_matcher'

    oro_api.entity_exclusion_provider_registry:
        class: Oro\Bundle\ApiBundle\Provider\ExclusionProviderRegistry
        arguments:
            - !abstract '$exclusionProviders defined in Oro\Bundle\ApiBundle\DependencyInjection\ConfigurationLoader'
            - !abstract '$container defined in Oro\Bundle\ApiBundle\DependencyInjection\ConfigurationLoader'
            - '@oro_api.request_expression_matcher'

    oro_api.entity_exclusion_provider.shared:
        class: Oro\Bundle\EntityBundle\Provider\ChainExclusionProvider
        arguments:
            - !tagged_iterator oro_entity.exclusion_provider.api
            - '@oro_entity.entity_hierarchy_provider.all'

    oro_api.entity_override_provider_registry:
        class: Oro\Bundle\ApiBundle\Provider\EntityOverrideProviderRegistry
        arguments:
            - !abstract '$entityOverrideProviders defined in Oro\Bundle\ApiBundle\DependencyInjection\ConfigurationLoader'
            - !abstract '$container defined in Oro\Bundle\ApiBundle\DependencyInjection\ConfigurationLoader'
            - '@oro_api.request_expression_matcher'

    oro_api.association_access_exclusion_provider_registry:
        class: Oro\Bundle\ApiBundle\Provider\AssociationAccessExclusionProviderRegistry
        arguments:
            - [] # providers
            - ~ # service locator
            - '@oro_api.request_expression_matcher'

    oro_api.query_acl_helper:
        class: Oro\Bundle\ApiBundle\Util\QueryAclHelper
        arguments:
            - '@oro_api.entity_serializer.query_factory'

    oro_api.entity_serializer.field_filter:
        class: Oro\Bundle\SecurityBundle\Filter\EntitySerializerFieldFilter
        arguments:
            - '@security.authorization_checker'
            - '@oro_entity_config.config_manager'
            - '@oro_api.entity_serializer.doctrine_helper'
            - false

    oro_api.entity_serializer:
        class: Oro\Bundle\ApiBundle\Util\AclProtectedEntitySerializer
        arguments:
            - '@oro_api.entity_serializer.doctrine_helper'
            - '@oro_api.entity_serializer.serialization_helper'
            - '@oro_api.entity_accessor'
            - '@oro_api.entity_serializer.query_factory'
            - '@oro_api.entity_serializer.field_accessor'
            - '@oro_api.entity_serializer.config_normalizer'
            - '@oro_api.entity_serializer.config_converter'
            - '@oro_api.entity_serializer.data_normalizer'
        calls:
            - [setFieldFilter, ['@oro_api.entity_serializer.field_filter']]

    oro_api.entity_serializer.doctrine_helper:
        class: Oro\Component\EntitySerializer\DoctrineHelper
        arguments:
            - '@doctrine'

    oro_api.entity_serializer.serialization_helper:
        class: Oro\Component\EntitySerializer\SerializationHelper
        arguments:
            - '@oro_api.entity_serializer.data_transformer'

    # do not use this service directly, use "oro_api.query_acl_helper" instead
    oro_api.entity_serializer.query_factory:
        class: Oro\Bundle\ApiBundle\Util\AclProtectedQueryFactory
        arguments:
            - '@oro_api.entity_serializer.doctrine_helper'
            - '@oro_api.query_resolver'
            - '@oro_api.entity_serializer.query_modifier_registry'

    oro_api.entity_serializer.query_modifier_registry:
        class: Oro\Bundle\ApiBundle\Util\QueryModifierRegistry
        arguments:
            - [] # query modifiers
            - ~ # service locator
            - '@oro_api.request_expression_matcher'

    oro_api.entity_serializer.field_accessor:
        class: Oro\Bundle\ApiBundle\Util\FieldAccessor
        arguments:
            - '@oro_api.entity_serializer.doctrine_helper'
            - '@oro_api.entity_accessor'
        calls:
            - [setMandatoryFieldProvider, ['@oro_api.entity_serializer.mandatory_field_provider_registry']]

    oro_api.entity_serializer.mandatory_field_provider_registry:
        class: Oro\Bundle\ApiBundle\Util\MandatoryFieldProviderRegistry
        arguments:
            - [] # providers
            - ~ # service locator
            - '@oro_api.request_expression_matcher'

    oro_api.entity_serializer.config_normalizer:
        class: Oro\Bundle\ApiBundle\Util\ConfigNormalizer

    oro_api.entity_serializer.config_converter:
        class: Oro\Bundle\ApiBundle\Util\ConfigConverter
        arguments:
            - '@oro_api.entity_override_provider_registry'

    oro_api.entity_serializer.data_normalizer:
        class: Oro\Component\EntitySerializer\DataNormalizer

    oro_api.entity_serializer.data_transformer:
        class: Oro\Component\EntitySerializer\DataTransformer
        arguments:
            - '@service_container'

    oro_api.rest.request_handler:
        class: Oro\Bundle\ApiBundle\Request\Rest\RequestHandler
        arguments:
            - '@oro_api.rest.request_action_handler'

    oro_api.rest.request_action_handler:
        class: Oro\Bundle\ApiBundle\Request\Rest\RequestActionHandler
        arguments:
            - ['rest']
            - '@oro_api.action_processor_bag'
            - '@oro_api.rest.filter_value_accessor_factory'
            - '@fos_rest.view_handler'

    oro_api.entity_id_transformer_registry:
        class: Oro\Bundle\ApiBundle\Request\EntityIdTransformerRegistry
        arguments:
            - [] # transformers
            - ~ # service locator
            - '@oro_api.request_expression_matcher'
            - '@oro_api.entity_id_resolver_registry'

    oro_api.entity_id_resolver_registry:
        class: Oro\Bundle\ApiBundle\Request\EntityIdResolverRegistry
        arguments:
            - !abstract '$resolvers defined in Oro\Bundle\ApiBundle\DependencyInjection\Compiler\EntityIdResolverCompilerPass'
            - !abstract '$container defined in Oro\Bundle\ApiBundle\DependencyInjection\Compiler\EntityIdResolverCompilerPass'
            - '@oro_api.request_expression_matcher'

    oro_api.rest.entity_id_transformer:
        class: Oro\Bundle\ApiBundle\Request\Rest\EntityIdTransformer
        arguments:
            - '@oro_api.value_normalizer'
        tags:
            - { name: oro.api.entity_id_transformer, requestType: rest }

    oro_api.exception_text_extractor:
        class: Oro\Bundle\ApiBundle\Request\ChainExceptionTextExtractor
        arguments:
            - !tagged_iterator oro.api.exception_text_extractor

    oro_api.exception_text_extractor.default:
        class: Oro\Bundle\ApiBundle\Request\ExceptionTextExtractor
        arguments:
            - '%kernel.debug%'
            - '@translator'
            -
                - '\InvalidArgumentException'
                - '\UnexpectedValueException'
                - '\OutOfBoundsException'
                - 'Oro\Bundle\EntityBundle\Exception\EntityAliasNotFoundException'
            -
                - 'Psr\Container\NotFoundExceptionInterface'
        tags:
            - { name: oro.api.exception_text_extractor, priority: -10 }

    oro_api.error_completer_registry:
        class: Oro\Bundle\ApiBundle\Request\ErrorCompleterRegistry
        arguments:
            - [] # error completers
            - ~ # service locator
            - '@oro_api.request_expression_matcher'

    oro_api.error_completer.default:
        class: Oro\Bundle\ApiBundle\Request\NullErrorCompleter
        tags:
            - { name: oro.api.error_completer, priority: -255 }

    oro_api.error_title_override_provider:
        class: Oro\Bundle\ApiBundle\Request\ErrorTitleOverrideProvider
        arguments:
            - [] # error title substitutions. They are set by Oro\Bundle\ApiBundle\DependencyInjection\OroApiExtension

    oro_api.document_builder_factory:
        class: Oro\Bundle\ApiBundle\Request\DocumentBuilderFactory
        arguments:
            - !abstract '$documentBuilders defined in Oro\Bundle\ApiBundle\DependencyInjection\Compiler\DocumentBuilderCompilerPass'
            - !abstract '$container defined in Oro\Bundle\ApiBundle\DependencyInjection\Compiler\DocumentBuilderCompilerPass'
            - '@oro_api.request_expression_matcher'

    oro_api.rest.document_builder:
        class: Oro\Bundle\ApiBundle\Request\Rest\RestDocumentBuilder
        shared: false
        arguments:
            - '@oro_api.value_normalizer'
            - '@oro_api.entity_id_transformer_registry'
            - '@logger'
        tags:
            - { name: oro.api.document_builder, requestType: rest&!json_api, priority: -10 }
            - { name: monolog.logger, channel: api }

    oro_api.rest.error_completer:
        class: Oro\Bundle\ApiBundle\Request\Rest\ErrorCompleter
        arguments:
            - '@oro_api.error_title_override_provider'
            - '@oro_api.exception_text_extractor'
        tags:
            - { name: oro.api.error_completer, requestType: rest&!json_api, priority: -10 }

    oro_api.json_api.document_builder:
        class: Oro\Bundle\ApiBundle\Request\JsonApi\JsonApiDocumentBuilder
        shared: false
        arguments:
            - '@oro_api.value_normalizer'
            - '@oro_api.entity_id_transformer_registry'
            - '@logger'
        tags:
            - { name: oro.api.document_builder, requestType: json_api }
            - { name: monolog.logger, channel: api }

    oro_api.json_api.error_completer:
        class: Oro\Bundle\ApiBundle\Request\JsonApi\ErrorCompleter
        arguments:
            - '@oro_api.error_title_override_provider'
            - '@oro_api.exception_text_extractor'
            - '@oro_api.value_normalizer'
            - '@oro_api.filter_names_registry'
        tags:
            - { name: oro.api.error_completer, requestType: json_api }

    oro_api.rest.cors_settings:
        class: Oro\Bundle\ApiBundle\Request\Rest\CorsSettings
        arguments:
            - 0 # preflightMaxAge. It is set by Oro\Bundle\ApiBundle\DependencyInjection\OroApiExtension
            - [] # allowedOrigins. They are set by Oro\Bundle\ApiBundle\DependencyInjection\OroApiExtension
            - false # isCredentialsAllowed. It is set by Oro\Bundle\ApiBundle\DependencyInjection\OroApiExtension
            - [] # allowedHeaders. They are set by Oro\Bundle\ApiBundle\DependencyInjection\OroApiExtension
            - [] # exposableHeaders. They are set by Oro\Bundle\ApiBundle\DependencyInjection\OroApiExtension

    oro_api.rest.routes_registry:
        class: Oro\Bundle\ApiBundle\Request\Rest\RestRoutesRegistry
        arguments:
            - [] # providers
            - ~ # service locator
            - '@oro_api.request_expression_matcher'

    oro_api.rest.routes:
        class: Oro\Bundle\ApiBundle\Request\Rest\RestRoutes
        arguments:
            - 'oro_rest_api_item'
            - 'oro_rest_api_list'
            - 'oro_rest_api_subresource'
            - 'oro_rest_api_relationship'
        tags:
            - { name: oro.api.rest_routes, requestType: rest, priority: -10 }

    oro_api.rest.action_mapper:
        class: Oro\Bundle\ApiBundle\ApiDoc\RestActionMapper
        arguments:
            - '@oro_api.rest.routes'

    oro_api.rest.body_listener_adapter:
        class: Oro\Bundle\ApiBundle\EventListener\FosRestBodyListenerAdapter
        decorates: 'fos_rest.body_listener'
        decoration_priority: 250
        arguments:
            - '@.inner'

    oro_api.rest.error_handling_body_listener:
        class: Oro\Bundle\ApiBundle\EventListener\ErrorHandlingBodyListenerDecorator
        decorates: 'fos_rest.body_listener'
        decoration_priority: -250
        arguments:
            - '@.inner'

    oro_api.rest.update_list_body_listener:
        class: Oro\Bundle\ApiBundle\EventListener\UpdateListBodyListenerDecorator
        decorates: 'fos_rest.body_listener'
        arguments:
            - '@.inner'
            - '@oro_api.rest.routes'

    oro_api.rest.unauthorized_api_request_listener:
        class: Oro\Bundle\ApiBundle\EventListener\UnauthorizedApiRequestListener
        arguments:
            - '@Psr\Container\ContainerInterface'
            - '@oro_api.request_helper'
        tags:
            - { name: kernel.event_listener, event: kernel.response, method: onKernelResponse, priority: -100 }
            - { name: container.service_subscriber, id: oro_api.rest.request_action_handler, key: Oro\Bundle\ApiBundle\Request\Rest\RequestActionHandler }

    oro_api.rest.unhandled_error_exception_listener:
        class: Oro\Bundle\ApiBundle\EventListener\UnhandledApiErrorExceptionListener
        arguments:
            - '@Psr\Container\ContainerInterface'
            - '@oro_api.request_helper'
        tags:
            - { name: kernel.event_listener, event: kernel.exception, priority: -10 }
            - { name: container.service_subscriber, id: oro_api.rest.request_action_handler, key: Oro\Bundle\ApiBundle\Request\Rest\RequestActionHandler }

    oro_api.rest.api_doc_annotation_handler:
        class: Oro\Bundle\ApiBundle\ApiDoc\AnnotationHandler\ChainApiDocAnnotationHandler
        arguments:
            - !tagged_iterator oro.api.api_doc_annotation_handler

    oro_api.rest.chain_routing_options_resolver:
        class: Oro\Bundle\ApiBundle\ApiDoc\RestChainRouteOptionsResolver
        arguments:
            - [] # resolvers. It is set by Oro\Bundle\ApiBundle\DependencyInjection\Compiler\ApiDocCompilerPass
            - '@oro_api.rest.doc_view_detector'
            - [] # underlying views. It is set by Oro\Bundle\ApiBundle\DependencyInjection\Compiler\ApiDocCompilerPass

    oro_api.rest.routing_options_resolver.prefix:
        class: Oro\Bundle\ApiBundle\ApiDoc\RestPrefixRouteOptionsResolver
        arguments:
            - '@service_container'
        tags:
            - { name: routing.options_resolver, priority: -255 }

    oro_api.rest.routing_options_resolver:
        class: Oro\Bundle\ApiBundle\ApiDoc\RestRouteOptionsResolver
        arguments:
            - 'rest_api'
            - '@oro_api.rest.routes'
            - '@oro_api.rest.action_mapper'
            - '@oro_api.rest.doc_view_detector'
            - '@oro_api.resources_provider'
            - '@oro_api.subresources_provider'
            - '@oro_api.value_normalizer'
        tags:
            - { name: oro.api.routing_options_resolver, view: rest_json_api }
            - { name: oro.api.routing_options_resolver, view: rest_plain }

    oro_api.rest.doc_handler:
        class: Oro\Bundle\ApiBundle\ApiDoc\AnnotationHandler\RestDocHandler
        arguments:
            - 'rest_api'
            - '@oro_api.rest.doc_view_detector'
            - '@oro_api.rest.doc_handler.context_provider'
            - '@oro_api.value_normalizer'
            - '@oro_api.rest.doc_handler.identifier'
            - '@oro_api.rest.doc_handler.filters'
            - '@oro_api.rest.doc_handler.status_codes'
        tags:
            - { name: nelmio_api_doc.extractor.handler }

    oro_api.rest.doc_handler.context_provider:
        class: Oro\Bundle\ApiBundle\ApiDoc\AnnotationHandler\RestDocContextProvider
        arguments:
            - '@oro_api.rest.doc_view_detector'
            - '@oro_api.action_processor_bag'

    oro_api.rest.doc_handler.identifier:
        class: Oro\Bundle\ApiBundle\ApiDoc\AnnotationHandler\RestDocIdentifierHandler
        arguments:
            - '@oro_api.rest.doc_view_detector'
            - '@oro_api.value_normalizer'
            - '@oro_api.api_doc.data_type_converter'

    oro_api.rest.doc_handler.filters:
        class: Oro\Bundle\ApiBundle\ApiDoc\AnnotationHandler\RestDocFiltersHandler
        arguments:
            - '@oro_api.rest.doc_view_detector'
            - '@oro_api.value_normalizer'
            - '@oro_api.api_doc.data_type_converter'
            - '@oro_api.api_doc.filters_sorter_registry'

    oro_api.rest.doc_handler.status_codes:
        class: Oro\Bundle\ApiBundle\ApiDoc\AnnotationHandler\RestDocStatusCodesHandler

    oro_api.rest.doc_url_generator:
        class: Oro\Bundle\ApiBundle\ApiDoc\RestDocUrlGenerator
        arguments:
            - '@router'
            - '%oro_api.api_doc.views%'
            - '%oro_api.api_doc.default_view%'

    oro_api.api_doc.data_type_converter:
        class: Oro\Bundle\ApiBundle\ApiDoc\ApiDocDataTypeConverter
        arguments:
            - !abstract '$defaultMapping defined in Oro\Bundle\ApiBundle\DependencyInjection\Compiler\ApiDocCompilerPass'
            - !abstract '$viewMappings defined in Oro\Bundle\ApiBundle\DependencyInjection\Compiler\ApiDocCompilerPass'

    oro_api.api_doc.filters_sorter_registry:
        class: Oro\Bundle\ApiBundle\ApiDoc\Sorter\FiltersSorterRegistry
        arguments:
            - [] # sorters
            - ~ # service locator
            - '@oro_api.request_expression_matcher'

    oro_api.api_doc.filters_sorter.json_api:
        class: Oro\Bundle\ApiBundle\ApiDoc\Sorter\ByTemplateFiltersSorter
        arguments:
            - ['filter', 'fields', 'include', 'meta', 'page', 'sort']
        tags:
            - { name: oro.api.filters_sorter, requestType: json_api }

    oro_api.api_doc.security_context:
        class: Oro\Bundle\ApiBundle\ApiDoc\SecurityContext
        arguments:
            - '@security.token_storage'
            - '@?request_stack'

    oro_api.api_doc.formatter.html_formatter:
        class: Oro\Bundle\ApiBundle\ApiDoc\Formatter\NewHtmlFormatter
        parent: nelmio_api_doc.formatter.abstract_formatter
        calls:
            - [setTwig, ['@twig']]
            - [setMotdTemplate, ['%nelmio_api_doc.motd.template%']]
            - [setApiName, ['%nelmio_api_doc.api_name%']]
            - [setEnableSandbox, ['%nelmio_api_doc.sandbox.enabled%']]
            - [setEndpoint, ['%nelmio_api_doc.sandbox.endpoint%']]
            - [setAcceptType, ['%nelmio_api_doc.sandbox.accept_type%']]
            - [setRequestFormatMethod, ['']]
            - [setRequestFormats, [[]]]
            - [setDefaultRequestFormat, ['json']]
            - [setBodyFormats, [[]]]
            - [setDefaultBodyFormat, ['json']]
            - [setAuthentication, ['%nelmio_api_doc.sandbox.authentication%']]
            - [setDefaultSectionsOpened, ['%nelmio_api_doc.default_sections_opened%']]
            - [setSecurityContext, ['@oro_api.api_doc.security_context']]
            - [setFileLocator, ['@file_locator']]
            - [setDocumentationProvider, ['@oro_api.api_doc.documentation_provider']]

    oro_api.api_doc.formatter.html_formatter.composite:
        class: Oro\Bundle\ApiBundle\ApiDoc\Formatter\CompositeFormatter
        arguments:
            - '@oro_api.rest.doc_view_detector'

    oro_api.api_doc.documentation_provider:
        class: Oro\Bundle\ApiBundle\ApiDoc\ChainDocumentationProvider
        arguments:
            - [] # providers
            - ~ # service locator
            - '@oro_api.request_expression_matcher'

    oro_api.api_doc.documentation_provider.predefined_ids:
        class: Oro\Bundle\ApiBundle\ApiDoc\PredefinedIdDocumentationProvider
        arguments:
            - '@oro_api.entity_id_resolver_registry'
        tags:
            - { name: oro.api.documentation_provider }

    oro_api.api_doc.annotation_parser:
        class: Oro\Bundle\ApiBundle\ApiDoc\Parser\ApiDocAnnotationParser
        tags:
            - { name: nelmio_api_doc.extractor.parser }

    oro_api.api_doc.metadata_parser:
        class: Oro\Bundle\ApiBundle\ApiDoc\Parser\ApiDocMetadataParser
        arguments:
            - '@oro_api.value_normalizer'
            - '@oro_api.rest.doc_view_detector'
            - '@oro_api.api_doc.data_type_converter'
        tags:
            - { name: nelmio_api_doc.extractor.parser }

    oro_api.rest.doc_view_detector:
        class: Oro\Bundle\ApiBundle\ApiDoc\RestDocViewDetector
        arguments:
            - '@request_stack'
            - !tagged_iterator oro.api.request_type_provider

    oro_api.rest.request_type_provider:
        class: Oro\Bundle\ApiBundle\ApiDoc\RestRequestTypeProvider
        tags:
            - { name: oro.api.request_type_provider }

    oro_api.api_doc.validate_view_listener:
        class: Oro\Bundle\ApiBundle\EventListener\ValidateApiDocViewListener
        arguments:
            - '%oro_api.rest.prefix%doc'
            - '%oro_api.api_doc.views%'
            - '%oro_api.api_doc.default_view%'
        tags:
            - { name: kernel.event_listener, event: kernel.controller, method: onKernelController }

    oro_api.listener.dump_api_doc_console_command_listener:
        class: Oro\Bundle\ApiBundle\EventListener\DumpApiDocConsoleCommandListener
        arguments:
            - '@oro_api.rest.doc_view_detector'
        tags:
            - { name: kernel.event_listener, event: console.command, method: onConsoleCommand, priority: 255 }

    oro_api.entity_description_provider:
        class: Oro\Bundle\ApiBundle\ApiDoc\EntityDescriptionProvider
        arguments:
            - '@oro_entity.entity_class_name_provider'
            - '@oro_entity_config.config_manager'
            - '@oro_api.doctrine_helper'
            - '@translator'

    oro_api.entity_name_provider:
        class: Oro\Bundle\ApiBundle\ApiDoc\EntityNameProvider
        arguments:
            - '@oro_api.entity_description_provider'
            - '@Doctrine\Inflector\Inflector'

    oro_api.resource_doc_provider:
        class: Oro\Bundle\ApiBundle\ApiDoc\ResourceDocProvider

    oro_api.resource_doc_parser_registry:
        class: Oro\Bundle\ApiBundle\ApiDoc\ResourceDocParserRegistry
        arguments:
            - !abstract '$parsers defined in Oro\Bundle\ApiBundle\DependencyInjection\Compiler\ResourceDocParserCompilerPass'
            - !abstract '$container defined in Oro\Bundle\ApiBundle\DependencyInjection\Compiler\ResourceDocParserCompilerPass'
            - '@oro_api.request_expression_matcher'

    # a template for non defined explicitly parsers
    # see Oro\Bundle\ApiBundle\DependencyInjection\Compiler\ResourceDocParserCompilerPass
    oro_api.resource_doc_parser.template:
        class: Oro\Bundle\ApiBundle\ApiDoc\Parser\MarkdownApiDocParser
        abstract: true
        arguments:
            - '@file_locator'

    oro_api.resource_doc_parser.default:
        class: Oro\Bundle\ApiBundle\ApiDoc\Parser\MarkdownApiDocParser
        arguments:
            - '@file_locator'
        tags:
            - { name: oro.api.resource_doc_parser, requestType: rest&json_api, priority: -10 }
            - { name: oro.api.resource_doc_parser, requestType: rest, priority: -20 }

    oro_api.constraint_text_extractor:
        class: Oro\Bundle\ApiBundle\Request\ChainConstraintTextExtractor
        arguments:
            - !tagged_iterator oro.api.constraint_text_extractor

    oro_api.constraint_text_extractor.default:
        class: Oro\Bundle\ApiBundle\Request\ConstraintTextExtractor
        tags:
            - { name: oro.api.constraint_text_extractor, priority: -10 }

    oro_api.entity_title_provider:
        class: Oro\Bundle\ApiBundle\Provider\EntityTitleProvider
        arguments:
            - '@oro_api.doctrine_helper'
            - '@oro_entity.entity_name_resolver'

    oro_api.expanded_association_provider:
        class: Oro\Bundle\ApiBundle\Provider\ExtendedAssociationProvider
        arguments:
            - '@oro_entity_extend.association_manager'
            - '@oro_api.resources_provider'
            - '@oro_api.entity_override_provider_registry'

    oro_api.expanded_association_extractor:
        class: Oro\Bundle\ApiBundle\Provider\ExpandedAssociationExtractor

    oro_api.request_expression_matcher:
        class: Oro\Bundle\ApiBundle\Util\RequestExpressionMatcher

    oro_api.action_group_executor:
        class: Oro\Bundle\ApiBundle\Util\ActionGroupExecutor
        arguments:
            - '@oro_action.action_group_registry'
            - '@translator'

    oro_api.security.firewall.feature_access_listener:
        class: Oro\Bundle\ApiBundle\Security\Http\Firewall\FeatureAccessListener
        arguments:
            - '@security.token_storage'

    oro_api.batch.async.operation_manager:
        class: Oro\Bundle\ApiBundle\Batch\Async\AsyncOperationManager
        arguments:
            - '@doctrine'
            - '@oro_api.batch.file_manager'
            - '@oro_api.batch.error_manager'
            - '@logger'
        tags:
            - { name: monolog.logger, channel: api }

    oro_api.batch.async.update_list_processing_helper:
        class: Oro\Bundle\ApiBundle\Batch\Async\UpdateListProcessingHelper
        arguments:
            - '@oro_api.batch.file_manager'
            - '@oro_api.batch.file_name_provider'
            - '@oro_message_queue.client.message_producer'
            - '@logger'
        tags:
            - { name: monolog.logger, channel: api }

    oro_api.batch.async.update_list:
        class: Oro\Bundle\ApiBundle\Batch\Async\UpdateListMessageProcessor
        arguments:
            - '@oro_message_queue.job.runner'
            - '@oro_message_queue.job.manager'
            - '@oro_message_queue.job.dependent_job_service'
            - '@oro_api.batch.file_splitter_registry'
            - '@oro_api.batch.chunk_file_classifier_registry'
            - '@oro_api.batch.include_accessor_registry'
            - '@oro_api.batch.include_map_manager'
            - '@oro_api.batch.file_manager.source_data'
            - '@oro_api.batch.file_manager'
            - '@oro_message_queue.client.message_producer'
            - '@oro_api.batch.async.operation_manager'
            - '@oro_api.batch.async.update_list_processing_helper'
            - '@oro_api.batch.file_name_provider'
            - '@logger'
        tags:
            - { name: 'oro_message_queue.client.message_processor' }
            - { name: monolog.logger, channel: api }

    oro_api.batch.async.update_list.create_chunk_jobs:
        class: Oro\Bundle\ApiBundle\Batch\Async\UpdateListCreateChunkJobsMessageProcessor
        arguments:
            - '@oro_message_queue.job.runner'
            - '@doctrine'
            - '@oro_api.batch.async.operation_manager'
            - '@oro_api.batch.async.update_list_processing_helper'
            - '@logger'
        tags:
            - { name: 'oro_message_queue.client.message_processor' }
            - { name: monolog.logger, channel: api }

    oro_api.batch.async.update_list.start_chunk_jobs:
        class: Oro\Bundle\ApiBundle\Batch\Async\UpdateListStartChunkJobsMessageProcessor
        arguments:
            - '@doctrine'
            - '@oro_api.batch.async.operation_manager'
            - '@oro_api.batch.async.update_list_processing_helper'
            - '@logger'
        tags:
            - { name: 'oro_message_queue.client.message_processor' }
            - { name: monolog.logger, channel: api }

    oro_api.batch.async.update_list.process_chunk:
        class: Oro\Bundle\ApiBundle\Batch\Async\UpdateListProcessChunkMessageProcessor
        arguments:
            - '@oro_message_queue.job.runner'
            - '@oro_message_queue.job.manager'
            - '@oro_api.batch.file_manager'
            - '@oro_api.batch.update_handler'
            - '@oro_api.batch.data_encoder_registry'
            - '@oro_api.batch.retry_helper'
            - '@oro_api.batch.async.update_list_processing_helper'
            - '@oro_api.batch.file_name_provider'
            - '@oro_api.batch.file_lock_manager'
            - '@logger'
        tags:
            - { name: 'oro_message_queue.client.message_processor' }
            - { name: monolog.logger, channel: api }

    oro_api.batch.async.update_list.finish:
        class: Oro\Bundle\ApiBundle\Batch\Async\UpdateListFinishMessageProcessor
        arguments:
            - '@oro_api.batch.async.update_list_processing_helper'
            - '@oro_api.batch.async.operation_manager'
            - '@oro_api.batch.file_manager'
            - '@oro_api.batch.include_map_manager'
            - '@oro_api.batch.file_name_provider'
        tags:
            - { name: 'oro_message_queue.client.message_processor' }

    oro_api.batch.job_event_listener:
        class: Oro\Bundle\ApiBundle\Batch\EventListener\JobListener
        arguments:
            - '@doctrine'
            - '@oro_api.batch.async.operation_manager'
        tags:
            - { name: kernel.event_listener, event: oro_message_queue.before_save_job, method: onBeforeSaveJob }

    oro_api.batch.retry_helper:
        class: Oro\Bundle\ApiBundle\Batch\RetryHelper

    oro_api.batch.file_manager.source_data:
        parent: oro_gaufrette.file_manager
        arguments:
            - 'api_source_data'

    oro_api.batch.file_manager:
        parent: oro_gaufrette.file_manager
        arguments:
            - 'api'

    oro_api.batch.file_lock_manager:
        class: Oro\Bundle\ApiBundle\Batch\FileLockManager
        arguments:
            - '@lock.batch_api.factory'
            - '@logger'
        tags:
            - { name: monolog.logger, channel: api }

    oro_api.batch.include_map_manager:
        class: Oro\Bundle\ApiBundle\Batch\IncludeMapManager
        arguments:
            - '@oro_api.batch.item_key_builder'
            - '@oro_api.batch.file_name_provider'
            - '@oro_api.batch.file_lock_manager'
            - '@logger'
        tags:
            - { name: monolog.logger, channel: api }

    oro_api.batch.error_manager:
        class: Oro\Bundle\ApiBundle\Batch\ErrorManager
        arguments:
            - '@oro_api.batch.file_name_provider'
            - '@oro_api.batch.file_lock_manager'
            - '@logger'
        tags:
            - { name: monolog.logger, channel: api }

    oro_api.batch.item_key_builder:
        class: Oro\Bundle\ApiBundle\Batch\ItemKeyBuilder

    oro_api.batch.update_handler:
        class: Oro\Bundle\ApiBundle\Batch\Handler\BatchUpdateHandler
        arguments:
            - '@oro_api.batch_update.processor'
            - '@oro_api.batch_update_item.processor'

    oro_api.batch.flush_data_handler_factory_registry:
        class: Oro\Bundle\ApiBundle\Batch\Handler\BatchFlushDataHandlerFactoryRegistry
        arguments:
            - [] # factories
            - ~ # service locator

    oro_api.batch.flush_data_handler_factory:
        class: Oro\Bundle\ApiBundle\Batch\Handler\BatchFlushDataHandlerFactory
        arguments:
            - '@oro_api.doctrine_helper'
            - '@oro_api.save_data_handler'
        tags:
            - { name: oro.api.batch.flush_data_handler_factory, priority: -250 }

    oro_api.batch.file_name_provider:
        class: Oro\Bundle\ApiBundle\Batch\FileNameProvider

    oro_api.batch.chunk_size_provider:
        class: Oro\Bundle\ApiBundle\Batch\ChunkSizeProvider
        arguments:
            - 1 # injected the value of the "oro_api.batch_api.chunk_size" configuration option
            - [] # injected the value of the "oro_api.batch_api.chunk_size_per_entity" configuration option
            - 1 # injected the value of the "oro_api.batch_api.included_data_chunk_size" configuration option
            - [] # injected the value of the "oro_api.batch_api.included_data_chunk_size_per_entity" configuration option

    oro_api.batch.file_splitter_registry:
        class: Oro\Bundle\ApiBundle\Batch\Splitter\FileSplitterRegistry
        arguments:
            - [] # splitters
            - ~ # service locator
            - '@oro_api.request_expression_matcher'

    oro_api.batch.file_splitter.json_api:
        class: Oro\Bundle\ApiBundle\Batch\Splitter\JsonPartialFileSplitter
        calls:
            - [ setHeaderSectionName, [ 'jsonapi' ] ]
            - [ setSectionNamesToSplit, [ ['data', 'included'] ] ]
            # it is replaced with a value returned by oro_api.batch.chunk_size_provider::getIncludedDataChunkSize()
            - [ setChunkSizePerSection, [ {'included': 1000} ] ]
        tags:
            - { name: oro.api.batch.file_splitter, requestType: json_api }

    oro_api.batch.chunk_file_classifier_registry:
        class: Oro\Bundle\ApiBundle\Batch\Async\ChunkFileClassifierRegistry
        arguments:
            - [] # classifiers
            - ~ # service locator
            - '@oro_api.request_expression_matcher'

    oro_api.batch.chunk_file_classifier.json_api:
        class: Oro\Bundle\ApiBundle\Batch\Async\ChunkFileClassifier
        arguments:
            - 'data'
            - 'included'
        tags:
            - { name: oro.api.batch.chunk_file_classifier, requestType: json_api }

    oro_api.batch.data_encoder_registry:
        class: Oro\Bundle\ApiBundle\Batch\Encoder\DataEncoderRegistry
        arguments:
            - [] # encoders
            - ~ # service locator
            - '@oro_api.request_expression_matcher'

    oro_api.batch.data_encoder.json_api:
        class: Oro\Bundle\ApiBundle\Batch\Encoder\JsonDataEncoder
        calls:
            - [ setHeaderSectionName, [ 'jsonapi' ] ]
        tags:
            - { name: oro.api.batch.data_encoder, requestType: json_api }

    oro_api.batch.include_accessor_registry:
        class: Oro\Bundle\ApiBundle\Batch\IncludeAccessor\IncludeAccessorRegistry
        arguments:
            - [] # accessors
            - ~ # service locator
            - '@oro_api.request_expression_matcher'

    oro_api.batch.include_accessor.json_api:
        class: Oro\Bundle\ApiBundle\Batch\IncludeAccessor\JsonApiIncludeAccessor
        arguments:
            - '@oro_api.batch.item_key_builder'
        tags:
            - { name: oro.api.batch.include_accessor, requestType: json_api }

    oro_api.batch.delete_handler.async_operation:
        class: Oro\Bundle\ApiBundle\Batch\Handler\AsyncOperationDeleteHandler
        parent: oro_entity.delete_handler
        arguments:
            - '@oro_api.batch.file_name_provider'
            - '@oro_api.batch.file_manager'
            - '@logger'
        tags:
            - { name: oro_entity.delete_handler, entity: Oro\Bundle\ApiBundle\Entity\AsyncOperation }
            - { name: monolog.logger, channel: api }

    oro_api.security.event_listener.logout_listener:
        class: Oro\Bundle\ApiBundle\Security\EventListener\LogoutListener
        arguments:
            - '@security.http_utils'
            - '@oro_api.rest.doc_url_generator'

    oro_api.open_api_specification_archive:
        class: Oro\Bundle\ApiBundle\Util\OpenApiSpecificationArchive

    oro_api.open_api_choices_provider:
        class: Oro\Bundle\ApiBundle\Provider\OpenApiChoicesProvider
        public: true
        arguments:
            - '@translator'
            - '@oro_api.api_doc.open_api.generator_registry'
            - '@oro_api.api_doc.open_api.formatter_registry'
            - '@oro_api.api_doc.open_api.name_provider'

    oro_api.open_api_specification_datagrid_helper:
        class: Oro\Bundle\ApiBundle\Datagrid\OpenApiSpecificationDatagridHelper
        public: true

    oro_api.open_api_specification_status_filter:
        class: Oro\Bundle\ApiBundle\Datagrid\OpenApiSpecificationStatusFilter
        arguments:
            - '@form.factory'
            - '@oro_filter.filter_utility'
        tags:
            - { name: oro_filter.extension.orm_filter.filter, type: oro_openapi_specification_status }

    oro_api.twig.open_api_specification:
        class: Oro\Bundle\ApiBundle\Twig\OpenApiSpecificationExtension
        arguments:
            - '@oro_platform.twig.service_locator'
        tags:
            - { name: twig.extension }

    oro_api.event_listener.open_api_specification_form:
        class: Oro\Bundle\ApiBundle\EventListener\OpenApiSpecificationEventListener
        arguments:
            - '@oro_message_queue.client.message_producer'
        tags:
            - { name: kernel.event_listener, event: oro.form.update_handler.before_entity_flush.oro_openapi_specification, method: beforeFlush }
            - { name: kernel.event_listener, event: oro.form.update_handler.after_entity_flush.oro_openapi_specification, method: afterFlush }
            - { name: kernel.event_listener, event: oro.form.update_handler.after_entity_flush.oro_openapi_specification_clone, method: afterFlush }

    oro_api.autocomplete.search_handler.open_api_specification_entity:
        class: Oro\Bundle\ApiBundle\Autocomplete\OpenApiSpecificationEntitySearchHandler
        arguments:
            - '@oro_api.autocomplete.open_api_specification_entity_provider'
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: openapi_specification_entities, acl_resource: oro_openapi_specification_view }

    oro_api.autocomplete.open_api_specification_entity_provider:
        class: Oro\Bundle\ApiBundle\Autocomplete\OpenApiSpecificationEntityProvider
        arguments:
            - '@oro_api.resources_provider'
            - '@oro_api.value_normalizer'
            - '@oro_api.entity_name_provider'
            - '@oro_api.rest.doc_view_detector'

    oro_api.async.create_open_api_specification:
        class: Oro\Bundle\ApiBundle\Async\CreateOpenApiSpecificationMessageProcessor
        arguments:
            - '@doctrine'
            - '@oro_api.api_doc.open_api.renderer'
            - '@oro_api.open_api_specification_archive'
            - '@logger'
        tags:
            - { name: 'oro_message_queue.client.message_processor' }
            - { name: monolog.logger, channel: api }
