<?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="DJOGlobal\PromotionsBar\Api\Data\PromotionsBarInterface" type="DJOGlobal\PromotionsBar\Model\PromotionsBar"/>
    <preference for="DJOGlobal\PromotionsBar\Api\PromotionsBarRepositoryInterface" type="DJOGlobal\PromotionsBar\Model\PromotionsBarRepository"/>

    <!-- admin grid -->

    <virtualType name="DJOGlobalPromotionsBarGridFilterPool" 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="DJOGlobalPromotionsBarGridDataProvider" type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider">
        <arguments>
            <argument name="collection" xsi:type="object" shared="false">DJOGlobal\PromotionsBar\Model\ResourceModel\PromotionsBar\Collection</argument>
            <argument name="filterPool" xsi:type="object" shared="false">DJOGlobalPromotionsBarGridFilterPool</argument>
        </arguments>
    </virtualType>

    <type name="DJOGlobal\PromotionsBar\Model\ResourceModel\PromotionsBar\Grid\Collection">
        <arguments>
            <argument name="mainTable" xsi:type="string">djo_promotions_bar</argument>
            <argument name="eventPrefix" xsi:type="string">djo_promotionsbar_grid_collection</argument>
            <argument name="eventObject" xsi:type="string">promotionsbar_grid_collection</argument>
            <argument name="resourceModel" xsi:type="string">DJOGlobal\PromotionsBar\Model\ResourceModel\PromotionsBar</argument>
        </arguments>
    </type>

    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="djo_promotionsbar_listing_data_source" xsi:type="string">DJOGlobal\PromotionsBar\Model\ResourceModel\PromotionsBar\Grid\Collection</item>
            </argument>
        </arguments>
    </type>
</config>
