services:
    oro_sales.importexport.template_fixture.lead:
        class: Oro\Bundle\SalesBundle\ImportExport\TemplateFixture\LeadFixture
        tags:
            - { name: oro_importexport.template_fixture }

    oro_sales.importexport.template_fixture.opportunity:
        class: Oro\Bundle\SalesBundle\ImportExport\TemplateFixture\OpportunityFixture
        tags:
            - { name: oro_importexport.template_fixture }

    oro_sales.importexport.template_fixture.b2bcustomer:
        class: Oro\Bundle\SalesBundle\ImportExport\TemplateFixture\B2bCustomerFixture
        tags:
            - { name: oro_importexport.template_fixture }

    # Converter
    oro_sales.importexport.data_converter.lead:
        parent: oro_importexport.data_converter.configurable

    oro_sales.importexport.data_converter.opportunity:
        parent: oro_importexport.data_converter.configurable

    oro_sales.importexport.data_converter.b2bcustomer:
        parent: oro_importexport.data_converter.configurable

    oro_sales.importexport.template_fixture.data_converter.lead:
        parent: oro_importexport.data_converter.template_fixture.configurable

    oro_sales.importexport.template_fixture.data_converter.opportunity:
        parent: oro_importexport.data_converter.template_fixture.configurable

    oro_sales.importexport.template_fixture.data_converter.b2bcustomer:
        parent: oro_importexport.data_converter.template_fixture.configurable

    # Export processor
    oro_sales.importexport.processor.export.lead:
        parent: oro_importexport.processor.export_abstract
        calls:
            - [setDataConverter, ['@oro_sales.importexport.data_converter.lead']]
        tags:
            - { name: oro_importexport.processor, type: export, entity: Oro\Bundle\SalesBundle\Entity\Lead, alias: oro_sales_lead }

    oro_sales.importexport.processor.export.opportunity:
        parent: oro_importexport.processor.export_abstract
        calls:
            - [setDataConverter, ['@oro_sales.importexport.data_converter.opportunity']]
        tags:
            - { name: oro_importexport.processor, type: export, entity: Oro\Bundle\SalesBundle\Entity\Opportunity, alias: oro_sales_opportunity }

    oro_sales.importexport.processor.export.b2bcustomer:
        parent: oro_importexport.processor.export_abstract
        calls:
             - [setDataConverter, ['@oro_sales.importexport.data_converter.b2bcustomer']]
        tags:
            - { name: oro_importexport.processor, type: export, entity: Oro\Bundle\SalesBundle\Entity\B2bCustomer, alias: oro_sales_b2bcustomer }

    oro_sales.importexport.processor.export_template.lead:
        parent: oro_importexport.processor.export_abstract
        calls:
            - [setDataConverter, ['@oro_sales.importexport.template_fixture.data_converter.lead']]
        tags:
            - { name: oro_importexport.processor, type: export_template, entity: Oro\Bundle\SalesBundle\Entity\Lead, alias: oro_sales_lead }

    oro_sales.importexport.processor.export_template.opportunity:
        parent: oro_importexport.processor.export_abstract
        calls:
            - [setDataConverter, ['@oro_sales.importexport.template_fixture.data_converter.opportunity']]
        tags:
            - { name: oro_importexport.processor, type: export_template, entity: Oro\Bundle\SalesBundle\Entity\Opportunity, alias: oro_sales_opportunity }

    oro_sales.importexport.processor.export_template.b2bcustomer:
        parent: oro_importexport.processor.export_abstract
        calls:
            - [setDataConverter, ['@oro_sales.importexport.template_fixture.data_converter.b2bcustomer']]
        tags:
            - { name: oro_importexport.processor, type: export_template, entity: Oro\Bundle\SalesBundle\Entity\B2bCustomer, alias: oro_sales_b2bcustomer }

    # Strategy
    oro_sales.importexport.strategy.lead.add_or_replace:
        class: 'Oro\Bundle\SalesBundle\ImportExport\Strategy\LeadAddOrReplaceStrategy'
        parent: oro_importexport.strategy.configurable_add_or_replace

    oro_sales.importexport.strategy.opportunity.add_or_replace:
        parent: oro_importexport.strategy.configurable_add_or_replace

    oro_sales.importexport.strategy.b2bcustomer.add_or_replace:
        class: Oro\Bundle\SalesBundle\ImportExport\Strategy\B2bConfigurableAddOrReplaceStrategy
        parent: oro_importexport.strategy.configurable_add_or_replace

    # Import processor
    oro_sales.importexport.processor.import.lead:
        parent: oro_importexport.processor.import_abstract
        calls:
             - [setDataConverter, ['@oro_sales.importexport.data_converter.lead']]
             - [setStrategy, ['@oro_sales.importexport.strategy.lead.add_or_replace']]
        tags:
            - { name: oro_importexport.processor, type: import, entity: Oro\Bundle\SalesBundle\Entity\Lead, alias: oro_sales_lead.add_or_replace }
            - { name: oro_importexport.processor, type: import_validation, entity: Oro\Bundle\SalesBundle\Entity\Lead, alias: oro_sales_lead.add_or_replace }

    oro_sales.importexport.processor.import.opportunity:
        parent: oro_importexport.processor.import_abstract
        calls:
             - [setDataConverter, ['@oro_sales.importexport.data_converter.opportunity']]
             - [setStrategy, ['@oro_sales.importexport.strategy.opportunity.add_or_replace']]
        tags:
            - { name: oro_importexport.processor, type: import, entity: Oro\Bundle\SalesBundle\Entity\Opportunity, alias: oro_sales_opportunity.add_or_replace }
            - { name: oro_importexport.processor, type: import_validation, entity: Oro\Bundle\SalesBundle\Entity\Opportunity, alias: oro_sales_opportunity.add_or_replace }

    oro_sales.importexport.processor.import.b2bcustomer:
        parent: oro_importexport.processor.import_abstract
        calls:
             - [setDataConverter, ['@oro_sales.importexport.data_converter.b2bcustomer']]
             - [setStrategy, ['@oro_sales.importexport.strategy.b2bcustomer.add_or_replace']]
        tags:
            - { name: oro_importexport.processor, type: import, entity: Oro\Bundle\SalesBundle\Entity\B2bCustomer, alias: oro_sales_b2bcustomer }
            - { name: oro_importexport.processor, type: import_validation, entity: Oro\Bundle\SalesBundle\Entity\B2bCustomer, alias: oro_sales_b2bcustomer }

    oro_sales.importexport.configuration_provider.lead:
        class: 'Oro\Bundle\SalesBundle\ImportExport\Configuration\LeadImportExportConfigurationProvider'
        tags:
            - { name: oro_importexport.configuration, alias: oro_lead }

    oro_sales.importexport.configuration_provider.b2b_customer:
        class: 'Oro\Bundle\SalesBundle\ImportExport\Configuration\B2bCustomerImportExportConfigurationProvider'
        tags:
            - { name: oro_importexport.configuration, alias: oro_b2b_customer }

    oro_sales.importexport.configuration_provider.opportunity:
        class: 'Oro\Bundle\SalesBundle\ImportExport\Configuration\OpportunityImportExportConfigurationProvider'
        tags:
            - { name: oro_importexport.configuration, alias: oro_opportunity }
