<?xml version="1.0"?>
<!--
/**
 * Webkul Software.
 *
 * @category  Webkul
 * @package   Webkul_MpRmaSystem
 * @author    Webkul
 * @copyright Copyright (c) Webkul Software Private Limited (https://webkul.com)
 * @license   https://store.webkul.com/license.html
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="mprmasystem_reasons_list_data_source" xsi:type="string">Webkul\MpRmaSystem\Model\ResourceModel\Reasons\Grid\Collection</item>
                <item name="mprmasystem_details_list_data_source" xsi:type="string">Webkul\MpRmaSystem\Model\ResourceModel\Details\Grid\Collection</item>
                <item name="mprmasystem_rma_view_conversation_grid_data_source" xsi:type="string">Webkul\MpRmaSystem\Model\ResourceModel\Conversation\Grid\Collection</item>
            </argument>
        </arguments>
    </type>
    <type name="Webkul\MpRmaSystem\Model\ResourceModel\Reasons\Grid\Collection">
        <arguments>
            <argument name="mainTable" xsi:type="string">marketplace_rma_reasons</argument>
            <argument name="eventPrefix" xsi:type="string">mprmasystem_reasons_grid_collection</argument>
            <argument name="eventObject" xsi:type="string">reasons_grid_collection</argument>
            <argument name="resourceModel" xsi:type="string">Webkul\MpRmaSystem\Model\ResourceModel\Reasons</argument>
        </arguments>
    </type>
    <type name="Webkul\MpRmaSystem\Model\ResourceModel\Details\Grid\Collection">
        <arguments>
            <argument name="mainTable" xsi:type="string">marketplace_rma_details</argument>
            <argument name="eventPrefix" xsi:type="string">mprmasystem_items_grid_collection</argument>
            <argument name="eventObject" xsi:type="string">items_grid_collection</argument>
            <argument name="resourceModel" xsi:type="string">Webkul\MpRmaSystem\Model\ResourceModel\Details</argument>
        </arguments>
    </type>
    <virtualType name="Webkul\MpRmaSystem\Model\ResourceModel\Conversation\Grid" type="Webkul\MpRmaSystem\Model\ResourceModel\Grid">
        <arguments>
            <argument name="mainTableName" xsi:type="string">marketplace_rma_conversation</argument>
            <argument name="gridTableName" xsi:type="string">marketplace_rma_conversation</argument>
            <argument name="orderIdField" xsi:type="string">marketplace_rma_conversation.rma_id</argument>
            <argument name="joins" xsi:type="array">
                <item name="marketplace_rma_details" xsi:type="array">
                    <item name="table" xsi:type="string">marketplace_rma_details</item>
                    <item name="origin_column" xsi:type="string">rma_id</item>
                    <item name="target_column" xsi:type="string">id</item>
                </item>
            </argument>
            <argument name="columns" xsi:type="array">
                <item name="entity_id" xsi:type="string">marketplace_rma_conversation.rma_id</item>
            </argument>
        </arguments>
    </virtualType>
    <type name="Webkul\MpRmaSystem\Model\ResourceModel\GridPool">
        <arguments>
            <argument name="grids" xsi:type="array">
                <item name="order_grid" xsi:type="object">Webkul\MpRmaSystem\Model\ResourceModel\Details\Grid</item>
                <item name="invoice_grid" xsi:type="object">Webkul\MpRmaSystem\Model\ResourceModel\Conversation\Grid</item>
            </argument>
        </arguments>
    </type>
    <virtualType name="Webkul\MpRmaSystem\Model\ResourceModel\Conversation\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
        <arguments>
            <argument name="mainTable" xsi:type="string">marketplace_rma_conversation</argument>
            <argument name="resourceModel" xsi:type="string">Webkul\MpRmaSystem\Model\ResourceModel\Conversation</argument>
        </arguments>
    </virtualType>
    <virtualType name="MpRmaSystemGirdFilterPool" type="Magento\Framework\View\Element\UiComponent\DataProvider\FilterPool">
        <arguments>
            <argument name="appliers" xsi:type="array">
                <item name="regular" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\RegularFilter</item>
                <item name="fulltext" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\FulltextFilter</item>
            </argument>
        </arguments>
    </virtualType>
    <virtualType name="ProductGirdFilterPool" type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider">
        <arguments>
            <argument name="collection" xsi:type="object" shared="false">Webkul\MpRmaSystem\Model\ResourceModel\Reasons\Collection</argument>
            <argument name="collection" xsi:type="object" shared="false">Webkul\MpRmaSystem\Model\ResourceModel\Details\Collection</argument>
            <argument name="collection" xsi:type="object" shared="false">Webkul\MpRmaSystem\Model\ResourceModel\Conversation\Collection</argument>
            <argument name="filterPool" xsi:type="object" shared="false">MpRmaSystemGirdFilterPool</argument>
        </arguments>
    </virtualType>
    <type name="Webkul\Marketplace\Helper\Data">
        <plugin name="Webkul_MpRmaSystem::MarketplaceHelperData" type="Webkul\MpRmaSystem\Plugin\Helper\Marketplace\Data" sortOrder="1" />
    </type>
    <type name="\Magento\Customer\Model\Session">
        <plugin name="Webkul_MpRmaSystem::authenticate" type="Webkul\MpRmaSystem\Plugin\Model\Customer\Session" sortOrder="1" />
    </type>
</config>
