services:
    oro_workflow.datagrid.action_permission_provider:
        class: Oro\Bundle\WorkflowBundle\Datagrid\ActionPermissionProvider
        public: true
        arguments:
            - '@oro_featuretoggle.checker.feature_checker'
            - '@oro_workflow.configuration.checker'

    oro_workflow.datagrid.abstract_entity_name_provider:
        class: 'Oro\Bundle\WorkflowBundle\Datagrid\GridEntityNameProvider'
        abstract: true
        arguments:
            - '@oro_entity_config.provider.entity'
            - '@doctrine.orm.entity_manager'
            - '@translator'

    oro_workflow.datagrid.process_definition_entity_name_provider:
        parent: oro_workflow.datagrid.abstract_entity_name_provider
        public: true
        calls:
            - [setEntityName, ["OroWorkflowBundle:ProcessDefinition"]]

    oro_workflow.datagrid.workflow_definition_entity_name_provider:
        parent: oro_workflow.datagrid.abstract_entity_name_provider
        public: true
        calls:
            - [setEntityName, ["OroWorkflowBundle:WorkflowDefinition"]]

    oro_workflow.datagrid.listener.workflow_step_column:
        class: 'Oro\Bundle\WorkflowBundle\Datagrid\WorkflowStepColumnListener'
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_entity.orm.entity_class_resolver'
            - '@oro_entity_config.provider.workflow'
            - '@oro_workflow.registry.workflow_manager'
            - '@oro_filter.provider.state.filters'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before, method: onBuildBefore, priority: 255 }
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after, method: onBuildAfter, priority: 255 }
            - { name: kernel.event_listener, event: oro_datagrid.orm_datasource.result.after, method: onResultAfter, priority: 255 }
        calls:
            - [addWorkflowStepColumn, ["workflowStep"]]
            - [addWorkflowStepColumn, ["workflowStepLabel"]]
            - [addWorkflowStepColumn, ["step"]]
            - [addWorkflowStepColumn, ["stepLabel"]]

    oro_workflow.datagrid.listener.translation_workflow_column:
        class: 'Oro\Bundle\WorkflowBundle\Datagrid\Translation\WorkflowColumnListener'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.oro-translation-translations-grid, method: onBuildBefore }

    oro_workflow.datagrid.listener.email_notification:
        class: 'Oro\Bundle\WorkflowBundle\Datagrid\EmailNotificationDatagridListener'
        arguments:
            - '@translator'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.email-notification-grid, method: onBuildBefore }
            - { name: kernel.event_listener, event: oro_datagrid.orm_datasource.result.after.email-notification-grid, method: onResultAfter }

    oro_workflow.datagrid.extension.restrictions:
        class: 'Oro\Bundle\WorkflowBundle\Datagrid\Extension\RestrictionsExtension'
        arguments:
            - '@oro_entity.orm.entity_class_resolver'
            - '@oro_workflow.restriction.manager'
        tags:
            - { name: oro_datagrid.extension }

    oro_workflow.datagrid.listener.label:
        class: 'Oro\Bundle\WorkflowBundle\Datagrid\WorkflowDatagridLabelListener'
        arguments:
            - '@translator'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before, method: onBuildBefore,  priority: 255 }

    oro_workflow.datagrid.datasource.workflow_permission_datasource:
        class: Oro\Bundle\WorkflowBundle\Datagrid\WorkflowPermissionDatasource
        arguments:
            - '@translator'
            - '@oro_security.acl.permission_manager'
            - '@oro_user.form.handler.abstract.acl_role'
            - '@oro_user.provider.role_privilege_category_provider'
            - '@oro_entity_config.config_manager'
        tags:
            - { name: oro_datagrid.datasource, type: workflow-permission-provider }
