parameters:
    # entities
    orocrm_magento.entity.order.class:                                      OroCRM\Bundle\MagentoBundle\Entity\Order
    orocrm_magento.entity.cart.class:                                       OroCRM\Bundle\MagentoBundle\Entity\Cart
    orocrm_magento.entity.address.class:                                    OroCRM\Bundle\MagentoBundle\Entity\Address
    orocrm_magento.entity.cart_address.class:                               OroCRM\Bundle\MagentoBundle\Entity\CartAddress
    orocrm_magento.entity.order_address.class:                              OroCRM\Bundle\MagentoBundle\Entity\OrderAddress
    orocrm_magento.entity.customer.class:                                   OroCRM\Bundle\MagentoBundle\Entity\Customer

    # transport
    orocrm_magento.transport.soap_transport.class:                          OroCRM\Bundle\MagentoBundle\Provider\Transport\SoapTransport

    # providers
    orocrm_magento.provider.channel_type.class:                             OroCRM\Bundle\MagentoBundle\Provider\ChannelType
    orocrm_magento.provider.cart_expiration_processor.class:                OroCRM\Bundle\MagentoBundle\Provider\CartExpirationProcessor

    # forms
    orocrm_magento.form.type.order_place.class:                             OroCRM\Bundle\MagentoBundle\Form\Type\OrderPlaceType
    orocrm_magento.form.type.soap_transport_setting.class:                  OroCRM\Bundle\MagentoBundle\Form\Type\SoapTransportSettingFormType
    orocrm_magento.form.type.soap_transport_check.class:                    OroCRM\Bundle\MagentoBundle\Form\Type\SoapTransportCheckButtonType
    orocrm_magento.form.subscriber.soap_transport_setting.class:            OroCRM\Bundle\MagentoBundle\Form\EventListener\SoapSettingsFormSubscriber
    orocrm_magento.form.type.order_select.class:                            OroCRM\Bundle\MagentoBundle\Form\Type\OrderSelectType
    orocrm_magento.form.type.customer_select.class:                         OroCRM\Bundle\MagentoBundle\Form\Type\CustomerSelectType
    orocrm_magento.form.type.cart_select.class:                             OroCRM\Bundle\MagentoBundle\Form\Type\CartSelectType
    orocrm_magento.form.type.website_select.class:                          OroCRM\Bundle\MagentoBundle\Form\Type\WebsiteSelectType

    # event listeners
    orocrm.magento.event_listener.account_widgets_data_grid_listener.class: OroCRM\Bundle\MagentoBundle\EventListener\AccountWidgetsDataGridListener
    orocrm_magento.event_listener.order.class:                              OroCRM\Bundle\MagentoBundle\EventListener\OrderListener
    orocrm_magento.event_listener.channel_owner_set.class:                  OroCRM\Bundle\MagentoBundle\EventListener\ChannelOwnerSetListener
    orocrm_magento.event_listener.writer_error.class:                       OroCRM\Bundle\MagentoBundle\EventListener\IntegrationWriteErrorListener
    orocrm_magento.event_listener.integration_sync_after.class:             OroCRM\Bundle\MagentoBundle\EventListener\IntegrationSyncAfterEventListener

    # generator
    orocrm_magento.magento_url_generator.class:                             OroCRM\Bundle\MagentoBundle\Service\MagentoUrlGenerator
    orocrm_magento.service.import_helper.class:                             OroCRM\Bundle\MagentoBundle\Service\ImportHelper

    orocrm_magento.customer.manager.api.class:                              Oro\Bundle\SoapBundle\Entity\Manager\ApiEntityManager
    # datagrid helpers
    orocrm_magento.country.datagrid_helper.class:                           Oro\Bundle\AddressBundle\Datagrid\CountryDatagridHelper
    orocrm_magento.datagrid_helper.class:                                   OroCRM\Bundle\MagentoBundle\Datagrid\MagentoDatagridHelper

    # magento related records delete provider
    orocrm_magento.manager.magento_delete_provider.class:                   OroCRM\Bundle\MagentoBundle\Manager\MagentoDeleteProvider

    orocrm_magento.listener.customer_listener.class:                        OroCRM\Bundle\MagentoBundle\EventListener\ContactListener

    # helpers
    orocrm_magento.importexport.address_import_helper.class:                OroCRM\Bundle\MagentoBundle\ImportExport\Strategy\StrategyHelper\AddressImportHelper
    orocrm_magento.importexport.doctrine_helper.class:                      OroCRM\Bundle\MagentoBundle\ImportExport\Strategy\StrategyHelper\DoctrineHelper

    orocrm_magento.converter.region.class:                                  OroCRM\Bundle\MagentoBundle\Converter\RegionConverter

    # dashboard
    orocrm_magento.dashboard.data_provider.order.class:                     OroCRM\Bundle\MagentoBundle\Dashboard\OrderDataProvider
    orocrm_magento.dashboard.data_provider.customer.class:                  OroCRM\Bundle\MagentoBundle\Dashboard\CustomerDataProvider

    orocrm_magento.provider.phone.address.class:                            OroCRM\Bundle\MagentoBundle\Provider\AddressPhoneProvider
    orocrm_magento.provider.phone.cart_address.class:                       OroCRM\Bundle\MagentoBundle\Provider\CartAddressPhoneProvider
    orocrm_magento.provider.phone.order_address.class:                      OroCRM\Bundle\MagentoBundle\Provider\OrderAddressPhoneProvider
    orocrm_magento.provider.phone.customer.class:                           OroCRM\Bundle\MagentoBundle\Provider\CustomerPhoneProvider

    orocrm_magento.provider.analytics.customer_recency.class:               OroCRM\Bundle\MagentoBundle\Provider\Analytics\CustomerRecencyProvider
    orocrm_magento.provider.analytics.customer_frequency.class:             OroCRM\Bundle\MagentoBundle\Provider\Analytics\CustomerFrequencyProvider
    orocrm_magento.provider.analytics.customer_monetary.class:              OroCRM\Bundle\MagentoBundle\Provider\Analytics\CustomerMonetaryProvider

services:
    orocrm_magento.transport.soap_transport:
        class: %orocrm_magento.transport.soap_transport.class%
        arguments:
            - @oro_security.encoder.mcrypt
        tags:
            - { name: oro_integration.transport, type: magento_soap, channel_type: magento }
        calls:
            - [setLogger, ["@oro_integration.logger.strategy"]]

    # Providers
    orocrm_magento.provider.channel_type:
        class: %orocrm_magento.provider.channel_type.class%
        tags:
            - { name: oro_integration.channel, type: magento }

    orocrm_magento.provider.cart_expiration_processor:
        class: %orocrm_magento.provider.cart_expiration_processor.class%
        arguments:
            - @oro_integration.provider.connector_context_mediator
            - @doctrine.orm.entity_manager

    # forms
    orocrm_magento.form.subscriber.soap_transport_setting:
        class: %orocrm_magento.form.subscriber.soap_transport_setting.class%
        arguments:
            - @oro_security.encoder.mcrypt

    orocrm_magento.form.type.soap_transport_setting:
        class: %orocrm_magento.form.type.soap_transport_setting.class%
        arguments:
            - @orocrm_magento.transport.soap_transport
            - @orocrm_magento.form.subscriber.soap_transport_setting
            - @oro_integration.manager.types_registry
        tags:
            - { name: form.type, alias: orocrm_magento_soap_transport_setting_form_type }

    orocrm_magento.form.type.soap_transport_check:
        class: %orocrm_magento.form.type.soap_transport_check.class%
        tags:
            - { name: form.type, alias: orocrm_magento_soap_transport_check_button }

    orocrm_magento.form.type.order_select:
        class: %orocrm_magento.form.type.order_select.class%
        tags:
            - { name: form.type, alias: orocrm_order_select }

    orocrm_magento.form.type.customer_select:
        class: %orocrm_magento.form.type.customer_select.class%
        tags:
            - { name: form.type, alias: orocrm_customer_select }

    orocrm_magento.form.type.cart_select:
        class: %orocrm_magento.form.type.cart_select.class%
        tags:
            - { name: form.type, alias: orocrm_cart_select }

    orocrm_magento.form.type.website_select:
        class: %orocrm_magento.form.type.website_select.class%
        tags:
            - { name: form.type, alias: orocrm_magento_website_select }

    orocrm_magento.form.type.order_place:
        class: %orocrm_magento.form.type.order_place.class%
        tags:
            - { name: form.type, alias: orocrm_magento_order_place_form_type }

    # Search handler
    orocrm_magento.form.autocomplete.order.search_handler:
        parent: oro_form.autocomplete.search_handler
        arguments:
            - %orocrm_magento.order.entity.class%
            - ["incrementId"]
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: orocrm_magento.orders, acl_resource: orocrm_magento_order_view }
        lazy: true

    orocrm_magento.form.autocomplete.customer.search_handler:
        parent: oro_form.autocomplete.full_name.search_handler
        arguments:
            - %orocrm_magento.customer.entity.class%
            - ["namePrefix", "firstName", "middleName", "lastName", "nameSuffix"]
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: orocrm_magento.customers, acl_resource: orocrm_magento_customer_view }
        lazy: true

    orocrm_magento.form.autocomplete.cart.search_handler:
        parent: oro_form.autocomplete.search_handler
        arguments:
            - %orocrm_magento.cart.entity.class%
            - ["originId"]
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: orocrm_magento.carts, acl_resource: orocrm_magento_cart_view }
        lazy: true

    # event listeners
    orocrm_magento.event_listener.order:
        class: %orocrm_magento.event_listener.order.class%
        tags:
            - { name: doctrine.event_listener, event: postPersist }
            - { name: doctrine.event_listener, event: preUpdate }
            - { name: doctrine.event_listener, event: postFlush }

    orocrm_magento.event_listener.customer_order_grid_listener:
        class: %orocrm.magento.event_listener.account_widgets_data_grid_listener.class%
        arguments:
            - ['customerId', 'channelId']
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after.magento-customer-order-grid, method: onBuildAfter }
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after.magento-customer-cart-grid, method: onBuildAfter }
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after.magento-customer-orders-widget-grid, method: onBuildAfter }
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after.magento-customer-cart-widget-grid, method: onBuildAfter }

    orocrm_magento.event_listener.channel_owner_set:
        class: %orocrm_magento.event_listener.channel_owner_set.class%
        arguments:
            - @doctrine.orm.default_entity_manager
        tags:
            - { name: kernel.event_listener, event: oro_integration.default_owner.set, method: onSet }

    orocrm_magento.event_listener.writer_error:
        class: %orocrm_magento.event_listener.writer_error.class%
        tags:
            - { name: kernel.event_listener, event: oro_integration.writer_error, method: handleError }

    orocrm_magento.service.magento_url_generator:
        class: %orocrm_magento.magento_url_generator.class%
        arguments: [@router]
        scope: prototype

    orocrm_magento.service.import_helper:
        class: %orocrm_magento.service.import_helper.class%
        arguments:
            - @doctrine

    orocrm_magento.event_listener.after_job_execution:
        class: %orocrm_magento.event_listener.integration_sync_after.class%
        tags:
            - { name: kernel.event_listener, event: oro_integration.event.sync_after, method: process }

    # Customer API
    orocrm_magento.customer.manager.api:
        class: %orocrm_magento.customer.manager.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - %orocrm_magento.entity.customer.class%
            - @doctrine.orm.entity_manager

    orocrm_magento.datagrid_helper:
        class: %orocrm_magento.datagrid_helper.class%

    orocrm_magento.country.datagrid_helper:
        class: %orocrm_magento.country.datagrid_helper.class%

    orocrm_magento.manager.magento_delete_provider:
        class: %orocrm_magento.manager.magento_delete_provider.class%
        arguments:
            - @doctrine.orm.entity_manager
        tags:
            - { name: oro_integration.delete_provider }

    orocrm_magento.listener.customer_listener:
        class: %orocrm_magento.listener.customer_listener.class%
        arguments:
            - @oro_security.security_facade.link
            - @oro_integration.sync_scheduler.link
        tags:
            - { name: doctrine.event_listener, event: onFlush, connection: default }

    orocrm_magento.importexport.address_import_helper:
        class: %orocrm_magento.importexport.address_import_helper.class%
        arguments:
            - @orocrm_magento.importexport.doctrine_helper

    orocrm_magento.importexport.doctrine_helper:
        class: %orocrm_magento.importexport.doctrine_helper.class%
        arguments:
            - @oro_importexport.strategy.import.helper

    orocrm_magento.converter.region:
        class: %orocrm_magento.converter.region.class%
        arguments:
            - @orocrm_magento.orm.regions_repository

    orocrm_magento.dashboard.data_provider.order:
        class: %orocrm_magento.dashboard.data_provider.order.class%
        arguments:
            - @doctrine
            - @oro_security.acl_helper
            - @oro_chart.config_provider

    orocrm_magento.dashboard.data_provider.customer:
        class: %orocrm_magento.dashboard.data_provider.customer.class%
        arguments:
            - @doctrine
            - @oro_security.acl_helper
            - @oro_chart.config_provider

    orocrm_magento.provider.enitity_state:
        parent: orocrm_channel.provider.utils.entity_state_provider
        arguments:
            - 'OroCRM\Bundle\MagentoBundle\Entity'

    orocrm_magento.provider.phone.address:
        class: %orocrm_magento.provider.phone.address.class%
        tags:
            - { name: oro_address.phone_provider, class: %orocrm_magento.entity.address.class% }

    orocrm_magento.provider.phone.cart_address:
        class: %orocrm_magento.provider.phone.cart_address.class%
        tags:
            - { name: oro_address.phone_provider, class: %orocrm_magento.entity.cart_address.class% }

    orocrm_magento.provider.phone.order_address:
        class: %orocrm_magento.provider.phone.order_address.class%
        tags:
            - { name: oro_address.phone_provider, class: %orocrm_magento.entity.order_address.class% }

    orocrm_magento.provider.phone.customer:
        class: %orocrm_magento.provider.phone.customer.class%
        tags:
            - { name: oro_address.phone_provider, class: %orocrm_magento.entity.customer.class% }

    orocrm_magento.provider.analytics.customer_recency:
        class: %orocrm_magento.provider.analytics.customer_recency.class%
        arguments:
            - @oro_entity.doctrine_helper
            - %orocrm_magento.entity.customer.class%
        tags:
            - { name: orocrm_analytics.builder.rfm }

    orocrm_magento.provider.analytics.customer_frequency:
        class: %orocrm_magento.provider.analytics.customer_frequency.class%
        arguments:
            - @oro_entity.doctrine_helper
            - %orocrm_magento.entity.customer.class%
        tags:
            - { name: orocrm_analytics.builder.rfm }

    orocrm_magento.provider.analytics.customer_monetary:

        class: %orocrm_magento.provider.analytics.customer_monetary.class%
        arguments:
            - @oro_entity.doctrine_helper
            - %orocrm_magento.entity.customer.class%
        tags:
            - { name: orocrm_analytics.builder.rfm }
