<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
 
    <preference for="Brushyourideas\IntegrationSync\Api\SaveConfiguration" type="Brushyourideas\IntegrationSync\Model\Api\SaveConfiguration"/>
    <preference for="Brushyourideas\IntegrationSync\Api\OrderRepositoryInterface" type="Brushyourideas\IntegrationSync\Model\Api\Order"/>

    <preference for="Brushyourideas\IntegrationSync\Api\Product" type="Brushyourideas\IntegrationSync\Model\Api\Product"/>
    <!-- remove by GB: controller action removed -->
    <!-- FOR Desinger Order Grids-->
    <virtualType name="BiztechProductdesigenerSourceloggerGridDataProvider" type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider">
        <arguments>
            <argument name="collection" xsi:type="object" shared="false">Brushyourideas\IntegrationSync\Model\Mysql5\ApiReuestResponseLog\Collection</argument>
        </arguments>
    </virtualType>
    <virtualType name="Brushyourideas\IntegrationSync\Model\Mysql5\ApiReuestResponseLog\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
        <arguments>
            <argument name="mainTable" xsi:type="string">productdesigner_api_request_response_log</argument>
            <argument name="resourceModel" xsi:type="string">Brushyourideas\IntegrationSync\Model\Mysql5\ApiReuestResponseLog</argument>
        </arguments>
    </virtualType>
    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="productdesigner_source_logger_listing_data_source" xsi:type="string">Brushyourideas\IntegrationSync\Model\Mysql5\ApiReuestResponseLog\Grid\Collection</item>
            </argument>
        </arguments>
    </type>
    <!-- start favicon ico image format issue -->
    <preference for="Magento\MediaStorage\Model\File\Validator\Image" type="Brushyourideas\IntegrationSync\Model\File\Validator\Image" />
    <!-- end favicon ico image format issue -->

    <type name="Magento\Config\Model\Config">
        <plugin name="admin_system_config_save_plugin" type="Brushyourideas\IntegrationSync\Plugin\ConfigPlugin" sortOrder="1"/>
    </type>

    <preference for="Magento\Framework\Serialize\Serializer\Json" type="Brushyourideas\IntegrationSync\Rewrite\Magento\Framework\Serialize\Serializer\Json" />
    <!-- Remove SaveHelper from all inetgration file & make a generalize function for saveCartData -->
    <type name="Brushyourideas\Productdesigner\Helper\SaveHelper">
        <plugin name="integration_sync_save_cart_plugin" type="Brushyourideas\IntegrationSync\Plugin\SaveHelperPlugin" sortOrder="10"/>
    </type>

    <preference for="Brushyourideas\IntegrationSync\Api\CheckLoginUserInterface" type="Brushyourideas\IntegrationSync\Model\Api\CheckLoginUser"/>

    <type name="Printxpand\Core\Helper\AddToCartHelper">
        <plugin name="integration_add_product_to_cart_after"
                type="Brushyourideas\IntegrationSync\Plugin\AddProductToCartPlugin" sortOrder="10" disabled="false" />
    </type>

    <type name="Magento\Quote\Model\Quote\Item">
        <plugin name="force_quote_item_uniqueness"
                type="Brushyourideas\IntegrationSync\Plugin\QuoteItemPlugin"
                sortOrder="1"/>
    </type>

    <type name="Brushyourideas\IntegrationSync\Logger\OrderLogger">
        <arguments>
            <argument name="name" xsi:type="string">IntegrationSyncOrderLogger</argument>
            <argument name="handlers" xsi:type="array">
                <item name="error" xsi:type="object">Brushyourideas\IntegrationSync\Logger\Handler\OrderErrorHandler</item>
            </argument>
        </arguments>
    </type>

</config>