services:
    oro_sales.opportunity.form.type:
        class: Oro\Bundle\SalesBundle\Form\Type\OpportunityType
        arguments:
            - '@oro_sales.provider.probability'
            - '@oro_entity_extend.enum_value_provider'
            - '@oro_entity_extend.enum_type_helper'
            - '@oro_sales.builder.opportunity_relations'
        tags:
            - { name: form.type, alias: oro_sales_opportunity }

    oro_sales.opportunity_status_config.form.type:
        class: Oro\Bundle\SalesBundle\Form\Type\OpportunityStatusConfigType
        arguments:
            - '@oro_entity_config.config_manager'
            - '@oro_config.global'
            - '@oro_entity_extend.entity_config_type.enum.subscriber'
        tags:
            - { name: form.type, alias: oro_sales_opportunity_status_config }

    oro_sales.opportunity_probability.form.type:
        class: Oro\Bundle\SalesBundle\Form\Type\OpportunityProbabilityType
        arguments:
            - '@oro_entity_extend.enum_type_helper'
            - '@doctrine'
        tags:
            - { name: form.type, alias: oro_sales_opportunity_probability }

    oro_sales.opportunity_status_enum_value.form.type:
        class: Oro\Bundle\SalesBundle\Form\Type\OpportunityStatusEnumValueType
        arguments:
            - '@oro_entity_config.provider.enum'
        tags:
            - { name: form.type, alias: oro_sales_opportunity_status_enum_value }

    oro_sales.opportunity.form.type.api:
        class: Oro\Bundle\SalesBundle\Form\Type\OpportunityApiType
        parent: oro_sales.opportunity.form.type
        tags:
            - { name: form.type, alias: oro_sales_opportunity_api }

    oro_sales.lead_to_opportunity.form.type:
        class: Oro\Bundle\SalesBundle\Form\Type\LeadToOpportunityType
        tags:
            - { name: form.type, alias: oro_sales_lead_to_opportunity }

    oro_sales.opportunity.form:
        class: Symfony\Component\Form\Form
        public: true
        factory: ['@form.factory', createNamed]
        arguments:
            - "oro_sales_opportunity_form"
            - Oro\Bundle\SalesBundle\Form\Type\OpportunityType

    oro_sales.opportunity.form.api:
        class: Symfony\Component\Form\Form
        public: true
        factory: ['@form.factory', createNamed]
        arguments:
            - "opportunity"
            - Oro\Bundle\SalesBundle\Form\Type\OpportunityApiType

    oro_sales.opportunity.form.handler:
        class: 'Oro\Bundle\SalesBundle\Form\Handler\OpportunityHandler'
        arguments:
            - "@doctrine.orm.entity_manager"
            - "@oro_channel.provider.request_channel"
            - "@logger"

    Oro\Bundle\SalesBundle\Form\Handler\OpportunityHandler:
        alias: oro_sales.opportunity.form.handler

    Oro\Bundle\SalesBundle\Form\Handler\LeadToOpportunityHandler:
        alias: oro_sales.lead_to_opportunity.form.handler

    oro_sales.lead_to_opportunity.form.handler:
        class: Oro\Bundle\SalesBundle\Form\Handler\LeadToOpportunityHandler
        public: true
        arguments:
            - "@doctrine.orm.entity_manager"
            - "@oro_channel.provider.request_channel"
            - "@oro_sales.provider.lead_to_opportunity"
            - "@logger"

    oro_sales.opportunity.form.handler.api:
        class: 'Oro\Bundle\SalesBundle\Form\Handler\OpportunityHandler'
        public: true
        arguments:
            - "@doctrine.orm.entity_manager"
            - "@oro_channel.provider.request_channel"
            - "@logger"

    oro_sales.lead.form.type:
        class: Oro\Bundle\SalesBundle\Form\Type\LeadType
        tags:
            - { name: form.type, alias: oro_sales_lead }

    oro_sales.lead.address.form.type:
        class: Oro\Bundle\SalesBundle\Form\Type\LeadAddressType
        tags:
            - { name: form.type, alias: oro_sales_lead_address }

    oro_sales.lead.form.type.api:
        class: Oro\Bundle\SalesBundle\Form\Type\LeadApiType
        tags:
            - { name: form.type, alias: oro_sales_lead_api }

    oro_sales.lead.form:
        class: Symfony\Component\Form\Form
        public: true
        factory: ['@form.factory', createNamed]
        arguments:
            - "oro_sales_lead_form"
            - Oro\Bundle\SalesBundle\Form\Type\LeadType

    oro_sales.lead.form.api:
        class: Symfony\Component\Form\Form
        public: true
        factory: ['@form.factory', createNamed]
        arguments:
            - "lead"
            - Oro\Bundle\SalesBundle\Form\Type\LeadApiType

    oro_sales.lead.form.handler:
        class: Oro\Bundle\SalesBundle\Form\Handler\LeadHandler
        public: true
        arguments:
            - "@doctrine.orm.entity_manager"
            - "@oro_channel.provider.request_channel"

    oro_sales.lead.form.handler.api:
        class: Oro\Bundle\SalesBundle\Form\Handler\LeadHandler
        public: true
        arguments:
            - "@doctrine.orm.entity_manager"
            - "@oro_channel.provider.request_channel"

    oro_sales.lead_address.form:
        class: Symfony\Component\Form\Form
        public: true
        factory: ['@form.factory', createNamed]
        arguments:
            - "oro_sales_lead_address_form"
            - Oro\Bundle\SalesBundle\Form\Type\LeadAddressType
            - ~
            - { data_class: 'Oro\Bundle\SalesBundle\Entity\LeadAddress' }

    oro_sales.lead_address.form.handler:
        class: Oro\Bundle\AddressBundle\Form\Handler\AddressHandler
        public: true
        arguments:
            - "@doctrine.orm.entity_manager"

    oro_sales.form.type.opportunity_select:
        class: Oro\Bundle\SalesBundle\Form\Type\OpportunitySelectType
        tags:
            - { name: form.type, alias: oro_sales_opportunity_select }

    oro_sales.form.type.lead_select:
        class: Oro\Bundle\SalesBundle\Form\Type\LeadSelectType
        tags:
            - { name: form.type, alias: "oro_sales_lead_select" }

    oro_sales.form.type.b2bcustomer_select:
        class: Oro\Bundle\SalesBundle\Form\Type\B2bCustomerSelectType
        tags:
            - { name: form.type, alias: oro_sales_b2bcustomer_select }

    oro_sales.form.type.opportunity_status_select:
        class: Oro\Bundle\SalesBundle\Form\Type\OpportunityStatusSelectType
        arguments:
            - '@oro_config.user'
        tags:
            - { name: form.type, alias: oro_sales_opportunity_status_select }

    oro_sales.b2bcustomer.form.type:
        class: Oro\Bundle\SalesBundle\Form\Type\B2bCustomerType
        arguments:
            - "@property_accessor"
        tags:
            - { name: form.type, alias: oro_sales_b2bcustomer }

    oro_sales.b2bcustomer.form.type.api:
        class: Oro\Bundle\SalesBundle\Form\Type\B2bCustomerApiType
        arguments:
            - '@property_accessor'
        tags:
            - { name: form.type, alias: oro_sales_b2bcustomer_api }

    oro_sales.mailbox_process.lead.type:
        class: Oro\Bundle\SalesBundle\Form\Type\LeadMailboxProcessSettingsType
        tags:
            - { name: form.type, alias: oro_sales_lead_mailbox_process_settings }

    oro_sales.lead_mailbox_process_source.type:
        class: Oro\Bundle\SalesBundle\Form\Type\LeadMailboxProcessSourceType
        arguments:  ["@oro_entity_extend.enum_value_provider"]
        tags:
            - { name: form.type, alias: oro_sales_lead_mailbox_process_source }

    oro_sales.b2bcustomer.form:
        class: Symfony\Component\Form\Form
        public: true
        factory: ['@form.factory', createNamed]
        arguments:
            - "oro_sales_b2bcustomer"
            - Oro\Bundle\SalesBundle\Form\Type\B2bCustomerType

    oro_sales.b2bcustomer.form.api:
        class: Symfony\Component\Form\Form
        public: true
        factory: ['@form.factory', createNamed]
        arguments:
            - "b2bcustomer"
            - Oro\Bundle\SalesBundle\Form\Type\B2bCustomerApiType

    oro_sales.b2bcustomer.form.handler:
        class: Oro\Bundle\SalesBundle\Form\Handler\B2bCustomerHandler
        public: true
        arguments:
            - "@doctrine.orm.entity_manager"
            - "@oro_channel.provider.request_channel"

    oro_sales.b2bcustomer.form.handler.api:
        class: Oro\Bundle\SalesBundle\Form\Handler\B2bCustomerHandler
        public: true
        arguments:
            - "@doctrine.orm.entity_manager"
            - "@oro_channel.provider.request_channel"

    oro_sales.type.widget_oppotunity_status_select:
        class: Oro\Bundle\SalesBundle\Form\Type\WidgetOpportunityStatusSelectType
        arguments:
            - '@oro_entity_extend.enum_value_provider'
        tags:
            - { name: form.type, alias: oro_type_widget_opportunity_status_select }

    oro_sales.type.lead_source_select:
        class: Oro\Bundle\SalesBundle\Form\Type\LeadSourceSelectType
        arguments:
            - '@oro_entity_extend.enum_value_provider'
        tags:
            - { name: form.type, alias: oro_type_widget_lead_source_select }

    oro_sales.type.lead_status_select:
        class: Oro\Bundle\SalesBundle\Form\Type\LeadStatusSelectType
        arguments:
           - '@oro_entity_extend.enum_value_provider'
        tags:
            - { name: form.type, alias: oro_type_widget_lead_status_select }

    oro_sales.form.type.lead_phone.type:
        class: Oro\Bundle\SalesBundle\Form\Type\LeadPhoneType
        public: true
        tags:
            - { name: form.type, alias: oro_sales_lead_phone }

    oro_sales.form.type.lead_phone.handler:
        class: Oro\Bundle\SalesBundle\Form\Handler\LeadPhoneHandler
        public: true
        arguments:
            - "@form.factory"
            - "@request_stack"
            - "@doctrine.orm.entity_manager"
            - "@security.authorization_checker"

    oro_sales.form.type.lead_email.type:
        class: Oro\Bundle\SalesBundle\Form\Type\LeadEmailType
        public: true
        tags:
            - { name: form.type, alias: oro_sales_lead_email }

    oro_sales.form.type.lead_email.handler:
        class: Oro\Bundle\SalesBundle\Form\Handler\LeadEmailHandler
        public: true
        arguments:
            - "@form.factory"
            - "@request_stack"
            - "@doctrine.orm.entity_manager"
            - "@security.authorization_checker"

    oro_sales.form.type.b2bcustomer_phone:
        class: Symfony\Component\Form\Form
        factory: ["@form.factory", createNamed]
        arguments: ["oro_b2bcustomer_phone", Oro\Bundle\SalesBundle\Form\Type\B2bCustomerPhoneType, null]

    oro_sales.form.type.b2bcustomer_phone.type:
        class: Oro\Bundle\SalesBundle\Form\Type\B2bCustomerPhoneType
        public: true
        tags:
            - { name: form.type, alias: oro_b2bcustomer_phone }

    oro_sales.form.type.b2bcustomer_phone.handler:
        class: Oro\Bundle\SalesBundle\Form\Handler\B2bCustomerPhoneHandler
        public: true
        arguments:
            - "@oro_sales.form.type.b2bcustomer_phone"
            - "@request_stack"
            - "@doctrine.orm.entity_manager"
            - "@security.authorization_checker"

    oro_sales.form.type.b2bcustomer_email:
        class: Symfony\Component\Form\Form
        factory: ["@form.factory", createNamed]
        arguments: ["oro_b2bcustomer_email", Oro\Bundle\SalesBundle\Form\Type\B2bCustomerEmailType, null]

    oro_sales.form.type.b2bcustomer_email.type:
        class: Oro\Bundle\SalesBundle\Form\Type\B2bCustomerEmailType
        public: true
        tags:
            - { name: form.type, alias: oro_b2bcustomer_email }

    oro_sales.form.type.b2bcustomer_email.handler:
        class: Oro\Bundle\SalesBundle\Form\Handler\B2bCustomerEmailHandler
        public: true
        arguments:
            - "@oro_sales.form.type.b2bcustomer_email"
            - "@request_stack"
            - "@doctrine.orm.entity_manager"
            - "@security.authorization_checker"

    oro_sales.form.type.customer:
        class: Oro\Bundle\SalesBundle\Form\Type\CustomerType
        arguments:
            - '@oro_sales.customer_to_string_transformer'
            - '@oro_sales.customer.account_config_provider'
            - '@oro_entity.entity_alias_resolver'
            - '@oro_sales.provider.customer.icon'
            - '@translator'
            - '@security.authorization_checker'
            - '@oro_datagrid.datagrid.manager'
            - '@oro_entity.entity_name_resolver'
            - '@oro_datagrid.multi_grid_provider'
        tags:
            - { name: form.type, alias: oro_sales_customer }

    oro_sales.customer_to_string_transformer:
        class: Oro\Bundle\SalesBundle\Form\DataTransformer\CustomerToStringTransformer
        arguments:
            - '@oro_entity.entity_reference_to_string_transformer'
            - '@oro_sales.manager.account_customer'
            - '@oro_sales.factory.customer_factory'
