parameters:
    orocrm_sales.opportunity.class:                          OroCRM\Bundle\SalesBundle\Entity\Opportunity
    orocrm_sales.opportunity.manager.api.class:              Oro\Bundle\SoapBundle\Entity\Manager\ApiEntityManager

    orocrm_sales.lead.entity.class:                          OroCRM\Bundle\SalesBundle\Entity\Lead
    orocrm_sales.lead.manager.api.class:                     Oro\Bundle\SoapBundle\Entity\Manager\ApiEntityManager

    orocrm_sales.lead.datagrid_helper.class:                 Oro\Bundle\AddressBundle\Datagrid\CountryDatagridHelper

    orocrm_sales.salesfunnel.entity.class:                   OroCRM\Bundle\SalesBundle\Entity\SalesFunnel
    orocrm_sales.salesfunnel.manager.api.class:              Oro\Bundle\SoapBundle\Entity\Manager\ApiEntityManager

    orocrm_sales.b2bcustomer.entity.class:                   OroCRM\Bundle\SalesBundle\Entity\B2bCustomer
    orocrm_sales.b2bcustomer.manager.api.class:              Oro\Bundle\SoapBundle\Entity\Manager\ApiEntityManager

    orocrm_sales.event_listener.b2bcustomer_lifetime.class:  OroCRM\Bundle\SalesBundle\EventListener\B2bCustomerLifetimeListener

    orocrm_sales.provider.phone.lead.class:                  OroCRM\Bundle\SalesBundle\Provider\LeadPhoneProvider
    orocrm_sales.provider.phone.opportunity.class:           OroCRM\Bundle\SalesBundle\Provider\OpportunityPhoneProvider
    orocrm_sales.provider.phone.b2bcustomer.class:           OroCRM\Bundle\SalesBundle\Provider\B2bCustomerPhoneProvider

services:
    orocrm_sales.opportunity.manager.api:
        class: %orocrm_sales.opportunity.manager.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - %orocrm_sales.opportunity.class%
            - @doctrine.orm.entity_manager

    orocrm_sales.lead.manager.api:
        class: %orocrm_sales.lead.manager.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - %orocrm_sales.lead.entity.class%
            - @doctrine.orm.entity_manager

    orocrm_sales.salesfunnel.manager.api:
        class: %orocrm_sales.salesfunnel.manager.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - %orocrm_sales.salesfunnel.entity.class%
            - @doctrine.orm.entity_manager

    orocrm_sales.lead.datagrid_helper:
        class: %orocrm_sales.lead.datagrid_helper.class%

    orocrm_sales.form.autocomplete.opportunity.search_handler:
        parent: orocrm_channel.autocomplete.channel_limitation_handler
        arguments:
            - %orocrm_sales.opportunity.class%
            - ["name"]
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: opportunities, acl_resource: orocrm_sales_opportunity_view }
        lazy: true

    orocrm_sales.form.autocomplete.lead.search_handler:
        parent: orocrm_channel.autocomplete.channel_limitation_handler
        arguments:
            - %orocrm_sales.lead.entity.class%
            - ["name"]
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: leads, acl_resource: orocrm_sales_lead_view }
        lazy: true

    orocrm_sales.form.autocomplete.b2bcustomer.search_handler:
        parent: orocrm_channel.autocomplete.channel_limitation_handler
        arguments:
            - %orocrm_sales.b2bcustomer.entity.class%
            - ["name"]
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: b2b_customers, acl_resource: orocrm_sales_b2bcustomer_view }
        lazy: true

    orocrm_sales.provider.enitity_state:
        parent: orocrm_channel.provider.utils.entity_state_provider
        arguments:
            - 'OroCRM\Bundle\SalesBundle\Entity'

    orocrm_sales.b2bcustomer.manager.api:
        class: %orocrm_sales.b2bcustomer.manager.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - %orocrm_sales.b2bcustomer.entity.class%
            - @doctrine.orm.entity_manager

    orocrm_sales.event_listener.b2bcustomer_lifetime:
        class: %orocrm_sales.event_listener.b2bcustomer_lifetime.class%
        tags:
        - { name: doctrine.event_listener, event: onFlush, method: onFlush }
        - { name: doctrine.event_listener, event: postFlush, method: postFlush }

    orocrm_sales.provider.phone.lead:
        class: %orocrm_sales.provider.phone.lead.class%
        tags:
            - { name: oro_address.phone_provider, class: %orocrm_sales.lead.entity.class% }

    orocrm_sales.provider.phone.opportunity:
        class: %orocrm_sales.provider.phone.opportunity.class%
        tags:
            - { name: oro_address.phone_provider, class: %orocrm_sales.opportunity.class% }

    orocrm_sales.provider.phone.b2bcustomer:
        class: %orocrm_sales.provider.phone.b2bcustomer.class%
        tags:
            - { name: oro_address.phone_provider, class: %orocrm_sales.b2bcustomer.entity.class% }

#    orocrm_sales.listener.datagrid.account_sales:
#        class: %orocrm_task.listener.datagrid.user_tasks.class%
#        arguments:
#            - @oro_security.security_facade
#        tags:
#            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after.sales-account-lead-grid, method: onBuildAfter }
#            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after.sales-account-opportunity-grid, method: onBuildAfter }