<?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="Magento\Catalog\Model\Layer" type="MGS\Brand\Model\Layer"/>
    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="brand_listing_data_source" xsi:type="string">MGS\Brand\Model\Resource\Brand\Grid\Collection</item>
            </argument>
        </arguments>
    </type>
    <type name="MGS\Brand\Model\Resource\Brand\Grid\Collection">
        <arguments>
            <argument name="mainTable" xsi:type="string">mgs_brand</argument>
            <argument name="eventPrefix" xsi:type="string">mgs_brand_grid_collection</argument>
            <argument name="eventObject" xsi:type="string">brand_grid_collection</argument>
            <argument name="resourceModel" xsi:type="string">MGS\Brand\Model\Resource\Brand</argument>
        </arguments>
    </type>
    <type name="MGS\Brand\Model\Layer\Resolver">
        <arguments>
            <argument name="layersPool" xsi:type="array">
                <item name="brand" xsi:type="string">MGS\Brand\Model\Layer\Brand</item>
            </argument>
        </arguments>
    </type>
    <type name="MGS\Brand\Model\Layer\Brand">
        <arguments>
            <argument name="context" xsi:type="object">Magento\Catalog\Model\Layer\Category\Context</argument>
        </arguments>
    </type>
    <type name="MGS\Brand\Block\Brand\Product\ListProduct">
        <arguments>
            <argument name="layerResolver" xsi:type="object">MGS\Brand\Model\Layer\Resolver</argument>
        </arguments>
    </type>
    <virtualType name="BrandGirdFilterPool" 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="BrandGridDataProvider" type="MGS\Brand\Ui\DataProvider\Brand\BrandDataProvider">
        <arguments>
            <argument name="filterPool" xsi:type="object" shared="false">BrandGirdFilterPool</argument>
        </arguments>
    </virtualType>
    <preference for="Magento\Store\Model\ResourceModel\Store" type="MGS\Brand\Model\Rewrite\ResourceModel\Store" />
</config>