<?xml version="1.0"?>
<!--
/**
 * Magetop
 *
 * @category  Magetop Extensions
 * @package   Magetop_Quotesystem
 * @author    Magetop Developer
 * @copyright Copyright (c) Magetop (https://www.magetop.com)
 * @license   https://www.magetop.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\Customer\CustomerData\SectionPoolInterface">
        <arguments>
            <argument name="sectionSourceMap" xsi:type="array">
                <item name="cart" xsi:type="string">Magento\Checkout\CustomerData\Cart</item>
                <item name="directory-data" xsi:type="string">Magento\Checkout\CustomerData\DirectoryData</item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\Checkout\Block\Checkout\LayoutProcessor">
        <plugin name="Magetop_Quotesystem::aroundProcess" type="Magetop\Quotesystem\Plugin\DiscountConfigureProcess"/>
    </type>
    <preference for="Magento\Catalog\Pricing\Render" type="Magetop\Quotesystem\Pricing\Render" />
    <type name="Magento\Catalog\Block\Product\View\Options\AbstractOptions">
        <plugin name="Magetop_Quotesystem::afterFormatPrice" type="Magetop\Quotesystem\Plugin\Catalog\Block\Product\View\Options\AbstractOptions" />
    </type>
    <type name="Magento\Catalog\Block\Product\ListProduct">
        <plugin name="Magetop_Quotesystem::afterGetProductPriceList" type="Magetop\Quotesystem\Plugin\Catalog\Block\Product\ListProduct" />
    </type>
    <type name="Magento\CatalogSearch\Model\Layer\Category\ItemCollectionProvider">
        <plugin name="Magetop_Quotesystem::afterItemCollectionProvider" type="Magetop\Quotesystem\Plugin\CatalogSearch\Model\Layer\Category\ItemCollectionProvider" />
    </type>
    <type name="Magento\Catalog\Model\Layer\Search\ItemCollectionProvider">
        <plugin name="Magetop_Quotesystem::afterSearchItemCollectionProvider" type="Magetop\Quotesystem\Plugin\Catalog\Model\Layer\Search\ItemCollectionProvider" />
    </type>
    <type name="Magento\CatalogWidget\Block\Product\ProductsList">
        <plugin name="Magetop_Quotesystem::afterGetProductPriceHtmlCms" type="Magetop\Quotesystem\Plugin\CatalogWidget\Block\Product\ProductsList" />
    </type>
    <type name="Magetop\Quotesystem\Block\Product\ListProduct">
        <plugin name="Magetop_Quotesystem::beforeGetProductPrice1" type="Magetop\Quotesystem\Plugin\Product\ListProduct" />
    </type>
    <virtualType name="Magento\CatalogSearch\Block\SearchResult\ListProduct" type="Magetop\Quotesystem\Block\Product\ListProduct">
        <arguments>
            <argument name="catalogLayer" xsi:type="object">Magento\Catalog\Model\Layer\Search</argument>
        </arguments>
    </virtualType>
    <preference for="Magento\Wishlist\CustomerData\Wishlist" type="Magetop\Quotesystem\CustomerData\Rewrite\Wishlist" />
    <preference for="Magento\Sales\CustomerData\LastOrderedItems" type="Magetop\Quotesystem\CustomerData\Rewrite\LastOrderedItems" />

    <type name="Magento\Customer\CustomerData\SectionPoolInterface">
        <arguments>
            <argument name="sectionSourceMap" xsi:type="array">
                <item name="quotesection" xsi:type="string">Magetop\Quotesystem\CustomerData\QuoteSection</item>
            </argument>
        </arguments>
    </type>

    <type name="Magento\Catalog\Model\Product">
        <plugin name="Magetop_Quotesystem::afterIsAvailable" type="Magetop\Quotesystem\Plugin\Catalog\Model\Product" sortOrder="10" disabled="false"  />
    </type>
</config>