parameters:
    oro_activity.manager.class:                          Oro\Bundle\ActivityBundle\Manager\ActivityManager
    oro_activity.entity_config_dumper.extension.class:   Oro\Bundle\ActivityBundle\Tools\ActivityEntityConfigDumperExtension
    oro_activity.entity_generator.extension.class:       Oro\Bundle\ActivityBundle\Tools\ActivityEntityGeneratorExtension
    oro_activity.migration.extension.activity.class:     Oro\Bundle\ActivityBundle\Migration\Extension\ActivityExtension
    oro_activity.widget_provider.activities.class:       Oro\Bundle\UIBundle\Provider\ChainWidgetProvider
    oro_activity.widget_provider.activities.main.class:  Oro\Bundle\ActivityBundle\Provider\ActivityWidgetProvider
    oro_activity.widget_provider.activities.menu.class:  Oro\Bundle\UIBundle\Provider\TabMenuWidgetProvider
    oro_activity.widget_provider.actions.class:          Oro\Bundle\ActivityBundle\Provider\ActivityActionWidgetProvider
    oro_activity.manager.activity.api.class:             Oro\Bundle\ActivityBundle\Entity\Manager\ActivityApiEntityManager
    oro_activity.manager.activity_search.api.class:      Oro\Bundle\ActivityBundle\Entity\Manager\ActivitySearchApiEntityManager
    oro_activity.manager.activity_entity.api.class:      Oro\Bundle\ActivityBundle\Entity\Manager\ActivityEntityApiEntityManager
    oro_activity.handler.delete.activity_entity.class:   Oro\Bundle\ActivityBundle\Entity\Manager\ActivityEntityDeleteHandler
    oro_activity.form.handler.activity_entity.api.class: Oro\Bundle\ActivityBundle\Form\Handler\ActivityEntityApiHandler
    oro_activity.manager.activity_target.api.class:      Oro\Bundle\ActivityBundle\Entity\Manager\ActivityTargetApiEntityManager

services:
    oro_activity.manager:
        class: %oro_activity.manager.class%
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_entity.orm.entity_class_resolver'
            - '@oro_entity_config.provider.activity'
            - '@oro_entity_config.provider.grouping'
            - '@oro_entity_config.provider.entity'
            - '@oro_entity_config.provider.extend'
            - '@oro_entity_extend.association_manager'
        calls:
            - [setEventDispatcher, ['@event_dispatcher']]

    oro_activity.association_helper:
        class: Oro\Bundle\ActivityBundle\Tools\ActivityAssociationHelper
        public: false
        arguments:
            - '@oro_entity_config.config_manager'

    oro_activity.entity_config_dumper.extension:
        class: %oro_activity.entity_config_dumper.extension.class%
        parent: oro_entity_extend.entity_config_dumper.extension.association
        tags:
            - { name: oro_entity_extend.entity_config_dumper_extension }

    oro_activity.entity_generator.extension:
        class: %oro_activity.entity_generator.extension.class%
        arguments:
            - '@oro_entity_config.provider.grouping'
        tags:
            - { name: oro_entity_extend.entity_generator_extension }

    oro_activity.migration.extension.activity:
        class: %oro_activity.migration.extension.activity.class%
        tags:
            - { name: oro_migration.extension, extension_name: activity }

    oro_activity.widget_provider.activities:
        class: %oro_activity.widget_provider.activities.class%

    oro_activity.widget_provider.activities.main:
        class: %oro_activity.widget_provider.activities.main.class%
        arguments:
            - '@oro_activity.manager'
            - '@oro_security.security_facade'
            - '@translator'
            - '@oro_entity.entity_identifier_accessor'
            - '@oro_entity.routing_helper'
        tags:
            - { name: oro_activity.activity_widget_provider }

    oro_activity.provider.context_grid:
        class: Oro\Bundle\ActivityBundle\Provider\ContextGridProvider
        arguments:
            - '@oro_entity.routing_helper'
            - '@oro_entity.entity_provider'
            - '@oro_entity_config.provider.grid'
            - '@oro_security.security_facade'

    oro_activity.listener.context_grid:
        class: Oro\Bundle\ActivityBundle\EventListener\Datagrid\ContextGridListener
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_entity.entity_class_name_helper'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after, method: onBuildAfter }

    oro_activity.widget_provider.actions:
        class: %oro_activity.widget_provider.actions.class%
        arguments:
            - '@oro_activity.manager'
            - '@oro_ui.placeholder.provider'
        tags:
            - { name: oro_ui.view_action_provider, group: activity }
            - { name: oro_ui.update_action_provider, group: activity }

    oro_activity.routing.options_resolver.activity_association:
        class: Oro\Bundle\ActivityBundle\Routing\ActivityAssociationRouteOptionsResolver
        public: false
        arguments:
            - '@oro_entity_config.provider.grouping'
            - '@oro_entity.entity_alias_resolver'
        tags:
            - { name: routing.options_resolver }

    oro_activity.exclusion_provider:
        class: Oro\Bundle\ActivityBundle\Provider\ActivityExclusionProvider
        public: false
        arguments:
            - '@oro_entity_config.config_manager'
        tags:
            - { name: oro_entity.exclusion_provider.api }

    oro_activity.manager.activity.api:
        class: %oro_activity.manager.activity.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - '@doctrine.orm.entity_manager'
            - '@oro_activity.manager'

    oro_activity.manager.activity_entity.api:
        class: %oro_activity.manager.activity_entity.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - '@doctrine.orm.entity_manager'
            - '@oro_activity.manager'

    oro_activity.manager.activity_search.api:
        class: %oro_activity.manager.activity_search.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - '@doctrine.orm.entity_manager'
            - '@oro_activity.manager'
            - '@oro_search.index'

    oro_activity.handler.delete.activity_entity:
        class: %oro_activity.handler.delete.activity_entity.class%
        parent: oro_soap.handler.delete.abstract
        calls:
            - [setSecurityFacade, ['@oro_security.security_facade']]
            - [setActivityManager, ['@oro_activity.manager']]

    oro_activity.form.handler.autocomplete:
        class: Oro\Bundle\ActivityBundle\Autocomplete\ContextSearchHandler
        arguments:
            - '@security.token_storage'
            - '@translator'
            - '@oro_search.index'
            - '@oro_activity.manager'
            - '@oro_entity_config.config_manager'
            - '@oro_entity.entity_class_name_helper'
            - '@doctrine.orm.entity_manager'
            - '@oro_search.mapper'
            - '@event_dispatcher'

    oro_activity.form.handler.activity_entity.api:
        class: %oro_activity.form.handler.activity_entity.api.class%
        scope: request
        arguments:
            - '@oro_activity.form.activity_entity.api'
            - '@request'
            - '@doctrine.orm.entity_manager'
            - '@oro_activity.manager'
            - '@oro_security.security_facade'

    oro_activity.form.activity_entity.api:
        class: Symfony\Component\Form\Form
        factory_method: createNamed
        factory_service: form.factory
        arguments:
            - targets
            - 'oro_related_entity_standalone_collection_api'
            - ~
            - constraints:
                - Count:
                    min: 1
                    minMessage: "The 'targets' collection should contain at least one element"

    oro_activity.manager.activity_target.api:
        class: %oro_activity.manager.activity_target.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - '@doctrine.orm.entity_manager'
            - '@oro_activity.manager'

    oro_activity.manager.activity_context.api:
        class: Oro\Bundle\ActivityBundle\Entity\Manager\ActivityContextApiEntityManager
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - '@doctrine.orm.entity_manager'
            - '@oro_activity.manager'
            - '@security.token_storage'
            - '@oro_entity_config.config_manager'
            - '@router'
            - '@oro_entity.entity_alias_resolver'
            - '@oro_activity.resolver.entity_title'
            - '@oro_entity.doctrine_helper'
        calls:
            - [setEventDispatcher, ['@event_dispatcher']]

    oro_activity.resolver.entity_title.entity_name:
        public: false
        class: Oro\Bundle\SearchBundle\Resolver\EntityNameEntityTitleResolver
        arguments:
            - '@oro_search.resolver.entity_title'
            - '@oro_entity.entity_name_resolver'

    oro_activity.resolver.entity_title:
        class: Oro\Bundle\SearchBundle\Resolver\DefaultEntityTitleResolver
        arguments:
            - '@oro_activity.resolver.entity_title.entity_name'
            - '@translator'
