parameters:
    oro_workflow.configuration.default_subdirectory: '/Resources/config/oro/'
    oro_workflow.configuration.app_default_subdirectory: '/config/oro/workflows/'
    oro_workflow.configuration.default_filename: 'workflows.yml'

services:
    oro_workflow.configuration.config.workflow_sole:
        class: Oro\Bundle\WorkflowBundle\Configuration\WorkflowConfiguration

    oro_workflow.configuration.config.workflow_list:
        class: Oro\Bundle\WorkflowBundle\Configuration\WorkflowListConfiguration
        arguments:
            - '@oro_workflow.configuration.config.workflow_sole'

    oro_workflow.configuration.handler.step:
        class: Oro\Bundle\WorkflowBundle\Configuration\Handler\StepHandler

    oro_workflow.configuration.handler.attribute:
        class: Oro\Bundle\WorkflowBundle\Configuration\Handler\AttributeHandler

    oro_workflow.configuration.handler.variable:
        class: 'Oro\Bundle\WorkflowBundle\Configuration\Handler\VariableHandler'
        public: false

    oro_workflow.configuration.handler.transition:
        class: Oro\Bundle\WorkflowBundle\Configuration\Handler\TransitionHandler

    oro_workflow.configuration.handler.workflow:
        class: Oro\Bundle\WorkflowBundle\Configuration\Handler\WorkflowHandler
        calls:
            - [addHandler, ['@oro_workflow.configuration.handler.step']]
            - [addHandler, ['@oro_workflow.configuration.handler.attribute']]
            - [addHandler, ['@oro_workflow.configuration.handler.variable']]
            - [addHandler, ['@oro_workflow.configuration.handler.transition']]
        tags:
            - { name: oro.workflow.configuration.handler }

    oro_workflow.configuration.handler.clean:
        class: Oro\Bundle\WorkflowBundle\Configuration\Handler\CleanConfigurationHandler
        arguments:
            - '@request_stack'
        tags:
            - { name: oro.workflow.configuration.handler, priority: -299 }

    oro_workflow.configuration.handler.filter:
        class: Oro\Bundle\WorkflowBundle\Configuration\Handler\FilterHandler
        tags:
            - { name: oro.workflow.configuration.handler, priority: -300 }

    oro_workflow.configuration.config.process_definition_sole:
        class: Oro\Bundle\WorkflowBundle\Configuration\ProcessDefinitionConfiguration

    oro_workflow.configuration.config.process_definition_list:
        class: Oro\Bundle\WorkflowBundle\Configuration\ProcessDefinitionListConfiguration
        arguments:
            - '@oro_workflow.configuration.config.process_definition_sole'

    oro_workflow.configuration.config.process_trigger_sole:
        class: Oro\Bundle\WorkflowBundle\Configuration\ProcessTriggerConfiguration

    oro_workflow.configuration.config.process_trigger_list:
        class: Oro\Bundle\WorkflowBundle\Configuration\ProcessTriggerListConfiguration
        arguments:
            - '@oro_workflow.configuration.config.process_trigger_sole'

    oro_workflow.configuration.config_finder.factory:
        class: Oro\Bundle\WorkflowBundle\Configuration\ConfigFinderFactory
        arguments:
            - '%kernel.bundles%'
            - '@kernel'

    oro_workflow.configuration.resource_file_locator:
        class: Oro\Bundle\WorkflowBundle\Configuration\Import\ResourceFileLocator
        arguments:
            - '@file_locator'

    oro_workflow.configuration.workflow_config_finder.builder:
        class: Oro\Bundle\WorkflowBundle\Configuration\WorkflowConfigFinderBuilder
        arguments:
            - '@oro_workflow.configuration.config_finder.factory'
        calls:
            - ['setSubDirectory', ['%oro_workflow.configuration.default_subdirectory%']]
            - ['setFileName', ['%oro_workflow.configuration.default_filename%']]
            - ['setAppSubDirectory', ['%oro_workflow.configuration.app_default_subdirectory%']]

    oro_workflow.configuration.reader.yaml:
        class: Oro\Bundle\WorkflowBundle\Configuration\Reader\YamlFileCachedReader

    oro_workflow.configuration.import_processor_factory.file_resource:
        class: Oro\Bundle\WorkflowBundle\Configuration\Import\ResourceFileImportProcessorFactory
        arguments:
            - '@oro_workflow.configuration.reader.yaml'
            - '@oro_workflow.configuration.resource_file_locator'

    oro_workflow.configuration.import_processor_factory.workflow_file:
        class: Oro\Bundle\WorkflowBundle\Configuration\Import\WorkflowFileImportProcessorFactory
        arguments:
            - '@oro_workflow.configuration.reader.yaml'
            - '@oro_workflow.configuration.resource_file_locator'

    oro_workflow.configuration.import_processor_factory.workflow_import_supervisor:
        class: Oro\Bundle\WorkflowBundle\Configuration\Import\WorkflowImportProcessorSupervisorFactory
        arguments:
            - '@oro_workflow.configuration.reader.yaml'
            - '@oro_workflow.configuration.workflow_config_finder.builder'

    oro_workflow.configuration.imports.processor:
        class: Oro\Bundle\WorkflowBundle\Configuration\WorkflowConfigurationImportsProcessor
        calls:
            - ['addImportProcessorFactory', ['@oro_workflow.configuration.import_processor_factory.file_resource']]
            - ['addImportProcessorFactory', ['@oro_workflow.configuration.import_processor_factory.workflow_file']]
            - ['addImportProcessorFactory', ['@oro_workflow.configuration.import_processor_factory.workflow_import_supervisor']]

    oro_workflow.configuration.provider.workflow_config:
        class: Oro\Bundle\WorkflowBundle\Configuration\WorkflowConfigurationProvider
        arguments:
            - '@oro_workflow.configuration.config.workflow_list'
            - '@oro_workflow.configuration.workflow_config_finder.builder'
            - '@oro_workflow.configuration.reader.yaml'
            - '@oro_workflow.configuration.imports.processor'

    oro_workflow.configuration.provider.process_config:
        class: Oro\Bundle\WorkflowBundle\Configuration\ProcessConfigurationProvider
        arguments:
            - '%kernel.bundles%'
            - '@oro_workflow.configuration.config.process_definition_list'
            - '@oro_workflow.configuration.config.process_trigger_list'
            - '@kernel'

    oro_workflow.configuration.builder.workflow_definition:
        class: Oro\Bundle\WorkflowBundle\Configuration\WorkflowDefinitionConfigurationBuilder
        arguments:
            - '@oro_workflow.workflow_assembler'
            - !tagged_iterator oro.workflow.definition_builder.extension

    oro_workflow.configuration.builder.workflow_definition.handle:
        class: Oro\Bundle\WorkflowBundle\Configuration\WorkflowDefinitionHandleBuilder
        public: true
        arguments:
            - '@oro_workflow.configuration.config.workflow_sole'
            - '@oro_workflow.configuration.builder.workflow_definition'
            - !tagged_iterator oro.workflow.configuration.handler

    oro_workflow.configuration.builder.process_configuration:
        class: Oro\Bundle\WorkflowBundle\Configuration\ProcessConfigurationBuilder

    oro_workflow.config_extension.feature:
        class: 'Oro\Bundle\WorkflowBundle\Configuration\FeatureConfigurationExtension'
        tags:
            - { name: oro_feature.config_extension }

    oro_workflow.configuration.checker:
        class: 'Oro\Bundle\WorkflowBundle\Configuration\Checker\ConfigurationChecker'
        public: true
        arguments:
            - '@oro_action.expression.context_accessor'

    Oro\Bundle\WorkflowBundle\Configuration\Checker\ConfigurationChecker:
        alias: 'oro_workflow.configuration.checker'
