parameters:
    enable_price_sharding: false

services:
    oro_pricing.acl.voter.product_list:
        class: 'Oro\Bundle\PricingBundle\Acl\Voter\PriceListVoter'
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@Psr\Container\ContainerInterface'
        calls:
            - [setClassName, ['Oro\Bundle\PricingBundle\Entity\PriceList']]
        tags:
            - { name: security.voter, priority: 10 }
            - { name: container.service_subscriber, id: oro_pricing.price_list_reference_checker }

    oro_pricing.datagrid.price_list_permissions_provider:
        class: 'Oro\Bundle\PricingBundle\Datagrid\PriceListPermissionProvider'
        public: true

    oro_pricing.form.autocomplete.price_list.search_handler:
        parent: oro_form.autocomplete.search_handler
        arguments:
            - 'Oro\Bundle\PricingBundle\Entity\PriceList'
            - ['name']
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: Oro\Bundle\PricingBundle\Form\Type\PriceListType, acl_resource: oro_pricing_price_list_view }

    oro_pricing.listener.product_unit_precision:
        class: 'Oro\Bundle\PricingBundle\EventListener\ProductUnitPrecisionListener'
        arguments:
            - 'Oro\Bundle\PricingBundle\Entity\ProductPrice'
            - '@oro_workflow.changes.event.dispatcher'
            - '@oro_pricing.shard_manager'
            - '@oro_entity.doctrine_helper'
        public: false
        calls:
            - ['setPriceListTriggerHandler', ['@oro_pricing.price_list_trigger_handler']]
        tags:
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\ProductBundle\Entity\ProductUnitPrecision', event: postRemove }
            - { name: doctrine.event_listener, event: onFlush }
            - { name: doctrine.event_listener, event: postFlush }
            - { name: doctrine.event_listener, event: onClear }
            - { name: oro_featuretogle.feature, feature: oro_price_lists }

    oro_pricing.listener.product_unit_precision.remove_product_price_attributes:
        class: Oro\Bundle\PricingBundle\EventListener\ProductUnitPrecisionPostRemoveListener
        arguments:
            - '@oro_pricing.shard_manager'
        tags:
            - { name: doctrine.orm.entity_listener, entity: Oro\Bundle\ProductBundle\Entity\ProductUnitPrecision, event: postRemove }
            - { name: oro_featuretogle.feature, feature: oro_price_lists }

    oro_pricing.user_currency_manager:
        class: 'Oro\Bundle\PricingBundle\Manager\UserCurrencyManager'
        public: true
        lazy: true
        arguments:
            - '@session'
            - '@security.token_storage'
            - '@doctrine'
            - '@oro_currency.config.currency'
            - '@oro_website.manager'
            - '@oro_pricing.provider.current_currency'

    Oro\Bundle\PricingBundle\Manager\UserCurrencyManager:
        alias: oro_pricing.user_currency_manager

    oro_pricing.provider.current_currency:
        class: 'Oro\Bundle\PricingBundle\Provider\ChainCurrentCurrencyProvider'
        public: false
        arguments:
            - !tagged_iterator oro_pricing.current_currency_provider

    oro_pricing.storage.prices:
        class: 'Oro\Bundle\PricingBundle\Storage\CompositeProductPriceStorage'
        arguments:
            - '@oro_pricing.storage.prices.flat'
            - '@oro_pricing.storage.prices.combined'
            - '@oro_featuretoggle.checker.feature_checker'

    oro_pricing.storage.prices.flat:
        class: 'Oro\Bundle\PricingBundle\Storage\ProductPriceORMStorage'
        arguments:
            - '@doctrine'
            - '@oro_pricing.shard_manager'
            - '@oro_pricing.model.flat_price_list_tree_handler'

    oro_pricing.storage.prices.combined:
        class: 'Oro\Bundle\PricingBundle\Storage\CombinedProductPriceORMStorage'
        arguments:
            - '@doctrine'
            - '@oro_pricing.shard_manager'
            - '@oro_pricing.model.price_list_tree_handler'

    oro_pricing.migrations.actualize_cpl_activation_rules_migration:
        class: Oro\Bundle\PricingBundle\Migrations\Service\ActualizeCplActivationRulesMigration
        public: true
        arguments:
            - '@doctrine'
            - '@event_dispatcher'
            - '@oro_pricing.combined_price_list_relation_helper'

    oro_pricing.migrations.minimal_strategy_naming_migration:
        class: Oro\Bundle\PricingBundle\Migrations\Service\MinimalStrategyNamingMigration
        public: true
        arguments:
            - '@oro_config.manager'
            - '@doctrine'
            - '@oro_pricing.pricing_strategy.strategy_register'
            - '@oro_pricing.builder.combined_price_list_garbage_collector'
            - '@oro_pricing.builder.combined_price_list_activation_plan_builder'
            - '@oro_pricing.combined_price_list_relation_helper'

    oro_pricing.provider.combined_product_price:
        alias: oro_pricing.provider.product_price

    oro_pricing.provider.product_price:
        class: 'Oro\Bundle\PricingBundle\Provider\ProductPriceProvider'
        arguments:
            - '@oro_pricing.storage.prices'
            - '@oro_pricing.user_currency_manager'
        calls:
            - [setMemoryCacheProvider, ['@oro_pricing.provider.product_price.cache']]
            - [setProductPriceCriteriaDataExtractor, ['@oro_pricing.product_price_criteria_data_extractor']]
            - [setPriceByMatchingCriteriaProvider, ['@oro_pricing.provider.product_price_by_matching_criteria']]

    Oro\Bundle\PricingBundle\Provider\ProductPriceProviderInterface:
        alias: 'oro_pricing.provider.product_price'

    oro_pricing.provider.product_price.cache:
        parent: oro.cache.provider.memory_cache

    oro_pricing.provider.combined_price_list:
        class: 'Oro\Bundle\PricingBundle\Provider\CombinedPriceListProvider'
        public: true
        arguments:
            - '@doctrine'
            - '@event_dispatcher'
            - '@oro_pricing.pricing_strategy.strategy_register'
            - '@oro_pricing.shard_manager'

    oro_pricing.provider.dependent_price_lists:
        class: Oro\Bundle\PricingBundle\Provider\DependentPriceListProvider
        arguments:
            - '@oro_pricing.price_rule_lexeme_trigger_handler'

    oro_pricing.provider.price_list_collection:
        class: 'Oro\Bundle\PricingBundle\Provider\PriceListCollectionProvider'
        public: false
        arguments:
            - '@doctrine'
            - '@oro_config.global'
            - '@oro_pricing.system_config_converter'

    oro_pricing.virtual_relation_provider.product:
        class: 'Oro\Bundle\PricingBundle\Provider\ProductVirtualRelationProvider'
        arguments:
            - '@oro_entity.doctrine_helper'
        tags:
            - { name: oro_entity.virtual_relation_provider, priority: -120 }

    oro_pricing.provider.frontend_product_prices:
        class: 'Oro\Bundle\PricingBundle\Provider\FrontendProductPricesDataProvider'
        arguments:
            - '@oro_pricing.provider.product_price'
            - '@oro_pricing.user_currency_manager'
            - '@oro_pricing.model.product_price_scope_criteria_request_handler'
        calls:
            - ['setProductPriceCriteriaFactory', ['@oro_pricing.product_price_criteria_factory']]

    Oro\Bundle\PricingBundle\Provider\FrontendProductPricesDataProvider:
        alias: oro_pricing.provider.frontend_product_prices

    oro_pricing.orm.query_executor_provider:
        class: Oro\Bundle\PricingBundle\ORM\QueryExecutorProvider
        arguments:
            - '@doctrine'
            - '@oro_pricing.orm.insert_from_select_query_executor'
            - '@oro_pricing.orm.multi_insert_shard_query_executor'

    oro_pricing.pricing_strategy.abstract_price_combining_strategy:
        class: 'Oro\Bundle\PricingBundle\PricingStrategy\AbstractPriceCombiningStrategy'
        abstract: true
        public: false
        arguments:
            - '@doctrine'
            - '@oro_pricing.orm.query_executor_provider'

    oro_pricing.pricing_strategy.merge_price_combining_strategy:
        class: Oro\Bundle\PricingBundle\PricingStrategy\MergePricesCombiningStrategy
        parent: oro_pricing.pricing_strategy.abstract_price_combining_strategy
        calls:
            - ['setTempTableManipulator', ['@oro_pricing.orm.temp_table_manipulator']]
        tags:
            - { name: oro_pricing.price_strategy, alias: merge_by_priority }

    oro_pricing.pricing_strategy.minimal_prices_combining_strategy:
        class: Oro\Bundle\PricingBundle\PricingStrategy\MinimalPricesCombiningStrategy
        parent: oro_pricing.pricing_strategy.abstract_price_combining_strategy
        arguments:
            - '@oro_pricing.shard_manager'
        tags:
            - { name: oro_pricing.price_strategy, alias: minimal_prices }

    oro_pricing.resolver.combined_product_schedule_resolver:
        class: Oro\Bundle\PricingBundle\Resolver\CombinedPriceListScheduleResolver
        arguments:
            - '@doctrine'
            - '@oro_config.global'
            - '@oro_pricing.model.combined_price_list_trigger_handler'
        calls:
            - [addRelationClass, ['Oro\Bundle\PricingBundle\Entity\CombinedPriceListToCustomer']]
            - [addRelationClass, ['Oro\Bundle\PricingBundle\Entity\CombinedPriceListToCustomerGroup']]
            - [addRelationClass, ['Oro\Bundle\PricingBundle\Entity\CombinedPriceListToWebsite']]

    oro_pricing.resolver.active_combined_price_list:
        class: Oro\Bundle\PricingBundle\Resolver\ActiveCombinedPriceListResolver
        arguments:
            - '@doctrine'
            - '@oro_pricing.resolver.combined_product_schedule_resolver'

    oro_pricing.builder.combined_price_list_garbage_collector:
        class: 'Oro\Bundle\PricingBundle\Builder\CombinedPriceListGarbageCollector'
        arguments:
            - '@doctrine'
            - '@oro_config.global'
            - '@oro_pricing.model.combined_price_list_trigger_handler'
            - '@oro_entity.orm.native_query_executor_helper'
            - '@logger'

    oro_pricing.builder.combined_price_list_builder_facade:
        class: Oro\Bundle\PricingBundle\Builder\CombinedPriceListsBuilderFacade
        public: true
        arguments:
            - '@event_dispatcher'
            - '@oro_pricing.pricing_strategy.strategy_register'
            - '@oro_pricing.model.combined_price_list_trigger_handler'

    oro_pricing.builder.combined_price_list_activation_plan_builder:
        class: 'Oro\Bundle\PricingBundle\Builder\CombinedPriceListActivationPlanBuilder'
        public: false
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_pricing.resolver.price_list_schedule_resolver'
            - '@oro_pricing.provider.combined_price_list'
            - '@oro_pricing.combined_price_list_relation_helper'

    oro_pricing.resolver.price_list_schedule_resolver:
        class: Oro\Bundle\PricingBundle\Resolver\PriceListScheduleResolver
        public: false

    oro_pricing.validator.unique_product_prices:
        class: 'Oro\Bundle\PricingBundle\Validator\Constraints\UniqueProductPricesValidator'
        tags:
            - { name: validator.constraint_validator, alias: oro_pricing_unique_product_prices_validator }

    oro_pricing.event_listener.form_view:
        class: 'Oro\Bundle\PricingBundle\EventListener\FormViewListener'
        arguments:
            - '@translator'
            - '@oro_entity.doctrine_helper'
            - '@oro_pricing.providers.price_attribute_prices'
            - '@security.authorization_checker'
            - '@oro_security.acl_helper'
        calls:
            - [setFieldAclHelper, ['@oro_security.form.field_acl_helper']]
        tags:
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.product-view, method: onProductView }
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.product-edit, method: onProductEdit }
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.product-create-step-two, method: onProductEdit }
            - { name: oro_featuretogle.feature, feature: oro_price_lists }

    oro_pricing.event_listener.customer_form_view:
        class: 'Oro\Bundle\PricingBundle\EventListener\CustomerFormViewListener'
        arguments:
            - '@request_stack'
            - '@translator'
            - '@oro_entity.doctrine_helper'
            - '@oro_website.website.provider'
        tags:
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.customer-view, method: onCustomerView }
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.customer-edit, method: onEntityEdit }
            - { name: oro_featuretogle.feature, feature: oro_price_lists }

    oro_pricing.event_listener.customer_group_form_view:
        class: 'Oro\Bundle\PricingBundle\EventListener\CustomerGroupFormViewListener'
        arguments:
            - '@request_stack'
            - '@translator'
            - '@oro_entity.doctrine_helper'
            - '@oro_website.website.provider'
        tags:
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.customer-group-view, method: onCustomerGroupView }
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.customer-group-edit, method: onEntityEdit }
            - { name: oro_featuretogle.feature, feature: oro_price_lists }

    oro_pricing.pricing_feature_voter:
        class: Oro\Bundle\PricingBundle\Feature\PricingStorageVoter
        arguments:
            - '@oro_config.global'
        tags:
            - { name: oro_featuretogle.voter }

    oro_pricing.event_listener.system_config.default_price_list:
        class: Oro\Bundle\ConfigBundle\EventListener\EntitySystemConfigListener
        arguments:
            - '@doctrine'
            - 'Oro\Bundle\PricingBundle\Entity\PriceList'
            - 'oro_pricing.default_price_list'
        tags:
            - { name: kernel.event_listener, event: oro_config.settings_form_preset, method: onFormPreSetData }
            - { name: kernel.event_listener, event: oro_config.settings_before_save, method: onSettingsSaveBefore }

    oro_pricing.event_listener.update_flat_price_list_system_config:
        class: Oro\Bundle\PricingBundle\EventListener\UpdateFlatPriceListSystemConfigListener
        arguments:
            - '@doctrine'
            - '@oro_pricing.price_list_relation_trigger_handler.flat'
        tags:
            - { name: kernel.event_listener, event: oro_config.update_after, method: onUpdateAfter }

    oro_pricing.event_listener.price_calculation_precision_system_config_listener:
        class: 'Oro\Bundle\PricingBundle\EventListener\PriceCalculationPrecisionSystemConfigListener'
        arguments:
            - '@doctrine'
            - '@oro_pricing.cache.rule_cache'
            - '@session'
            - '@translator'
        tags:
            - { name: kernel.event_listener, event: oro_config.update_after, method: updateAfter }

    oro_pricing.price_list_relation_trigger_handler.combined:
        class: 'Oro\Bundle\PricingBundle\Model\CombinedPriceListRelationTriggerHandler'
        arguments:
            - '@oro_message_queue.client.message_producer'
            - '@doctrine'
            - '@oro_config.manager'
            - '@event_dispatcher'

    oro_pricing.price_list_relation_trigger_handler.flat:
        class: 'Oro\Bundle\PricingBundle\Model\FlatPriceListRelationTriggerHandler'
        arguments:
            - '@oro_website.website.provider'
            - '@event_dispatcher'
            - '@oro_config.manager'

    oro_pricing.price_list_relation_trigger_handler:
        class: 'Oro\Bundle\PricingBundle\Model\PriceListRelationTriggerHandler'
        public: true
        arguments:
            - '@oro_pricing.price_list_relation_trigger_handler.combined'
            - '@oro_pricing.price_list_relation_trigger_handler.flat'
        tags:
            - { name: oro_featuretogle.feature, feature: oro_price_lists_flat }

    oro_pricing.async.message_filter.price_list:
        class: 'Oro\Bundle\PricingBundle\Async\PriceListMessageFilter'
        arguments:
            -
                - !php/const Oro\Bundle\PricingBundle\Async\Topic\ResolvePriceRulesTopic::NAME
                - !php/const Oro\Bundle\PricingBundle\Async\Topic\ResolvePriceListAssignedProductsTopic::NAME
                - !php/const Oro\Bundle\PricingBundle\Async\Topic\ResolveCombinedPriceByPriceListTopic::NAME
                - !php/const Oro\Bundle\PricingBundle\Async\Topic\ResolveCombinedPriceListCurrenciesTopic::NAME
        tags:
            - { name: oro_message_queue.message_filter }

    oro_pricing.async.message_filter.price_list_relation:
        class: 'Oro\Bundle\PricingBundle\Async\PriceListRelationMessageFilter'
        arguments:
            - '@doctrine'
        tags:
            - { name: oro_message_queue.message_filter, topic: !php/const Oro\Bundle\PricingBundle\Async\Topic\RebuildCombinedPriceListsTopic::NAME }

    oro_pricing.price_list_trigger_handler:
        class: 'Oro\Bundle\PricingBundle\Model\PriceListTriggerHandler'
        arguments:
            - '@oro_message_queue.client.message_producer'

    oro_pricing.price_rule_lexeme_trigger_handler:
        class: Oro\Bundle\PricingBundle\Model\PriceRuleLexemeTriggerHandler
        arguments:
            - '@oro_pricing.price_list_trigger_handler'
            - '@doctrine'

    oro_pricing.event_listener.customer_customers_grid:
        class: 'Oro\Bundle\PricingBundle\EventListener\CustomerDataGridListener'
        arguments:
            - '@doctrine'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.customer-customers-grid, method: onBuildBefore }
            - { name: kernel.event_listener, event: oro_datagrid.orm_datasource.result.after.customer-customers-grid, method: onResultAfter }
            - { name: oro_featuretogle.feature, feature: oro_price_lists }

    oro_pricing.event_listener.customer_groups_grid:
        class: 'Oro\Bundle\PricingBundle\EventListener\CustomerGroupDataGridListener'
        arguments:
            - '@doctrine'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.customer-groups-grid, method: onBuildBefore }
            - { name: kernel.event_listener, event: oro_datagrid.orm_datasource.result.after.customer-groups-grid, method: onResultAfter }
            - { name: oro_featuretogle.feature, feature: oro_price_lists }

    oro_pricing.event_listener.price_list_datagrid:
        class: 'Oro\Bundle\PricingBundle\EventListener\PriceListDatagridListener'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.pricing-price-list-select-grid, method: onBuildBefore }

    oro_pricing.event_listener.frontend.product_price_datagrid:
        class: 'Oro\Bundle\PricingBundle\EventListener\FrontendProductPriceDatagridListener'
        arguments:
            - '@oro_pricing.model.product_price_scope_criteria_request_handler'
            - '@oro_pricing.user_currency_manager'
            - '@oro_pricing.datagrid.provider.product_price'
            - '@translator'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.frontend-product-search-grid, method: onBuildBefore }
            - { name: kernel.event_listener, event: oro_datagrid.search_datasource.result.after.frontend-product-search-grid, method: onResultAfter }
            - { name: oro_featuretogle.feature, feature: oro_pricing }

    oro_pricing.validator.product_price_allowed_units:
        class: 'Oro\Bundle\PricingBundle\Validator\Constraints\ProductPriceAllowedUnitsValidator'
        tags:
            - { name: validator.constraint_validator, alias: oro_pricing_product_price_allowed_units_validator }

    oro_pricing.validator.product_price_currency:
        class: 'Oro\Bundle\PricingBundle\Validator\Constraints\ProductPriceCurrencyValidator'
        tags:
            - { name: validator.constraint_validator, alias: oro_pricing_product_price_currency_validator }

    oro_pricing.validator.unique_entity:
        class: 'Oro\Bundle\PricingBundle\Validator\Constraints\UniqueEntityValidator'
        arguments:
           - '@doctrine'
           - '@oro_pricing.shard_manager'
        tags:
            - { name: validator.constraint_validator }

    oro_pricing.validator.price_list_product_prices_currency:
        class: 'Oro\Bundle\PricingBundle\Validator\Constraints\PriceListProductPricesCurrencyValidator'
        arguments:
            - '@doctrine'
            - '@oro_pricing.shard_manager'
        tags:
            - { name: validator.constraint_validator, alias: oro_pricing_price_list_product_prices_currency_validator }

    oro_pricing.model.price_list_request_handler:
        class: 'Oro\Bundle\PricingBundle\Model\PriceListRequestHandler'
        public: true
        arguments:
            - '@request_stack'
            - '@doctrine'
            - '@oro_security.acl_helper'

    Oro\Bundle\PricingBundle\Model\PriceListRequestHandlerInterface:
        alias: oro_pricing.model.price_list_request_handler

    oro_pricing.model.product_price_scope_criteria_factory:
        class: 'Oro\Bundle\PricingBundle\Model\ProductPriceScopeCriteriaFactory'

    oro_pricing.model.product_price_scope_criteria_request_handler:
        class: 'Oro\Bundle\PricingBundle\Model\ProductPriceScopeCriteriaRequestHandler'
        public: true
        arguments:
            - '@request_stack'
            - '@oro_security.token_accessor'
            - '@doctrine'
            - '@oro_customer.provider.customer_user_relations_provider'
            - '@oro_website.manager'
            - '@security.authorization_checker'
            - '@oro_pricing.model.product_price_scope_criteria_factory'

    Oro\Bundle\PricingBundle\Model\ProductPriceScopeCriteriaRequestHandler:
        alias: 'oro_pricing.model.product_price_scope_criteria_request_handler'
        public: true

    oro_pricing.model.price_list_tree_handler.abstract:
        class: 'Oro\Bundle\PricingBundle\Model\AbstractPriceListTreeHandler'
        abstract: true
        arguments:
            - '@doctrine'
            - '@oro_website.manager'
            - '@oro_config.manager'

    oro_pricing.model.price_list_tree_handler:
        class: 'Oro\Bundle\PricingBundle\Model\CombinedPriceListTreeHandler'
        parent: oro_pricing.model.price_list_tree_handler.abstract

    oro_pricing.model.flat_price_list_tree_handler:
        class: 'Oro\Bundle\PricingBundle\Model\FlatPriceListTreeHandler'
        parent: oro_pricing.model.price_list_tree_handler.abstract

    oro_pricing.model.assign_user_currency:
        class: 'Oro\Bundle\PricingBundle\Model\AssignUserCurrencyAction'
        arguments:
            - '@oro_action.expression.context_accessor'
            - '@oro_pricing.user_currency_manager'
        tags:
            - { name: oro_action.action, alias: assign_user_currency }

    oro_pricing.combined_price_list_relation_helper:
        class: Oro\Bundle\PricingBundle\Model\CombinedPriceListRelationHelper
        public: false
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_config.manager'

    oro_pricing.filter.price_attribute_product_price:
        class: 'Oro\Bundle\PricingBundle\Filter\ProductPriceFilter'
        public: false
        arguments:
            - '@form.factory'
            - '@oro_filter.filter_utility'
            - '@oro_product.formatter.product_unit_label'
            - '@oro_pricing.model.price_list_request_handler'
        calls:
            - [setProductPriceClass, ['Oro\Bundle\PricingBundle\Entity\PriceAttributeProductPrice']]
        tags:
            - { name: oro_filter.extension.orm_filter.filter, type: price-attribute-product-price }

    oro_pricing.filter.product_price:
        class: 'Oro\Bundle\PricingBundle\Filter\ProductPriceFilter'
        public: false
        arguments:
            - '@form.factory'
            - '@oro_filter.filter_utility'
            - '@oro_product.formatter.product_unit_label'
            - '@oro_pricing.model.price_list_request_handler'
        calls:
            - [setProductPriceClass, ['Oro\Bundle\PricingBundle\Entity\ProductPrice']]
        tags:
            - { name: oro_filter.extension.orm_filter.filter, type: product-price }

    oro_pricing.filter.product_price_attribute:
        class: 'Oro\Bundle\PricingBundle\Filter\ProductPriceAttributeFilter'
        public: false
        arguments:
            - '@form.factory'
            - '@oro_filter.filter_utility'
            - '@oro_product.formatter.product_unit_label'
        tags:
            - { name: oro_filter.extension.orm_filter.filter, type: product-price-attribute }

    oro_pricing.filter.combined_product_price:
        class: 'Oro\Bundle\PricingBundle\Filter\ProductPriceFilter'
        public: false
        arguments:
            - '@form.factory'
            - '@oro_filter.filter_utility'
            - '@oro_product.formatter.product_unit_label'
            - '@oro_pricing.model.debug_product_price_price_list_request_handler'
        calls:
            - [setProductPriceClass, ['Oro\Bundle\PricingBundle\Entity\CombinedProductPrice']]
        tags:
            - { name: oro_filter.extension.orm_filter.filter, type: combined-product-price }

    oro_pricing.filter.price_lists:
        class: 'Oro\Bundle\PricingBundle\Filter\PriceListsFilter'
        public: false
        arguments:
            - '@form.factory'
            - '@oro_filter.filter_utility'
            - '@doctrine'
        tags:
            - { name: oro_filter.extension.orm_filter.filter, type: price-lists }

    oro_pricing.filter.frontend_product_price:
        class: 'Oro\Bundle\PricingBundle\Filter\FrontendProductPriceFilter'
        public: false
        arguments:
            - '@form.factory'
            - '@oro_filter.filter_utility'
            - '@oro_product.formatter.product_unit_label'
        tags:
            - { name: oro_search.extension.search_filter.filter, type: frontend-product-price }

    oro_pricing.event_listener.product_duplicate:
        class: 'Oro\Bundle\PricingBundle\EventListener\ProductDuplicateListener'
        calls:
            - [setProductPriceClass, ['Oro\Bundle\PricingBundle\Entity\ProductPrice']]
            - [setDoctrineHelper,  ['@oro_entity.doctrine_helper']]
            - [setShardManager, ['@oro_pricing.shard_manager']]
            - [setPriceManager, ['@oro_pricing.manager.price_manager']]
        tags:
            - { name: kernel.event_listener, event: oro_product.product.duplicate.after, method: onDuplicateAfter }
            - { name: oro_featuretogle.feature, feature: oro_price_lists }

    oro_pricing.model.frontend_product_list_modifier:
        class: 'Oro\Bundle\PricingBundle\Model\FrontendProductListModifier'
        public: false
        arguments:
            - '@security.token_storage'
            - '@oro_pricing.model.price_list_tree_handler'
        tags:
            - { name: oro_featuretogle.feature, feature: oro_price_lists_combined }

    oro_pricing.datagrid.extension.product_selection_grid:
        class: 'Oro\Bundle\PricingBundle\Datagrid\ProductSelectionGridExtension'
        public: false
        arguments:
            - '@request_stack'
            - '@security.token_storage'
            - '@oro_pricing.model.frontend_product_list_modifier'
        tags:
            - { name: oro_datagrid.extension }

    oro_pricing.event_listener.product_select_price_list_aware:
        class: 'Oro\Bundle\PricingBundle\EventListener\ProductSelectPriceListAwareListener'
        arguments:
            - '@oro_pricing.model.frontend_product_list_modifier'
            - '@doctrine'
        tags:
            - { name: kernel.event_listener, event: oro_product.product_db_query.restriction, method: onDBQuery }

    oro_pricing.rounding.price_rounding_service:
        class: 'Oro\Bundle\PricingBundle\Rounding\PriceRoundingService'
        decorates: 'oro_currency.rounding.price_rounding_service'
        public: false
        parent: oro_currency.service.abstract_rounding

    oro_pricing.event_listener.system_config:
        class: 'Oro\Bundle\PricingBundle\EventListener\PriceListSystemConfigSubscriber'
        arguments:
            - '@oro_pricing.system_config_converter'
            - '@oro_pricing.price_list_relation_trigger_handler'
        tags:
            - { name: kernel.event_listener, event: oro_config.settings_form_preset, method: formPreSet }
            - { name: kernel.event_listener, event: oro_config.settings_before_save.oro_pricing.default_price_lists, method: beforeSave }
            - { name: kernel.event_listener, event: oro_config.update_after, method: updateAfter }

    oro_pricing.event_listener.price_list:
        class: 'Oro\Bundle\PricingBundle\EventListener\PriceListListener'
        lazy: true
        arguments:
            - '@oro_pricing.builder.combined_price_list_activation_plan_builder'
            - '@oro_pricing.price_list_relation_trigger_handler'
            - '@oro_pricing.handler.price_rule_lexeme_handler'
        tags:
            - { name: kernel.event_listener, event: oro.form.update_handler.before_form_submit.oro_pricing_price_list, method: beforeSubmit }
            - { name: kernel.event_listener, event: oro.form.update_handler.before_entity_flush.oro_pricing_price_list, method: onPostSubmit }
            - { name: kernel.event_listener, event: oro.form.update_handler.after_entity_flush.oro_pricing_price_list, method: afterFlush }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_combined }

    oro_pricing.event_listener.combined_price_list:
        class: 'Oro\Bundle\PricingBundle\EventListener\CombinedPriceListListener'
        lazy: true
        arguments:
            - '@oro_pricing.builder.combined_price_list_activation_plan_builder'
        tags:
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.create, method: onCreate }
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.actualize_schedule, method: onActualizeSchedule }

    oro_pricing.system_config_converter:
        class: 'Oro\Bundle\PricingBundle\SystemConfig\PriceListConfigConverter'
        public: false
        arguments:
            - '@doctrine'
            - 'Oro\Bundle\PricingBundle\Entity\PriceList'

    oro_pricing.validator.price_rule_expressions:
        class: 'Oro\Bundle\PricingBundle\Validator\Constraints\PriceRuleExpressionsValidator'
        arguments:
            - '@oro_pricing.compiler.price_list_rule_compiler'
            - '%kernel.debug%'
        tags:
            - { name: validator.constraint_validator }

    oro_pricing.validator.product_assignment_rule_expression:
        class: 'Oro\Bundle\PricingBundle\Validator\Constraints\ProductAssignmentRuleExpressionValidator'
        arguments:
            - '@oro_pricing.compiler.product_assignment_rule_compiler'
            - '%kernel.debug%'
        tags:
            - { name: validator.constraint_validator }

    oro_pricing.validator.unique_price_list:
        class: 'Oro\Bundle\PricingBundle\Validator\Constraints\UniquePriceListValidator'
        tags:
            - { name: validator.constraint_validator, alias: oro_pricing_unique_price_list_validator }

    oro_pricing.validator.price_for_product_unit_exists:
        class: 'Oro\Bundle\PricingBundle\Validator\Constraints\PriceForProductUnitExistsValidator'
        arguments:
            - '@doctrine'
        tags:
            - { name: validator.constraint_validator, alias: oro_pricing_price_for_product_unit_exists_validator }

    oro_pricing.entity_listener.product_price_cpl:
        class: 'Oro\Bundle\PricingBundle\Entity\EntityListener\ProductPriceCPLEntityListener'
        arguments:
            - '@oro_commerce_entity.extra_insert_entity_storage'
            - '@doctrine'
            - '@oro_pricing.price_list_trigger_handler'
            - '@oro_pricing.shard_manager'
            - '@event_dispatcher'
            - '@oro_pricing.handler.combined_price_list_build_trigger'
        tags:
            - { name: kernel.event_listener, event: oro_pricing.product_price.remove, method: onRemove }
            - { name: kernel.event_listener, event: oro_pricing.product_price.save_after, method: onSave }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_combined }

    oro_pricing.entity_listener.product_price_flat:
        class: 'Oro\Bundle\PricingBundle\Entity\EntityListener\ProductPriceFlatEntityListener'
        arguments:
            - '@event_dispatcher'
        tags:
            - { name: kernel.event_listener, event: oro_pricing.product_price.remove, method: onRemove }
            - { name: kernel.event_listener, event: oro_pricing.product_price.save_after, method: onSave }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_flat }

    oro_pricing.entity_listener.price_list:
        class: 'Oro\Bundle\PricingBundle\Entity\EntityListener\PriceListEntityListener'
        public: false
        arguments:
            - '@oro_pricing.price_list_relation_trigger_handler'
            - '@oro_pricing.cache.rule_cache'
            - '@oro_pricing.price_list_trigger_handler'
            - '@oro_pricing.price_rule_lexeme_trigger_handler'
        tags:
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceList', event: preUpdate }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceList', event: preRemove }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceList', event: postPersist }

    oro_pricing.entity_listener.price_list_currency:
        class: 'Oro\Bundle\PricingBundle\Entity\EntityListener\PriceListCurrencyEntityListener'
        arguments:
            - '@oro_pricing.cache.rule_cache'
            - '@oro_pricing.price_list_trigger_handler'
        tags:
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceListCurrency', event: preRemove }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceListCurrency', event: postPersist }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_combined }

    oro_pricing.entity_listener.price_rule:
        class: 'Oro\Bundle\PricingBundle\Entity\EntityListener\PriceRuleEntityListener'
        public: false
        arguments:
            - '@oro_pricing.cache.rule_cache'
            - '@oro_pricing.price_list_trigger_handler'
        tags:
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceRule', event: preUpdate }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceRule', event: preRemove }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceRule', event: postPersist }

    oro_pricing.entity_listener.price_rule_lexeme:
        class: 'Oro\Bundle\PricingBundle\Entity\EntityListener\PriceRuleLexemeEntityListener'
        public: false
        tags:
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceRuleLexeme', event: postPersist }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceRuleLexeme', event: postUpdate }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceRuleLexeme', event: postRemove }

    oro_pricing.entity_listener.abstract_rule_listener:
        class: 'Oro\Bundle\PricingBundle\Entity\EntityListener\AbstractRuleEntityListener'
        abstract: true
        arguments:
            - '@oro_pricing.price_rule_lexeme_trigger_handler'
            - '@oro_product.expression.fields_provider'
            - '@doctrine'

    oro_pricing.entity_listener.category:
        class: 'Oro\Bundle\PricingBundle\Entity\EntityListener\CategoryEntityListener'
        parent: oro_pricing.entity_listener.abstract_rule_listener
        public: false
        tags:
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\CatalogBundle\Entity\Category', event: preUpdate }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\CatalogBundle\Entity\Category', event: preRemove }
            - { name: oro_featuretogle.feature, feature: oro_price_lists }

    oro_pricing.event_listener.category:
        class: 'Oro\Bundle\PricingBundle\Entity\EntityListener\CategoryEntityListener'
        parent: oro_pricing.entity_listener.abstract_rule_listener
        tags:
            - { name: kernel.event_listener, event: oro_catalog.event.products_change_relation, method: onProductsChangeRelation }
            - { name: oro_featuretogle.feature, feature: oro_price_lists }

    oro_pricing.entity_listener.product:
        class: 'Oro\Bundle\PricingBundle\Entity\EntityListener\ProductEntityListener'
        public: false
        parent: oro_pricing.entity_listener.abstract_rule_listener
        tags:
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\ProductBundle\Entity\Product', event: postPersist }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\ProductBundle\Entity\Product', event: preUpdate }
            - { name: oro_featuretogle.feature, feature: oro_price_lists }

    oro_pricing.entity_listener.price_attribute_product_price:
        class: 'Oro\Bundle\PricingBundle\Entity\EntityListener\PriceAttributeProductPriceEntityListener'
        parent: oro_pricing.entity_listener.abstract_rule_listener
        public: false
        tags:
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceAttributeProductPrice', event: postPersist }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceAttributeProductPrice', event: preUpdate }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceAttributeProductPrice', event: preRemove }
            - { name: oro_featuretogle.feature, feature: oro_price_lists }

    oro_pricing.entity_listener.product_price:
        class: 'Oro\Bundle\PricingBundle\Entity\EntityListener\ProductPriceEntityListener'
        parent: oro_pricing.entity_listener.abstract_rule_listener
        tags:
            - { name: kernel.event_listener, event: oro_pricing.product_price.remove, method: onRemove }
            - { name: kernel.event_listener, event: oro_pricing.product_price.save_after, method: onSave }

    oro_pricing.entity_listener.send_changed_product_prices_to_message_queue:
        class: 'Oro\Bundle\PricingBundle\Entity\EntityListener\SendChangedProductPricesToMessageQueueListener'
        arguments:
            - '@oro_message_queue.message_producer'
            - '@security.token_storage'
            - '@oro_dataaudit.converter.entity_to_entity_change_array'
            - '@oro_dataaudit.audit_config_provider'
            - '@oro_entity.entity_name_resolver'
            - '@oro_dataaudit.provider.audit_message_body_provider'
            - '@property_accessor'
            - '@logger'
            - '@oro_distribution.handler.application_status'
        tags:
            - { name: kernel.event_listener, event: oro_pricing.product_price.save_after, method: onSave }
            - { name: kernel.event_listener, event: oro_pricing.product_price.remove, method: onRemove }
            - { name: kernel.event_listener, event: oro_pricing.product_prices.updated_after, method: onUpdated }
            - { name: monolog.logger, channel: oro_pricing }

    oro_pricing.entity_listener.price_list_to_product:
        class: Oro\Bundle\PricingBundle\Entity\EntityListener\PriceListToProductEntityListener
        arguments:
            - '@oro_pricing.price_list_trigger_handler'
            - '@oro_pricing.price_rule_lexeme_trigger_handler'
            - '@oro_pricing.shard_manager'
        tags:
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceListToProduct', event: postPersist }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceListToProduct', event: preUpdate }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceListToProduct', event: postRemove }
            - { name: kernel.event_listener, event: oro_pricing.assignment_rule_builder.build, method: onAssignmentRuleBuilderBuild}
            - { name: kernel.event_listener, event: oro_pricing.price_list_to_product.save_after, method: onPriceListToProductSave }

    oro_pricing.migration.demo_data_fixtures_listener.build_prices:
        parent: oro_platform.event_listener.demo_data_fixtures_listener.abstract
        class: Oro\Bundle\PricingBundle\EventListener\BuildPricesDemoDataFixturesListener
        arguments:
            - '@oro_pricing.builder.combined_price_list_builder_facade'
            - '@oro_pricing.builder.product_price_builder'
            - '@oro_pricing.builder.price_list_product_assignment_builder'
            - '@oro_pricing.combined_price_list_associations_provider'
            - '@oro_pricing.provider.combined_price_list'
        calls:
            - [disableListener, ['oro_pricing.entity_listener.product_price_cpl']]
            - [disableListener, ['oro_pricing.entity_listener.price_list_to_product']]
            - [disableListener, ['oro_pricing.entity_listener.price_list_currency']]
            - [disableListener, ['oro_pricing.entity_listener.send_changed_product_prices_to_message_queue']]
            - [disableListener, ['oro_pricing.entity_listener.organization_listener']]
        tags:
            - { name: kernel.event_listener, event: oro_migration.data_fixtures.pre_load, method: onPreLoad }
            - { name: kernel.event_listener, event: oro_migration.data_fixtures.post_load, method: onPostLoad }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_combined }

    oro_pricing.provider.matching_price:
        class: 'Oro\Bundle\PricingBundle\Provider\MatchingPriceProvider'
        public: true
        arguments:
            - '@oro_pricing.provider.product_price'
            - '@oro_entity.doctrine_helper'
            - 'Oro\Bundle\ProductBundle\Entity\Product'
            - 'Oro\Bundle\ProductBundle\Entity\ProductUnit'
        calls:
            - [ 'setProductPriceCriteriaFactory', [ '@oro_pricing.product_price_criteria_factory' ] ]

    Oro\Bundle\PricingBundle\Provider\MatchingPriceProvider:
        alias: 'oro_pricing.provider.matching_price'

    oro_pricing.subtotal_processor.subtotal_provider_registry:
        class: 'Oro\Bundle\PricingBundle\SubtotalProcessor\SubtotalProviderRegistry'
        public: false
        arguments:
            - !abstract '$providerNames defined in Oro\Bundle\PricingBundle\DependencyInjection\CompilerPass\SubtotalProviderPass'
            - !abstract '$providerContainer defined in Oro\Bundle\PricingBundle\DependencyInjection\CompilerPass\SubtotalProviderPass'

    oro_pricing.subtotal_processor.total_processor_provider:
        class: 'Oro\Bundle\PricingBundle\SubtotalProcessor\TotalProcessorProvider'
        arguments:
            - '@oro_pricing.subtotal_processor.subtotal_provider_registry'
            - '@translator'
            - '@oro_currency.rounding.price_rounding_service'
            - '@oro_pricing.subtotal_processor.provider.arguments'

    Oro\Bundle\PricingBundle\SubtotalProcessor\TotalProcessorProvider:
        alias: oro_pricing.subtotal_processor.total_processor_provider

    oro_pricing.subtotal_processor.provider.subtotal_line_item:
        class: 'Oro\Bundle\PricingBundle\SubtotalProcessor\Provider\LineItemSubtotalProvider'
        arguments:
            - '@translator'
            - '@oro_currency.rounding.price_rounding_service'
            - '@oro_pricing.subtotal_processor.provider.arguments'
        tags:
            - { name: oro_pricing.subtotal_provider, alias: oro.pricing.subtotals.subtotal }

    Oro\Bundle\PricingBundle\SubtotalProcessor\Provider\LineItemSubtotalProvider:
        alias: oro_pricing.subtotal_processor.provider.subtotal_line_item

    oro_pricing.subtotal_processor.provider.arguments:
        class: Oro\Bundle\PricingBundle\SubtotalProcessor\Provider\SubtotalProviderConstructorArguments
        arguments:
            - '@oro_pricing.user_currency_manager'
            - '@oro_pricing.provider.website_currency_provider'

    oro_pricing.subtotal_processor.provider.subtotal_line_item_not_priced:
        class: 'Oro\Bundle\PricingBundle\SubtotalProcessor\Provider\LineItemNotPricedSubtotalProvider'
        arguments:
            - '@translator'
            - '@oro_currency.rounding.price_rounding_service'
            - '@oro_pricing.provider.product_price'
            - '@oro_pricing.subtotal_processor.provider.arguments'
            - '@oro_pricing.model.product_price_scope_criteria_factory'
        calls:
            - ['setProductLineItemsPriceProvider', ['@oro_pricing.provider.product_line_item_price']]
        tags:
            - { name: oro_pricing.subtotal_provider, alias: oro.pricing.subtotals.not_priced_subtotal, priority: 0 }

    oro_pricing.price_list_with_priority_collection.handler:
        class: 'Oro\Bundle\PricingBundle\Form\PriceListWithPriorityCollectionHandler'
        public: false
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@property_accessor'

    oro_pricing.entity_listener.price_list_collection_aware.abstract:
        class: Oro\Bundle\PricingBundle\EventListener\AbstractPriceListCollectionAwareListener
        abstract: true
        arguments:
            - '@oro_pricing.price_list_with_priority_collection.handler'
            - '@oro_entity.doctrine_helper'
            - '@oro_pricing.price_list_relation_trigger_handler'
            - '@event_dispatcher'

    oro_pricing.entity_listener.customer_group:
        class: 'Oro\Bundle\PricingBundle\EventListener\CustomerGroupListener'
        parent: oro_pricing.entity_listener.price_list_collection_aware.abstract
        tags:
            - { name: kernel.event_listener, event: oro_customer.customer_group.before_flush, method: onPostSubmit }
            - { name: kernel.event_listener, event: oro_customer.customer_group.pre_remove, method: onGroupRemove }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_combined }

    oro_pricing.entity_listener.customer:
        class: 'Oro\Bundle\PricingBundle\EventListener\CustomerListener'
        parent: oro_pricing.entity_listener.price_list_collection_aware.abstract
        tags:
            - { name: kernel.event_listener, event: oro.form.update_handler.before_entity_flush.oro_customer_type, method: onPostSubmit }
            - { name: kernel.event_listener, event: oro_customer.customer.on_customer_group_change, method: onCustomerGroupChange }
            - { name: kernel.event_listener, event: oro_customer.customer.on_customer_group_mass_change, method: onCustomerGroupMassChange }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_combined }

    oro_pricing.entity_listener.customer.flat_pricing:
        class: 'Oro\Bundle\PricingBundle\EventListener\CustomerFlatPricingRelationFormListener'
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_pricing.price_list_relation_trigger_handler'
        tags:
            - { name: kernel.event_listener, event: oro.form.update_handler.before_entity_flush.oro_customer_type, method: onPostSubmit }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_flat }

    oro_pricing.entity_listener.customer_group.flat_pricing:
        class: 'Oro\Bundle\PricingBundle\EventListener\CustomerGroupFlatPricingRelationFormListener'
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_pricing.price_list_relation_trigger_handler'
        tags:
            - { name: kernel.event_listener, event: oro_customer.customer_group.before_flush, method: onPostSubmit }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_flat }

    oro_pricing.entity_listener.product_form:
        class: 'Oro\Bundle\PricingBundle\EventListener\ProductFormListener'
        arguments:
            - '@oro_pricing.manager.price_manager'
        tags:
            - { name: kernel.event_listener, event: oro.form.update_handler.before_entity_flush.oro_product, method: onBeforeFlush }
            - { name: oro_featuretogle.feature, feature: oro_price_lists }

    Oro\Bundle\PricingBundle\SubtotalProcessor\Handler\RequestHandler:
        alias: oro_pricing.subtotal_processor.handler.request_handler

    oro_pricing.subtotal_processor.handler.request_handler:
        class: 'Oro\Bundle\PricingBundle\SubtotalProcessor\Handler\RequestHandler'
        public: true
        arguments:
            - '@oro_pricing.subtotal_processor.total_processor_provider'
            - '@event_dispatcher'
            - '@security.authorization_checker'
            - '@oro_entity.routing_helper'
            - '@doctrine'

    oro_pricing.formatter.product_price_formatter:
        class: 'Oro\Bundle\PricingBundle\Formatter\ProductPriceFormatter'
        arguments:
            - '@oro_locale.formatter.number'
            - '@oro_product.formatter.product_unit_label'
            - '@oro_product.formatter.product_unit_value'

    Oro\Bundle\PricingBundle\Formatter\ProductPriceFormatter:
        alias: oro_pricing.formatter.product_price_formatter

    oro_pricing.duplicator.schedule:
        class: 'Oro\Bundle\PricingBundle\Duplicator\ScheduleDuplicator'
        public: true

    oro_pricing.duplicator.product_price_duplicator:
        class: 'Oro\Bundle\PricingBundle\Duplicator\ProductPriceDuplicator'
        public: true
        arguments:
            - '@doctrine'
            - '@oro_pricing.orm.insert_from_select_query_executor'
        calls:
            - [setPriceListClass, ['Oro\Bundle\PricingBundle\Entity\ProductPrice']]

    oro_pricing.compiler.abstract_rule_compiler:
        class: 'Oro\Bundle\PricingBundle\Compiler\AbstractRuleCompiler'
        abstract: true
        arguments:
            - '@oro_product.expression.parser'
            - '@oro_product.expression.preprocessor'
            - '@oro_product.expression.node_to_query_designer_converter'
            - '@oro_product.expression.query_converter'
            - '@oro_product.expression.query_expression_builder'
            - '@oro_pricing.cache.rule_cache'

    oro_pricing.compiler.price_list_rule_compiler:
        class: 'Oro\Bundle\PricingBundle\Compiler\PriceListRuleCompiler'
        parent: oro_pricing.compiler.abstract_rule_compiler
        calls:
            - [setFieldsProvider, ['@oro_product.expression.fields_provider']]
            - [setConfigManager, ['@oro_config.manager']]

    oro_pricing.compiler.product_assignment_rule_compiler:
        class: 'Oro\Bundle\PricingBundle\Compiler\ProductAssignmentRuleCompiler'
        parent: oro_pricing.compiler.abstract_rule_compiler

    oro_pricing.builder.product_price_builder:
        class: 'Oro\Bundle\PricingBundle\Builder\ProductPriceBuilder'
        shared: false
        arguments:
            - '@doctrine'
            - '@oro_pricing.orm.insert_from_select_query_executor'
            - '@oro_pricing.compiler.price_list_rule_compiler'
            - '@oro_pricing.price_list_trigger_handler'
            - '@oro_pricing.shard_manager'
            - '@oro_pricing.handler.combined_price_list_build_trigger'
        tags:
            - { name: oro_featuretogle.feature, feature: oro_price_lists_combined }

    oro_pricing.builder.price_list_product_assignment_builder:
        class: 'Oro\Bundle\PricingBundle\Builder\PriceListProductAssignmentBuilder'
        shared: false
        arguments:
            - '@doctrine'
            - '@oro_entity.orm.insert_from_select_query_executor'
            - '@oro_pricing.compiler.product_assignment_rule_compiler'
            - '@event_dispatcher'
            - '@oro_pricing.shard_manager'

    oro_pricing.expression.query_expression.converter.assigned_products:
        class: Oro\Bundle\PricingBundle\Expression\QueryExpressionConverter\AssignedProductsConverter
        arguments:
            - '@oro_product.expression.fields_provider'
        public: false

    oro_pricing.expression.preprocessor.product_assignment_rule:
        class: Oro\Bundle\PricingBundle\Expression\Preprocessor\ProductAssignmentRuleExpressionPreprocessor
        arguments:
            - '@doctrine'
        public: false

    oro_pricing.expression.column_information.price_list_provider:
        class: Oro\Bundle\PricingBundle\Expression\ColumnInformation\PriceListProvider

    oro_pricing.expression.price_list_query_converter_extension:
        class: Oro\Bundle\PricingBundle\Expression\PriceListQueryConverterExtension

    oro_pricing.validator_constraints.lexeme_circular_reference_validator:
        class: 'Oro\Bundle\PricingBundle\Validator\Constraints\LexemeCircularReferenceValidator'
        public: true
        arguments:
            - '@oro_product.expression.parser'
            - '@doctrine'
            - '@property_accessor'
        tags:
            - { name: validator.constraint_validator, alias: oro_pricing.validator_constraints.lexeme_circular_reference_validator }

    oro_pricing.validator_constraints.price_rule_relation_expressions_validator:
        class: 'Oro\Bundle\PricingBundle\Validator\Constraints\PriceRuleRelationExpressionsValidator'
        arguments:
            - '@oro_product.expression.parser'
            - '@oro_product.expression.fields_provider'
            - '@translator'
        tags:
            - { name: validator.constraint_validator, alias: oro_pricing.validator_constraints.price_rule_relation_expressions_validator }

    oro_pricing.action.price_list_background_recalculate:
        class: Oro\Bundle\PricingBundle\Action\PriceListBackgroundRecalculateAction
        arguments:
            - '@oro_action.expression.context_accessor'
            - '@oro_pricing.builder.price_list_product_assignment_builder'
            - '@oro_pricing.builder.product_price_builder'
            - '@oro_pricing.provider.dependent_price_lists'
            - '@oro_entity.doctrine_helper'
        tags:
            - { name: oro_action.action, alias: price_list_recalculate }

    oro_pricing.handler.price_rule_lexeme_handler:
        class: 'Oro\Bundle\PricingBundle\Handler\PriceRuleLexemeHandler'
        public: true
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_product.expression.parser'
            - '@oro_product.expression.fields_provider'

    oro_pricing.cache.rule_cache.storage:
        public: false
        parent: oro.data.cache
        tags:
            - { name: 'cache.pool', namespace: 'oro_pricing_rule_cache' }

    oro_pricing.cache.rule_cache:
        class: 'Oro\Bundle\PricingBundle\Cache\RuleCache'
        public: false
        arguments:
            - '@oro_pricing.cache.rule_cache.storage'
            - '@doctrine'
            - '@oro_security.encoder.default'

    oro_pricing.duplicator.price_list_to_product_duplicator:
        class: 'Oro\Bundle\PricingBundle\Duplicator\PriceListToProductDuplicator'
        public: true
        arguments:
            - '@doctrine'
            - '@oro_entity.orm.insert_from_select_query_executor'
        calls:
            - [setEntityName, ['Oro\Bundle\PricingBundle\Entity\PriceListToProduct']]

    oro_pricing.event.combined_price_list.association.collect_event_factory:
        class: Oro\Bundle\PricingBundle\Event\CombinedPriceList\Assignment\CollectEventFactory

    oro_pricing.combined_price_list_associations_provider:
        class: Oro\Bundle\PricingBundle\Provider\CombinedPriceListAssociationsProvider
        public: true
        arguments:
            - '@oro_pricing.event.combined_price_list.association.collect_event_factory'
            - '@event_dispatcher'

    oro_pricing.association_event_listener.collect_by_config:
        class: Oro\Bundle\PricingBundle\EventListener\CombinedPriceListAssociation\CollectAssociationConfigEventListener
        arguments:
            - '@oro_pricing.provider.price_list_collection'
            - '@oro_pricing.provider.combined_price_list'
        tags:
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.assignment.collect.by_config, method: onCollectAssociations }

    oro_pricing.association_event_listener.collect_abstract:
        abstract: true
        arguments:
            - '@oro_pricing.provider.price_list_collection'
            - '@oro_pricing.provider.combined_price_list'
            - '@doctrine'
            - '@event_dispatcher'

    oro_pricing.association_event_listener.collect_by_website:
        class: Oro\Bundle\PricingBundle\EventListener\CombinedPriceListAssociation\CollectAssociationWebsiteEventListener
        parent: oro_pricing.association_event_listener.collect_abstract
        tags:
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.assignment.collect.by_config, method: onCollectAssociationsConfigLevel }
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.assignment.collect.by_website, method: onCollectAssociations }

    oro_pricing.association_event_listener.collect_by_customer_group:
        class: Oro\Bundle\PricingBundle\EventListener\CombinedPriceListAssociation\CollectAssociationCustomerGroupEventListener
        parent: oro_pricing.association_event_listener.collect_abstract
        tags:
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.assignment.collect.by_website, method: onCollectAssociationsWebsiteLevel }
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.assignment.collect.by_customer_group, method: onCollectAssociations }

    oro_pricing.association_event_listener.collect_by_customer:
        class: Oro\Bundle\PricingBundle\EventListener\CombinedPriceListAssociation\CollectAssociationCustomerEventListener
        parent: oro_pricing.association_event_listener.collect_abstract
        tags:
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.assignment.collect.by_website, method: onCollectAssociationsWebsiteLevel }
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.assignment.collect.by_customer_group, method: onCollectAssociationsCustomerGroupLevel }
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.assignment.collect.by_customer, method: onCollectAssociations }

    oro_pricing.association_event_listener.process_abstract:
        class: Oro\Bundle\PricingBundle\EventListener\CombinedPriceListAssociation\AbstractProcessAssociationEventListener
        abstract: true
        arguments:
            - '@event_dispatcher'
            - '@doctrine'
            - '@oro_pricing.resolver.active_combined_price_list'
            - '@oro_pricing.model.combined_price_list_trigger_handler'

    oro_pricing.association_event_listener.process_config:
        class: Oro\Bundle\PricingBundle\EventListener\CombinedPriceListAssociation\ProcessAssociationConfigEventListener
        arguments:
            - '@event_dispatcher'
            - '@oro_pricing.resolver.active_combined_price_list'
            - '@oro_config.global'
            - '@oro_website.website.provider'
        tags:
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.assignment.process, method: onProcessAssociations }
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.assignment.get_associated_websites, method: onGetAssociatedWebsites }

    oro_pricing.association_event_listener.process_website:
        class: Oro\Bundle\PricingBundle\EventListener\CombinedPriceListAssociation\ProcessAssociationWebsiteEventListener
        parent: oro_pricing.association_event_listener.process_abstract
        tags:
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.assignment.process, method: onProcessAssociations }
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.assignment.get_associated_websites, method: onGetAssociatedWebsites }

    oro_pricing.association_event_listener.process_customer_group:
        class: Oro\Bundle\PricingBundle\EventListener\CombinedPriceListAssociation\ProcessAssociationCustomerGroupEventListener
        parent: oro_pricing.association_event_listener.process_abstract
        tags:
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.assignment.process, method: onProcessAssociations }
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.assignment.get_associated_websites, method: onGetAssociatedWebsites }

    oro_pricing.association_event_listener.process_customer:
        class: Oro\Bundle\PricingBundle\EventListener\CombinedPriceListAssociation\ProcessAssociationCustomerEventListener
        parent: oro_pricing.association_event_listener.process_abstract
        tags:
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.assignment.process, method: onProcessAssociations }
            - { name: kernel.event_listener, event: oro_pricing.combined_price_list.assignment.get_associated_websites, method: onGetAssociatedWebsites }

    oro_pricing.pricing_storage_switch_handler:
        class: Oro\Bundle\PricingBundle\Model\PricingStorageSwitchHandler
        public: true
        arguments:
            - '@oro_config.global'
            - '@doctrine'
            - '@oro_pricing.system_config_converter'

    oro_pricing.combined_price_list_status_handler:
        class: Oro\Bundle\PricingBundle\Model\CombinedPriceListStatusHandler
        arguments:
            - !tagged_iterator combined_price_list_status_handler

    oro_pricing.combined_price_list_activation_status_handler:
        class: Oro\Bundle\PricingBundle\Model\CombinedPriceListActivationStatusHandler
        arguments:
            - '@doctrine'
            - '@oro_config.manager'
        tags:
            - { name: combined_price_list_status_handler, priority: 10 }

    oro_pricing.price_list_reference_checker:
        class: 'Oro\Bundle\PricingBundle\Model\PriceListReferenceChecker'
        public: false
        arguments:
            - '@doctrine'

    oro_pricing.repository.combined_product_price:
        class: Oro\Bundle\PricingBundle\Entity\Repository\CombinedProductPriceRepository
        factory: ['@doctrine', 'getRepository']
        arguments: ['Oro\Bundle\PricingBundle\Entity\CombinedProductPrice']

    oro_pricing.datagrid.provider.product_price:
        class: Oro\Bundle\PricingBundle\Datagrid\Provider\ProductPriceProvider
        public: false
        arguments:
            - '@oro_pricing.provider.product_price'
            - '@oro_pricing.formatter.product_price_formatter'
            - '@oro_entity.doctrine_helper'

    oro_pricing.provider.quick_add_collection_price_provider:
        class: 'Oro\Bundle\PricingBundle\Provider\QuickAddCollectionPriceProvider'
        arguments:
            - '@oro_pricing.provider.product_price'
            - '@oro_pricing.user_currency_manager'
            - '@oro_entity.doctrine_helper'
            - '@oro_pricing.rounding.price_rounding_service'
        calls:
            - ['setProductPriceCriteriaFactory', ['@oro_pricing.product_price_criteria_factory']]

    oro_pricing.provider.website_currency_provider:
        class: Oro\Bundle\PricingBundle\Provider\WebsiteCurrencyProvider
        arguments:
            - '@oro_currency.config.currency'
            - '@oro_entity.doctrine_helper'

    oro_pricing.event_listener.quick_add_rows_collection_ready:
        class: 'Oro\Bundle\PricingBundle\EventListener\CalculatePriceForCollectionListener'
        arguments:
            - '@oro_pricing.provider.quick_add_collection_price_provider'
            - '@oro_pricing.model.product_price_scope_criteria_request_handler'
        tags:
            - { name: kernel.event_listener, event: oro_product.quick_add_rows_collection_ready, method: onQuickAddRowsCollectionReady }

    oro_pricing.form.autocomplete.product_with_prices.search_handler:
        class: Oro\Bundle\PricingBundle\Autocomplete\ProductWithPricesSearchHandler
        arguments:
            - 'Oro\Bundle\ProductBundle\Entity\Product'
            - '@oro_product.website_search.repository.product'
            - '@oro_pricing.model.product_price_scope_criteria_request_handler'
            - '@doctrine'
            - '@oro_pricing.formatter.product_price_formatter'
            - '@oro_pricing.user_currency_manager'
            - '@oro_pricing.provider.product_price'
            - '@request_stack'
            - '@oro_security.acl_helper'
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: oro_product_with_prices, acl_resource: oro_product_frontend_view }

    oro_pricing.event_listener.website_search_index.flat:
        class: 'Oro\Bundle\PricingBundle\EventListener\WebsiteSearchProductPriceFlatIndexerListener'
        arguments:
            - '@oro_website_search.manager.website_context_manager'
            - '@doctrine'
            - '@oro_config.manager'
            - '@oro_pricing.model.flat_price_list_tree_handler'
            - '@oro_website_search.formatter.decimal_flat_value_formatter'
        tags:
            - { name: kernel.event_listener, event: oro_website_search.event.index_entity.product, method: onWebsiteSearchIndex }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_flat }
        calls:
            - setNotAllowedProductTypes:
                  -
                      - !php/const Oro\Bundle\ProductBundle\Entity\Product::TYPE_KIT

    oro_pricing.event_listener.website_search_index:
        class: 'Oro\Bundle\PricingBundle\EventListener\WebsiteSearchProductPriceIndexerListener'
        arguments:
            - '@oro_website_search.manager.website_context_manager'
            - '@doctrine'
            - '@oro_config.manager'
            - '@oro_website_search.formatter.decimal_flat_value_formatter'
        tags:
            - { name: kernel.event_listener, event: oro_website_search.event.index_entity.product, method: onWebsiteSearchIndex }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_combined }
        calls:
            - setNotAllowedProductTypes:
                  -
                      - !php/const Oro\Bundle\ProductBundle\Entity\Product::TYPE_KIT

    oro_pricing.price_list_id.placeholder:
        class: 'Oro\Bundle\PricingBundle\Placeholder\PriceListIdPlaceholder'
        public: false
        arguments:
            - '@oro_pricing.model.flat_price_list_tree_handler'
            - '@security.token_storage'
            - '@oro_config.manager'
            - '@oro_customer.provider.customer_user_relations_provider'
        tags:
            - { name: website_search.placeholder }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_flat }

    oro_pricing.cpl.placeholder:
        class: 'Oro\Bundle\PricingBundle\Placeholder\CPLIdPlaceholder'
        public: false
        arguments:
            - '@oro_pricing.model.price_list_tree_handler'
            - '@security.token_storage'
        calls:
            - ['setCustomerUserRelationsProvider', ['@oro_customer.provider.customer_user_relations_provider']]
        tags:
            - { name: website_search.placeholder }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_combined }

    oro_pricing.currency.placeholder:
        class: 'Oro\Bundle\PricingBundle\Placeholder\CurrencyPlaceholder'
        public: false
        arguments:
            - '@oro_pricing.user_currency_manager'
        tags:
            - { name: website_search.placeholder }

    oro_pricing.unit.placeholder:
        class: 'Oro\Bundle\PricingBundle\Placeholder\UnitPlaceholder'
        public: false
        tags:
            - { name: website_search.placeholder }

    oro_pricing.model.combined_price_list_trigger_handler:
        class: Oro\Bundle\PricingBundle\Model\CombinedPriceListTriggerHandler
        arguments:
            - '@doctrine'
            - '@event_dispatcher'
            - '@oro_product.storage.product_website_reindex_request_data_storage'

    oro_pricing.layout.attribute_block_type_mapper:
        class: 'Oro\Bundle\PricingBundle\Layout\Mapper\AttributeBlockTypeMapper'
        arguments:
            - '@doctrine'
        calls:
            - [addBlockTypeByFieldName, ['productPriceAttributesPrices', 'attribute_prices']]
        tags:
            - { name: oro_entity_config.layout.attribute_block_type_mapper }

    oro_pricing.shard_manager:
        class: 'Oro\Bundle\PricingBundle\Sharding\ShardManager'
        public: true
        calls:
            - [setRegistry, ['@doctrine']]
            - [addEntityForShard, ['prices', 'Oro\Bundle\PricingBundle\Entity\ProductPrice']]
            - [setConfigProvider, ['@oro_entity_config.provider.sharding']]
            - [setEnableSharding, ['%enable_price_sharding%']]

    Oro\Bundle\PricingBundle\Sharding\ShardManager:
        alias: 'oro_pricing.shard_manager'

    oro_pricing.entity_listener.price_list_sharding:
        class: Oro\Bundle\PricingBundle\Entity\EntityListener\PriceListShardingListener
        arguments:
            - '@oro_pricing.shard_manager'
        tags:
            - { name: doctrine.orm.entity_listener, entity: Oro\Bundle\PricingBundle\Entity\PriceList, event: postPersist}
            - { name: doctrine.orm.entity_listener, entity: Oro\Bundle\PricingBundle\Entity\PriceList, event: preRemove}
            - { name: doctrine.event_listener, event: postFlush }

    oro_pricing.orm.abstract_shard_query_executor:
        class: Oro\Bundle\PricingBundle\ORM\AbstractShardQueryExecutor
        abstract: true
        arguments:
            - '@oro_entity.orm.native_query_executor_helper'
            - '@oro_pricing.shard_manager'
        calls:
            - ['registerUniqueFields', ['Oro\Bundle\PricingBundle\Entity\ProductPrice', {search_fields: ['product_id', 'price_list_id', 'quantity', 'unit_code', 'currency'], update_field: 'value'}]]

    oro_pricing.orm.insert_from_select_query_executor:
        class: Oro\Bundle\PricingBundle\ORM\InsertFromSelectShardQueryExecutor
        parent: oro_pricing.orm.abstract_shard_query_executor

    oro_pricing.orm.multi_insert_shard_query_executor:
        class: Oro\Bundle\PricingBundle\ORM\MultiInsertShardQueryExecutor
        shared: false
        parent: oro_pricing.orm.abstract_shard_query_executor

    oro_pricing.orm_walker.price_shard_walker_hint_provider:
        class: Oro\Bundle\PricingBundle\ORM\Walker\PriceShardWalkerHintProvider
        arguments:
            - '@oro_pricing.shard_manager'

    oro_pricing.query_hint.price_shard:
        public: false
        abstract: true
        tags:
            -
                name: oro_entity.query_hint
                hint: oro_pricing.price_shard
                alias: HINT_PRICE_SHARD
                output_walker: true
                walker_hint_provider: oro_pricing.orm_walker.price_shard_walker_hint_provider

    oro_pricing.sql_walker.price_shard:
        class: Oro\Bundle\PricingBundle\ORM\Walker\PriceShardOutputResultModifier
        abstract: true
        tags:
            - { name: oro_entity.sql_walker }

    oro_pricing.sql_walker.temp_table:
        class: Oro\Bundle\PricingBundle\ORM\Walker\TempTableOutputResultModifier
        abstract: true
        tags:
            - { name: oro_entity.sql_walker }

    oro_pricing.orm.temp_table_manipulator.abstract:
        class: Oro\Bundle\PricingBundle\ORM\AbstractTempTableManipulator
        abstract: true
        arguments:
            - '@doctrine'
            - '@oro_entity.orm.native_query_executor_helper'
            - '@oro_pricing.orm.insert_from_select_query_executor'
            - '@oro_pricing.shard_manager'

    oro_pricing.orm.temp_table_manipulator.mysql:
        class: Oro\Bundle\PricingBundle\ORM\MySqlTempTableManipulator
        parent: oro_pricing.orm.temp_table_manipulator.abstract

    oro_pricing.orm.temp_table_manipulator.postgresql:
        class: Oro\Bundle\PricingBundle\ORM\PostgreSqlTempTableManipulator
        parent: oro_pricing.orm.temp_table_manipulator.abstract

    oro_pricing.orm.temp_table_manipulator:
        class:  Oro\Bundle\PricingBundle\ORM\TempTableManipulator
        arguments:
            - '@doctrine'
            - '@oro_pricing.orm.temp_table_manipulator.postgresql'
            - '@oro_pricing.orm.temp_table_manipulator.mysql'

    oro_pricing.manager.price_manager:
        class: Oro\Bundle\PricingBundle\Manager\PriceManager
        public: true
        arguments:
            - '@oro_pricing.shard_manager'
            - '@event_dispatcher'
            - '@oro_message_queue.client.message_buffer_manager'
        tags:
            - { name: doctrine.event_listener, event: postFlush }

    Oro\Bundle\PricingBundle\Manager\PriceManager:
        alias: 'oro_pricing.manager.price_manager'

    oro_pricing.filter.price_list_filter:
        class: Oro\Bundle\PricingBundle\Filter\PriceListFilter
        public: false
        arguments:
            - '@form.factory'
            - '@oro_filter.filter_utility'
            - '@doctrine'
        tags:
            - { name: oro_filter.extension.orm_filter.filter, type: price_list }

    oro_pricing.handler.product_price_handler:
        class: Oro\Bundle\PricingBundle\Handler\ProductPriceHandler
        parent: oro_form.form.handler.default
        arguments:
            - '@oro_pricing.manager.price_manager'

    Oro\Bundle\PricingBundle\Handler\ProductPriceHandler:
        alias: 'oro_pricing.handler.product_price_handler'

    oro_pricing.delete_handler.product_price:
        class: Oro\Bundle\PricingBundle\Handler\ProductPriceDeleteHandler
        parent: oro_entity.delete_handler
        arguments:
            - '@oro_pricing.manager.price_manager'
        tags:
            - { name: oro_entity.delete_handler, entity: Oro\Bundle\PricingBundle\Entity\ProductPrice }

    oro_pricing.providers.price_attribute_prices:
        class: Oro\Bundle\PricingBundle\Provider\PriceAttributePricesProvider
        public: false
        arguments: ['@oro_entity.doctrine_helper']

    oro_pricing.event_listener.product_price_attributes_grid:
        class: Oro\Bundle\PricingBundle\EventListener\ProductPriceAttributesGridListener
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_pricing.providers.price_attribute_prices'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.product-price-attributes-grid, method: onBuildBefore }
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after.product-price-attributes-grid, method: onBuildAfter }

    oro_pricing.pricing_strategy.strategy_register:
        class: Oro\Bundle\PricingBundle\PricingStrategy\StrategyRegister
        public: true
        arguments:
            - '@oro_config.manager'

    oro_pricing.provider.price_list_value:
        class: 'Oro\Bundle\PricingBundle\Provider\PriceListValueProvider'
        public: true
        arguments:
            - '@oro_pricing.shard_manager'
            - '@doctrine'
            - '@oro_security.acl_helper'

    oro_pricing.entity_listener.remove_price_list_from_configuration:
        class: 'Oro\Bundle\PricingBundle\Entity\EntityListener\RemoveFromConfigurationPriceListEntityListener'
        public: false
        arguments:
            - '@oro_config.global'
            - '@oro_pricing.system_config_converter'
        tags:
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceList', event: preRemove }

    oro_pricing.locale_settings:
        class: 'Oro\Bundle\PricingBundle\Model\LocaleSettings'
        decorates: oro_locale.settings
        decoration_priority: -20
        arguments:
            - '@.inner'
            - '@oro_frontend.request.frontend_helper'
            - '@oro_locale.provider.current_localization'
            - '@oro_pricing.user_currency_manager'
            - '@oro_layout.layout_context_stack'
            - '@oro_layout.theme_manager'

    oro_pricing.datagrid.extension.price:
        abstract: true
        public: false
        arguments:
            - '@oro_pricing.model.price_list_request_handler'
            - '@oro_entity.doctrine_helper'
            - '@oro_datagrid.provider.selected_fields'

    oro_pricing.datagrid.extension.product_price_datagrid:
        class: 'Oro\Bundle\PricingBundle\Datagrid\ProductPriceDatagridExtension'
        parent: oro_pricing.datagrid.extension.price
        arguments:
            - '@translator'
            - '@security.authorization_checker'
        calls:
            - ['addSupportedGrid', ['products-grid']]
        tags:
            - { name: oro_datagrid.extension }
            - { name: oro_featuretogle.feature, feature: oro_price_lists }

    oro_pricing.datagrid.extension.combined_product_price:
        class: 'Oro\Bundle\PricingBundle\Debug\Datagrid\CombinedProductPriceDatagridExtension'
        arguments:
            - '@oro_pricing.model.debug_product_price_price_list_request_handler'
            - '@oro_entity.doctrine_helper'
            - '@oro_datagrid.provider.selected_fields'
            - '@translator'
            - '@security.authorization_checker'
        calls:
            - ['addSupportedGrid', ['pricing-products-trace-grid']]
        tags:
            - { name: oro_datagrid.extension }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_combined }

    oro_pricing.datagrid.extension.price_attribute_product_price_datagrid:
        class: 'Oro\Bundle\PricingBundle\Datagrid\PriceAttributeProductPriceDatagridExtension'
        public: false
        arguments:
            - '@oro_pricing.model.price_list_request_handler'
            - '@oro_entity.doctrine_helper'
            - '@oro_datagrid.provider.selected_fields'
            - '@oro_security.acl_helper'
        tags:
            - { name: oro_datagrid.extension }

    oro_pricing.entity_listener.import_export_result:
        class: 'Oro\Bundle\PricingBundle\Entity\EntityListener\ImportExportResultListener'
        public: false
        arguments:
            - '@doctrine'
            - '@oro_pricing.price_rule_lexeme_trigger_handler'
            - '@oro_pricing.shard_manager'
            - '@oro_message_queue.client.message_producer'
        tags:
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\ImportExportBundle\Entity\ImportExportResult', event: postPersist }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_combined }

    oro_pricing.provider.product_price_entity_name:
        class: Oro\Bundle\PricingBundle\Provider\ProductPriceEntityNameProvider
        tags:
            - { name: oro_entity.name_provider, priority: 100 }

    oro_pricing.event_listener.datagrid_line_items_data.pricing:
        class: Oro\Bundle\PricingBundle\EventListener\DatagridLineItemsDataPricingListener
        arguments:
            - '@oro_pricing.subtotal_processor.provider.subtotal_line_item_not_priced'
            - '@oro_currency.rounding.price_rounding_service'
            - '@oro_locale.formatter.number'
        calls:
            - ['setProductLineItemsHolderFactory', ['@oro_product.model.product_line_items_holder_factory']]
        tags:
            - { name: kernel.event_listener, event: oro_product.datagrid_line_items_data.frontend-customer-user-shopping-list-grid, method: onLineItemData, priority: 100 }
            - { name: kernel.event_listener, event: oro_product.datagrid_line_items_data.frontend-customer-user-shopping-list-edit-grid, method: onLineItemData, priority: 100 }
            - { name: kernel.event_listener, event: oro_product.datagrid_line_items_data.frontend-checkout-line-items-grid, method: onLineItemData, priority: 100 }
            - { name: kernel.event_listener, event: oro_product.datagrid_line_items_data.frontend-single-page-checkout-line-items-grid, method: onLineItemData, priority: 100 }

    oro_pricing.event_listener.product_autocomplete:
        class: Oro\Bundle\PricingBundle\EventListener\ProductAutocompleteListener
        arguments:
            - '@oro_pricing.user_currency_manager'
            - '@oro_locale.formatter.number'
        tags:
            - { name: kernel.event_listener, event: Oro\Bundle\ProductBundle\Event\CollectAutocompleteFieldsEvent, method: onCollectAutocompleteFields }
            - { name: kernel.event_listener, event: Oro\Bundle\ProductBundle\Event\ProcessAutocompleteDataEvent, method: onProcessAutocompleteData }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_flat }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_combined }

    oro_pricing.event_listener.price_list_view:
        class: Oro\Bundle\PricingBundle\EventListener\PriceListViewListener
        arguments:
            - '@oro_pricing.notification_alert_manager'
            - '@session.flash_bag'
            - '@translator'
        tags:
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.price-list-view, method: onPriceListView }

    oro_pricing.notification_alert_manager:
        class: Oro\Bundle\NotificationBundle\NotificationAlert\NotificationAlertManager
        arguments:
            - 'Pricing'
            - 'PriceList'
            - '@doctrine'
            - '@oro_security.token_accessor'
            - '@logger'

    Oro\Bundle\PricingBundle\EntityConfig\ShardingEntityConfiguration:
        tags:
            - oro_entity_config.validation.entity_config

    oro_pricing.handler.combined_price_list_build_trigger:
        class: Oro\Bundle\PricingBundle\Handler\CombinedPriceListBuildTriggerHandler
        arguments:
            - '@doctrine'
            - '@oro_pricing.price_list_relation_trigger_handler'
            - '@oro_pricing.shard_manager'

    oro_pricing.handler.price_list_relation_handler:
        class: Oro\Bundle\PricingBundle\Handler\PriceListRelationHandler
        arguments:
            - '@oro_config.manager'
            - '@doctrine'
            - '@oro_website.website.provider'
        tags:
            - { name: oro_featuretogle.feature, feature: oro_price_lists_flat }

    oro_pricing.entity_listener.product_prices:
        class: Oro\Bundle\PricingBundle\Entity\EntityListener\ProductPricesListener
        arguments:
            - '@oro_pricing.handler.combined_price_list_build_trigger'
            - '@oro_pricing.price_list_trigger_handler'
        tags:
            - { name: kernel.event_listener, event: oro_pricing.product_prices.updated, method: onPricesUpdated }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_combined }

    oro_pricing.entity_listener.flat.price_list_relation:
        class: Oro\Bundle\PricingBundle\EventListener\FlatPriceListRelationListener
        arguments:
            - '@oro_pricing.handler.price_list_relation_handler'
            - '@oro_message_queue.client.message_producer'
            - '@oro_config.manager'
        tags:
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceListToCustomer', event: preUpdate }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceListToCustomer', event: prePersist }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceListToCustomerGroup', event: preUpdate }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\PricingBundle\Entity\PriceListToCustomerGroup', event: prePersist }
            - { name: oro_featuretogle.feature, feature: oro_price_lists_flat }

    oro_pricing.entity_listener.flat.price_list_config_relation:
        class: Oro\Bundle\PricingBundle\EventListener\FlatPriceListRelationSystemConfigListener
        arguments:
            - '@oro_pricing.handler.price_list_relation_handler'
            - '@oro_message_queue.client.message_producer'
            - '@doctrine'
        tags:
            - { name: kernel.event_listener, event: oro_config.settings_before_save.oro_pricing.default_price_list, method: beforeSave}
            - { name: oro_featuretogle.feature, feature: oro_price_lists_flat }

    oro_pricing.datagrid.export.category_filter.price_attribute_product_price:
        class: Oro\Bundle\PricingBundle\ImportExport\Datagrid\PriceAttributeProductPriceCategoryFilter

    oro_pricing.entity_listener.organization_listener:
        class: Oro\Bundle\PricingBundle\EventListener\OrganizationListener
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_currency.config.currency'
            - '@oro_pricing.system_config_converter'
            - '@oro_config.global'
        public: false
        tags:
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\OrganizationBundle\Entity\Organization', event: prePersist }
            - { name: doctrine.event_listener, event: postFlush }

    oro_pricing.product_price_criteria_factory:
        class: Oro\Bundle\PricingBundle\Model\ProductPriceCriteriaFactory
        arguments:
            - '@oro_pricing.product_price_criteria_builder.registry'
            - '@oro_pricing.product_line_item_price_criteria.factory'

    oro_pricing.provider.product_line_items_holder_currency:
        class: Oro\Bundle\PricingBundle\Provider\ProductLineItemsHolderCurrencyProvider
        arguments:
            - '@oro_pricing.user_currency_manager'
            - '@oro_pricing.provider.website_currency_provider'

    oro_pricing.provider.product_line_item_price:
        class: Oro\Bundle\PricingBundle\Provider\ProductLineItemPriceProvider
        arguments:
            - '@oro_pricing.provider.product_price'
            - '@oro_pricing.model.product_price_scope_criteria_factory'
            - '@oro_pricing.model.product_price_scope_criteria_request_handler'
            - '@oro_pricing.product_price_criteria_factory'
            - '@oro_pricing.provider.product_line_items_holder_currency'
            - '@oro_pricing.user_currency_manager'
            - '@oro_pricing.product_line_item_price.factory'

    oro_pricing.product_line_item_price_criteria.factory:
        class: Oro\Bundle\PricingBundle\Model\ProductLineItemPriceCriteriaFactory\ProductLineItemPriceCriteriaFactory
        arguments:
            - !tagged_iterator { tag: oro_pricing.product_line_item_price_criteria.factory }

    oro_pricing.product_line_item_price_criteria.factory.simple:
        class: Oro\Bundle\PricingBundle\Model\ProductLineItemPriceCriteriaFactory\SimpleProductLineItemPriceCriteriaFactory
        arguments:
            - '@oro_pricing.product_price_criteria_builder.simple'
        tags:
            -
                name: oro_pricing.product_line_item_price_criteria.factory
                priority: -256 # Makes this factory the last one as the most general way of creating a product price criteria.

    oro_pricing.product_line_item_price.factory:
        class: Oro\Bundle\PricingBundle\Model\ProductLineItemPrice\Factory\ProductLineItemPriceFactory
        arguments:
            - !tagged_iterator { tag: oro_pricing.product_line_item_price.factory }

    oro_pricing.product_line_item_price.factory.simple:
        class: Oro\Bundle\PricingBundle\Model\ProductLineItemPrice\Factory\SimpleProductLineItemPriceFactory
        arguments:
            - '@oro_currency.rounding.price_rounding_service'
        tags:
            -
                name: oro_pricing.product_line_item_price.factory
                priority: -256 # Makes this factory the last one as the most general way of creating a product line item price.

    oro_pricing.provider.product_price_by_matching_criteria.simple:
        class: Oro\Bundle\PricingBundle\Provider\PriceByMatchingCriteria\SimpleProductPriceByMatchingCriteriaProvider
        tags:
            -
                name: oro_pricing.provider.product_price_by_matching_criteria
                priority: -256 # Makes this provider the last one as the most general way of finding a product price.

    oro_pricing.provider.product_price_by_matching_criteria:
        class: Oro\Bundle\PricingBundle\Provider\PriceByMatchingCriteria\ProductPriceByMatchingCriteriaProvider
        arguments:
            - !tagged_iterator { tag: oro_pricing.provider.product_price_by_matching_criteria }

    oro_pricing.product_price_criteria_data_extractor.simple:
        class: Oro\Bundle\PricingBundle\Model\ProductPriceCriteriaDataExtractor\SimpleProductPriceCriteriaDataExtractor
        tags:
            -
                name: oro_pricing.product_price_criteria_data_extractor
                priority: -256 # Makes this provider the last one as the most general way of extracting a product price criteria data.

    oro_pricing.product_price_criteria_data_extractor:
        class: Oro\Bundle\PricingBundle\Model\ProductPriceCriteriaDataExtractor\ProductPriceCriteriaDataExtractor
        arguments:
            - !tagged_iterator { tag: oro_pricing.product_price_criteria_data_extractor }

    oro_pricing.product_price_criteria_builder.registry:
        class: Oro\Bundle\PricingBundle\Model\ProductPriceCriteriaBuilder\ProductPriceCriteriaBuilderRegistry
        arguments:
            - !tagged_iterator { tag: oro_pricing.product_price_criteria_builder }

    oro_pricing.product_price_criteria_builder.simple:
        class: Oro\Bundle\PricingBundle\Model\ProductPriceCriteriaBuilder\SimpleProductPriceCriteriaBuilder
        arguments:
            - '@doctrine'
            - '@oro_pricing.user_currency_manager'
        calls:
            - ['setLogger', ['@logger']]
        tags:
            -
                name: oro_pricing.product_price_criteria_builder
                priority: -256 # Makes this builder the last one as the most general way of building a product price criteria.
            - { name: monolog.logger, channel: oro_pricing }

    oro_pricing.twig.product_price_extension:
        class: Oro\Bundle\PricingBundle\Twig\ProductPriceExtension
        tags:
            - { name: twig.extension }

    oro_pricing.provider.product_line_item_product_price:
        class: Oro\Bundle\PricingBundle\Provider\ProductLineItemProductPriceProvider
        arguments:
            - '@oro_pricing.product_price_criteria_factory'
            - '@oro_pricing.provider.product_price_by_matching_criteria'
            - '@oro_currency.rounding.price_rounding_service'

    oro_pricing.migrations.generate_missing_product_by_rules:
        class: Oro\Bundle\PricingBundle\Migrations\Service\GenerateMissingPricesByRules
        public: true
        arguments:
            - '@oro_pricing.price_rule_lexeme_trigger_handler'
            - '@oro_pricing.compiler.product_assignment_rule_compiler'
            - '@oro_pricing.compiler.price_list_rule_compiler'
            - '@oro_pricing.shard_manager'
