<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.
xsd">

    <!-- Manage Printable colors -->
    <preference 
        for="Printxpand\Core\Api\PrintablecolorRepositoryInterface"
        type="Printxpand\Core\Model\Printablecolor\PrintablecolorRepository"/>
    <preference 
        for="Printxpand\Core\Api\Data\PrintablecolorInterface" 
        type="Printxpand\Core\Model\Printablecolor\Printablecolor"/>
    <!--  Manage Font  -->
    <preference 
        for="Printxpand\Core\Api\FontsRepositoryInterface" 
        type="Printxpand\Core\Model\Fonts\FontsRepository"/>
    <preference 
        for="Printxpand\Core\Api\Data\FontsInterface" 
        type="Printxpand\Core\Model\Fonts\Fonts"/>
    <!-- Clipart -->
    <preference 
        for="Printxpand\Core\Api\ClipartRepositoryInterface"
        type="Printxpand\Core\Model\Clipart\ClipartRepository"/>
    <preference 
        for="Printxpand\Core\Api\Data\ClipartInterface" 
        type="Printxpand\Core\Model\Clipart\Clipart"/>
    <!-- Clipart media -->
    <preference 
        for="Printxpand\Core\Api\ClipartMediaRepositoryInterface"
        type="Printxpand\Core\Model\ClipartMedia\ClipartMediaRepository"/>
    <preference 
        for="Printxpand\Core\Api\Data\ClipartMediaInterface" 
        type="Printxpand\Core\Model\ClipartMedia\ClipartMedia"/>

     <!-- Product Configuration Table -->
    <preference 
        for="Printxpand\Core\Api\ProductConfigurationRepositoryInterface"
        type="Printxpand\Core\Model\ProductConfiguration\ProductConfigurationRepository"/>
    <preference 
        for="Printxpand\Core\Api\Data\ProductConfigurationInterface" 
        type="Printxpand\Core\Model\ProductConfiguration\ProductConfiguration"/>

    <!-- Designs Images Table -->
    <preference 
        for="Printxpand\Core\Api\DesignsImagesRepositoryInterface"
        type="Printxpand\Core\Model\DesignsImages\DesignsImagesRepository"/>
    <preference 
        for="Printxpand\Core\Api\Data\DesignsImagesInterface" 
        type="Printxpand\Core\Model\DesignsImages\DesignsImages"/>

    <!-- Designs Table -->
    <preference 
        for="Printxpand\Core\Api\DesignsRepositoryInterface"
        type="Printxpand\Core\Model\Designs\DesignsRepository"/>
    <preference 
        for="Printxpand\Core\Api\Data\DesignsInterface" 
        type="Printxpand\Core\Model\Designs\Designs"/>

    <!-- START : PRODUCTDESIGNER_CUSTOM_ERROR_LOGGER -->
    <type name="Printxpand\Core\Logger\Handler">
        <arguments>
            <argument name="filesystem" xsi:type="object">Magento\Framework\Filesystem\Driver\File</argument>
        </arguments>
    </type>
    <type name="Printxpand\Core\Logger\Logger">
        <arguments>
            <argument name="name" xsi:type="string">productdesignerErrorLog</argument>
            <argument name="handlers"  xsi:type="array">
                <item name="system" xsi:type="object">Printxpand\Core\Logger\Handler</item>
            </argument>
        </arguments>
    </type>
    <!-- END : PRODUCTDESIGNER_CUSTOM_ERROR_LOGGER -->

     <!-- Product Type Table -->
    <preference 
        for="Printxpand\Core\Api\ProductTypeRepositoryInterface"
        type="Printxpand\Core\Model\ProductType\ProductTypeRepository"/>
    <preference 
        for="Printxpand\Core\Api\Data\ProductTypeInterface" 
        type="Printxpand\Core\Model\ProductType\ProductType"/>

    <preference for="Printxpand\Core\Api\CommonBusinessApiInterface" type="Printxpand\Core\Model\CommonBusinessApi"/>

    <!-- Auth command-->
     <type name="Magento\Framework\Console\CommandList">
        <arguments>
            <argument name="commands" xsi:type="array">
            <item name="oauthkeys" xsi:type="object">Printxpand\Core\Console\OauthKeys</item>
            </argument>
        </arguments>
    </type>

     <!-- Command line to install sample data -->
    <type name="Magento\Framework\Console\CommandList">
       <arguments>
           <argument name="commands" xsi:type="array">
               <item name="printxpandinstallsampledata" xsi:type="object">Printxpand\Core\Console\Sampledata</item>
               <item name="printxpanduninstallsampledata" xsi:type="object">Printxpand\Core\Console\Uninstall</item>
           </argument>
       </arguments>
   </type>

    <preference 
        for="Printxpand\Core\Api\Data\DesignOrderInterface" 
        type="Printxpand\Core\Model\DesignOrder\DesignOrder"/>

    <preference 
        for="Printxpand\Core\Api\DesignOrderRepositoryInterface" 
        type="Printxpand\Core\Model\DesignOrder\DesignOrderRepository"/>


    <!-- create customer token while logged in from magento 2 front :SD -->
    <type name="Magento\Customer\Controller\Account\LoginPost">
        <plugin name="brushyourideas_customer_token_plugin" 
                type="Printxpand\Core\Plugin\Magento\Login\LoginPostPlugin" 
                sortOrder="10"/>
    </type>

    <!-- create customer token while register from front :SD  -->
    <type name="Magento\Customer\Controller\Account\CreatePost">
        <plugin name="brushyourideas_customer_create_token_plugin"
                type="Printxpand\Core\Plugin\Magento\Login\CreateCustomerPostPlugin"
                sortOrder="11"/>
    </type>

    <!-- remove customer token when logged out from front :SD -->
    <type name="Magento\Customer\Controller\Account\Logout">
        <plugin name="remove_auth_token_on_logout" type="Printxpand\Core\Plugin\Magento\Login\LogoutPlugin" />
    </type>

     <!--  Manage Layout  -->
    <preference 
        for="Printxpand\Core\Api\LayoutRepositoryInterface" 
        type="Printxpand\Core\Model\Layout\LayoutRepository"/>
    <preference 
        for="Printxpand\Core\Api\Data\LayoutInterface" 
        type="Printxpand\Core\Model\Layout\Layout"/>
    <!--  Manage Tab  -->
    <preference 
        for="Printxpand\Core\Api\TabRepositoryInterface" 
        type="Printxpand\Core\Model\Tab\TabRepository"/>
    <preference 
        for="Printxpand\Core\Api\Data\TabInterface" 
        type="Printxpand\Core\Model\Tab\Tab"/>
    <!--  Manage Features  -->
    <preference 
        for="Printxpand\Core\Api\FeatureRepositoryInterface" 
        type="Printxpand\Core\Model\Feature\FeatureRepository"/>
    <preference 
        for="Printxpand\Core\Api\Data\FeatureInterface" 
        type="Printxpand\Core\Model\Feature\Feature"/>

    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="sales_order_grid_data_source" xsi:type="string">Printxpand\Core\Ui\Component\Listing\Column\OutputStatusColumns</item>
            </argument>
        </arguments>
    </type>
    <type name="Printxpand\Core\Ui\Component\Listing\Column\OutputStatusColumns">
        <arguments>
            <argument name="mainTable" xsi:type="string">sales_order_grid</argument>
            <argument name="resourceModel" xsi:type="string">Magento\Sales\Model\ResourceModel\Order</argument>
        </arguments>
    </type>

    <!-- Hide Integration Row -->
    <type name="Magento\Integration\Model\ResourceModel\Integration\Collection">
        <plugin name="hide_integration_row" type="Printxpand\Core\Plugin\HideIntegrationRow" />
    </type>

    <preference for="Magento\Sales\Block\Order\Email\Items\Order\DefaultOrder"
                type="Printxpand\Core\Block\Order\Email\Items\Order\DefaultOrder"/>

        
    <!-- Get Order API -->
    <preference for="Printxpand\Core\Api\GetOrderInterface"
            type="Printxpand\Core\Model\GetOrder" />

</config>
