<?xml version="1.0"?>
<!--
/**
 * @category    WeltPixel
 * @package     WeltPixel_LayeredNavigation
 * @copyright   Copyright (c) 2018 Weltpixel
 * @author      Weltpixel TEAM
 */
 -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <virtualType name="WeltPixel\LayeredNavigation\Block\Navigation\Category"
                 type="WeltPixel\LayeredNavigation\Block\Navigation">
        <arguments>
            <argument name="filterList" xsi:type="object">categoryFilterList</argument>
        </arguments>
    </virtualType>
    <virtualType name="WeltPixel\LayeredNavigation\Block\Navigation\Search"
                 type="WeltPixel\LayeredNavigation\Block\Navigation">
        <arguments>
            <argument name="filterList" xsi:type="object">searchFilterList</argument>
        </arguments>
    </virtualType>

    <!-- @api -->
    <virtualType name="Magento\LayeredNavigationStaging\Block\Navigation\Category" type="WeltPixel\LayeredNavigation\Block\Navigation">
        <arguments>
            <argument name="filterList" xsi:type="object">categoryFilterList</argument>
        </arguments>
    </virtualType>
    <!-- @api -->
    <virtualType name="Magento\LayeredNavigationStaging\Block\Navigation\Search" type="WeltPixel\LayeredNavigation\Block\Navigation">
        <arguments>
            <argument name="filterList" xsi:type="object">searchFilterList</argument>
        </arguments>
    </virtualType>

    <preference for="Magento\LayeredNavigation\Block\Navigation\Category"
                type="WeltPixel\LayeredNavigation\Block\Navigation\Category"/>

    <preference for="Magento\LayeredNavigation\Block\Navigation\FilterRenderer"
                type="WeltPixel\LayeredNavigation\Block\Navigation\FilterRenderer"/>

    <preference for="Magento\LayeredNavigation\Block\Navigation\State"
                type="WeltPixel\LayeredNavigation\Block\Navigation\State"/>

    <preference for="Magento\Swatches\Block\LayeredNavigation\RenderLayered"
                type="WeltPixel\LayeredNavigation\Block\LayeredNavigation\RenderLayered"/>

    <preference for="Magento\Catalog\Model\ResourceModel\Layer\Filter\Attribute"
                type="WeltPixel\LayeredNavigation\Model\ResourceModel\Layer\Filter\Attribute"/>

    <type name="Amasty\ShopbyBrand\Controller\Index\Index">
        <plugin name="WeltPixel_LayeredNavigation_Ajax_Amasty_ShopBy"
                type="WeltPixel\LayeredNavigation\Plugin\Category\View"></plugin>
    </type>

    <type name="Magento\Catalog\Controller\Category\View">
        <plugin name="WeltPixel_LayeredNavigation_Ajax_Category_View"
                type="WeltPixel\LayeredNavigation\Plugin\Category\View"></plugin>
    </type>

    <type name="Magento\CatalogSearch\Controller\Result\Index">
        <plugin name="WeltPixel_LayeredNavigation_Ajax_CategorSearch_Result"
                type="WeltPixel\LayeredNavigation\Plugin\CatalogSearch\ResultView"></plugin>
    </type>

    <type name="Magento\Catalog\Model\Layer\FilterList">
        <plugin name="WeltPixel_LayeredNavigation_Filter_List"
                type="WeltPixel\LayeredNavigation\Plugin\Layer\FilterList"></plugin>
    </type>

    <type name="Magento\Catalog\Model\Layer\Filter\Item">
        <plugin name="WeltPixel_LayeredNavigation_Item_Url"
                type="WeltPixel\LayeredNavigation\Plugin\Model\Layer\Filter\Item" sortOrder="1"/>
    </type>

    <type name="Magento\Swatches\Block\LayeredNavigation\RenderLayered">
        <plugin name="WeltPixel_LayeredNavigation_Swatches_RenderLayered"
                type="WeltPixel\LayeredNavigation\Plugin\Swatches\RenderLayered" sortOrder="1"/>
    </type>

    <type name="Magento\Catalog\Model\Design">
        <plugin name="WeltPixel_LayeredNavigation_Catalog_Design"
                type="WeltPixel\LayeredNavigation\Plugin\Category\Design" sortOrder="5"/>
    </type>

</config>
