<?xml version="1.0"?>
<!--
/**
 * @author Amasty Team
 * @copyright Copyright (c) 2023 Amasty (https://www.amasty.com)
 * @package Login as Customer for Magento 2
 */-->

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Amasty\CustomerLogin\Api\Data\LoggedInInterface" type="Amasty\CustomerLogin\Model\LoggedIn"/>
    <preference for="Amasty\CustomerLogin\Api\LoggedInRepositoryInterface" type="Amasty\CustomerLogin\Model\LoggedInRepository"/>
    <preference for="Amasty\CustomerLogin\Api\CustomerTokenInterface" type="Amasty\CustomerLogin\Model\CustomerToken"/>
    <type name="Amasty\CustomerLogin\Controller\Index\Index">
        <arguments>
            <argument name="customerSession" xsi:type="object">Magento\Customer\Model\Session\Proxy</argument>
        </arguments>
    </type>
    <!-- @DO - query to get this is too slow
    <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">Amasty\CustomerLogin\Model\ResourceModel\Order\Grid\Collection</item>
            </argument>
        </arguments>
    </type>
    <type name="Amasty\CustomerLogin\Model\ResourceModel\Order\Grid\Collection">
        <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>
    -->
    <type name="Magento\Sales\Model\Order">
        <plugin name="amasty_customerlogin_order_comment" type="Amasty\CustomerLogin\Plugin\Sales\Model\AddCommentToOrderPlugin"/>
    </type>
</config>
