parameters:
    oro_dataaudit.metadata.metadata_factory.class:  Oro\Bundle\DataAuditBundle\Metadata\ExtendMetadataFactory
    oro_dataaudit.metadata.annotation_driver.class: Oro\Bundle\DataAuditBundle\Metadata\Driver\AnnotationDriver

    oro_dataaudit.listener.entity_listener.class:   Oro\Bundle\DataAuditBundle\EventListener\EntityListener
    oro_dataaudit.listener.kernel_listener.class:   Oro\Bundle\DataAuditBundle\EventListener\KernelListener
    oro_dataaudit.listener.deprecated_audit_data_listener.class: Oro\Bundle\DataAuditBundle\EventListener\DeprecatedAuditDataListener

    oro_dataaudit.loggable.loggable_manager.class:  Oro\Bundle\DataAuditBundle\Loggable\LoggableManager
    oro_dataaudit.loggable.audit_entity_mapper.class: Oro\Bundle\DataAuditBundle\Loggable\AuditEntityMapper

    oro_dataaudit.loggable.entity.class:            Oro\Bundle\DataAuditBundle\Entity\Audit
    oro_dataaudit.loggable.entity_field.class:      Oro\Bundle\DataAuditBundle\Entity\AuditField

    oro_dataaudit.event_listener.dataaudit_grid_listener.class: Oro\Bundle\DataAuditBundle\EventListener\AuditGridListener
    oro_dataaudit.event_listener.dataaudit_history_grid_listener.class: Oro\Bundle\DataAuditBundle\EventListener\AuditHistoryGridListener
    oro_dataaudit.event_listener.segment_widget_options_listener.class: Oro\Bundle\DataAuditBundle\EventListener\SegmentWidgetOptionsListener
    oro_dataaudit.event_listener.segment_condition_builder_options_listener.class: Oro\Bundle\DataAuditBundle\EventListener\SegmentConditionBuilderOptionsListener

    oro_dataaudit.placeholder.filter.class:         Oro\Bundle\DataAuditBundle\Placeholder\AuditableFilter

    oro_dataaudit.audit.manager.api.class:          Oro\Bundle\SoapBundle\Entity\Manager\ApiEntityManager

    oro_dataaudit.filter.audit.class:               Oro\Bundle\DataAuditBundle\Filter\AuditFilter
    oro_dataaudit.migration.extension.audit_field.class: Oro\Bundle\DataAuditBundle\Migration\Extension\AuditFieldExtension

services:
    oro_dataaudit.filter.audit:
        class: %oro_dataaudit.filter.audit.class%
        arguments:
            - '@form.factory'
            - '@oro_filter.filter_utility'
            - '@oro_query_designer.query_designer.manager'
        tags:
            - { name: oro_filter.extension.orm_filter.filter, type: audit }

    oro_dataaudit.loggable.loggable_manager:
        class:                                      %oro_dataaudit.loggable.loggable_manager.class%
        arguments:
            - %oro_dataaudit.loggable.entity.class%
            - %oro_dataaudit.loggable.entity_field.class%
            - '@oro_entity_config.provider.dataaudit'
            - '@security.context.link'
            - '@oro_dataaudit.loggable.audit_entity_mapper'

    oro_dataaudit.loggable.audit_entity_mapper:
        class: %oro_dataaudit.loggable.audit_entity_mapper.class%
        calls:
            - [addAuditEntryClass, [%oro_user.entity.class%, %oro_dataaudit.loggable.entity.class%]]
            - [addAuditEntryFieldClass, [%oro_user.entity.class%, %oro_dataaudit.loggable.entity_field.class%]]

    oro_dataaudit.metadata.metadata_factory:
        class:                                      %oro_dataaudit.metadata.metadata_factory.class%
        arguments:                                  ['@oro_dataaudit.metadata.annotation_driver']
        public:                                     false

    oro_dataaudit.metadata.annotation_driver:
        class:                                      %oro_dataaudit.metadata.annotation_driver.class%
        arguments:                                  ['@annotation_reader']
        public:                                     false

    oro_dataaudit.listener.entity_listener:
        class:                                      %oro_dataaudit.listener.entity_listener.class%
        arguments:
            - '@oro_dataaudit.loggable.loggable_manager'
            - '@oro_dataaudit.metadata.metadata_factory'
        tags:
            - { name: doctrine.event_listener, event: onFlush }
            - { name: doctrine.event_listener, event: loadClassMetadata }
            - { name: doctrine.event_listener, event: postPersist }

    oro_dataaudit.listener.kernel_listener:
        class:                                      %oro_dataaudit.listener.kernel_listener.class%
        arguments:                                  ['@service_container']
        tags:
            - { name: kernel.event_listener, event: kernel.request , method: onKernelRequest}

    oro_dataaudit.listener.deprecated_audit_data_listener:
        class: %oro_dataaudit.listener.deprecated_audit_data_listener.class%
        tags:
            - { name: doctrine.event_listener, event: onFlush }
            - { name: doctrine.event_listener, event: postFlush }

    oro_dataaudit.dataaudit_grid_service:
        class: %oro_dataaudit.event_listener.dataaudit_grid_listener.class%
        arguments:
            - '@doctrine.orm.entity_manager'

    oro_dataaudit.event_listener.dataaudit_history_grid_listener:
        class: %oro_dataaudit.event_listener.dataaudit_history_grid_listener.class%
        arguments:
            - [objectClass, objectId]
        tags:
          - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after.audit-history-grid, method: onBuildAfter }

    oro_dataaudit.event_listener.segment_widget_options_listener:
        class: %oro_dataaudit.event_listener.segment_widget_options_listener.class%
        arguments:
            - '@http_kernel'
            - '@oro_security.security_facade'
            - '@oro_dataaudit.segment_widget.context_checker'
        calls:
            - [setRequest, ["@?request="]]
        tags:
            - { name: kernel.event_listener, event: oro_segment.widget_options_load, method: onLoad }

    oro_dataaudit.event_listener.segment_condition_builder_options_listener:
        class: %oro_dataaudit.event_listener.segment_condition_builder_options_listener.class%
        tags:
            - { name: kernel.event_listener, event: oro_segment.condition_builder_options_load, method: onLoad }

    # Placeholder filter
    oro_dataaudit.placeholder.filter:
        class: %oro_dataaudit.placeholder.filter.class%
        arguments:
            - '@oro_entity_config.provider.dataaudit'

    oro_dataaudit.audit.manager.api:
        class: %oro_dataaudit.audit.manager.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - %oro_dataaudit.loggable.entity.class%
            - '@doctrine.orm.entity_manager'

    oro_dataaudit.migration.extension.audit_field:
        class: %oro_dataaudit.migration.extension.audit_field.class%
        tags:
            - { name: oro_migration.extension, extension_name: audit_field }

    oro_dataaudit.segment_widget.context_checker:
        class: Oro\Bundle\DataAuditBundle\SegmentWidget\ContextChecker
