<?xml version="1.0"?>
<!--
/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package Advanced MSI for Magento 2
 */-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\InventoryShippingAdminUi\Ui\Component\Control\SourceSelection\AlgorithmSelectionButton">
        <arguments>
            <argument name="getDefaultSourceSelectionAlgorithmCode" xsi:type="object">Amasty\AdvancedMSI\Model\GetDefaultSourceSelectionAlgorithmCode</argument>
        </arguments>
    </type>
    <type name="Magento\InventoryShippingAdminUi\Controller\Adminhtml\SourceSelection\ProcessAlgorithm">
        <plugin name="amastyAdvancedMSIProcessAlgorithm" type="Amasty\AdvancedMSI\Plugin\InventoryShippingAdminUi\Controller\Adminhtml\SourceSelection\ProcessAlgorithmPlugin"/>
    </type>
    <type name="Magento\InventorySourceSelectionApi\Api\SourceSelectionServiceInterface">
        <plugin name="amastyAdvancedMSISourceSelectionServiceInterface" type="Amasty\AdvancedMSI\Plugin\InventorySourceSelectionApi\Api\SourceSelectionServiceInterfacePlugin"/>
    </type>
    <type name="Magento\InventoryShippingAdminUi\Controller\Adminhtml\SourceSelection\Index">
        <plugin name="amastyAdvancedMSISourceSelectionController" type="Amasty\AdvancedMSI\Plugin\InventoryShippingAdminUi\Controller\Adminhtml\SourceSelection\ShipmentPlugin"/>
    </type>

    <!-- Start Import Config -->
    <virtualType name="amastyImportSampleFiles" type="Magento\Framework\DataObject">
        <arguments>
            <argument name="data" xsi:type="array">
                <item name="ammsi_source_import" xsi:type="string">Amasty_AdvancedMSI</item>
            </argument>
        </arguments>
    </virtualType>
    <type name="Amasty\Base\Component\ComponentRegistrar">
        <arguments>
            <argument name="samples" xsi:type="object">amastyImportSampleFiles</argument>
        </arguments>
    </type>

    <virtualType name="Amasty\AdvancedMSI\Model\Import\Source\ValidatorPool" type="Amasty\Base\Model\Import\Validation\ValidatorPool">
        <arguments>
            <argument name="validators" xsi:type="array">
                <item name="basic" xsi:type="object">Amasty\AdvancedMSI\Model\Import\Source\Validation\Basic</item>
            </argument>
        </arguments>
    </virtualType>

    <virtualType name="Amasty\AdvancedMSI\Model\Import\Source\Behavior\BehaviorProvider" type="Amasty\Base\Model\Import\Behavior\BehaviorProvider">
        <arguments>
            <argument name="behaviors" xsi:type="array">
                <item name="custom" xsi:type="object">Amasty\AdvancedMSI\Model\Import\Source\Behaviors\Add</item>
            </argument>
        </arguments>
    </virtualType>


    <type name="Amasty\AdvancedMSI\Model\Import\Source\Import">
        <arguments>
            <argument name="entityTypeCode" xsi:type="string">ammsi_source_import</argument>
            <argument name="validatorPool" xsi:type="object">Amasty\AdvancedMSI\Model\Import\Source\ValidatorPool</argument>
            <argument name="behaviorProvider" xsi:type="object">Amasty\AdvancedMSI\Model\Import\Source\Behavior\BehaviorProvider</argument>
            <argument name="mapping" xsi:type="object">Amasty\AdvancedMSI\Model\Import\Source\Mapping</argument>
        </arguments>
    </type>
    <!-- End Import Config -->
    <type name="Magento\Backend\Model\Menu\Builder">
        <plugin name="Amasty_AdvancedMSI::menu_builder" type="Amasty\AdvancedMSI\Plugin\Backend\Model\Menu\Builder" sortOrder="100"/>
    </type>
</config>