<?xml version="1.0"?>
<!--
/**
 * BSS Commerce Co.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://bsscommerce.com/Bss-Commerce-License.txt
 *
 * @category   BSS
 * @package    Bss_MultiStoreViewPricing
 * @author     Extension Team
 * @copyright  Copyright (c) 2017-2018 BSS Commerce Co. ( http://bsscommerce.com )
 * @license    http://bsscommerce.com/Bss-Commerce-License.txt
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
	<preference for="Magento\Catalog\Model\Config\Source\Price\Scope" type="Bss\MultiStoreViewPricing\Model\Config\Source\Price\Scope" />

	<preference for="Magento\OfflineShipping\Model\ResourceModel\Carrier\Tablerate" type="Bss\MultiStoreViewPricing\Model\OfflineShipping\ResourceModel\Carrier\Tablerate" />

	<preference for="Magento\OfflineShipping\Model\ResourceModel\Carrier\Tablerate\RateQuery" type="Bss\MultiStoreViewPricing\Model\OfflineShipping\ResourceModel\Carrier\Tablerate\RateQuery" />

	<preference for="Magento\OfflineShipping\Block\Adminhtml\Carrier\Tablerate\Grid" type="Bss\MultiStoreViewPricing\Block\OfflineShipping\Adminhtml\Carrier\Tablerate\Grid" />

	<preference for="Magento\OfflineShipping\Controller\Adminhtml\System\Config\ExportTablerates" type="Bss\MultiStoreViewPricing\Controller\OfflineShipping\Adminhtml\System\Config\ExportTablerates" />

	<preference for="Magento\OfflineShipping\Block\Adminhtml\Form\Field\Export" type="Bss\MultiStoreViewPricing\Block\OfflineShipping\Adminhtml\Form\Field\Export" />

	<preference for="Magento\Bundle\Pricing\Price\BundleSelectionPrice" type="Bss\MultiStoreViewPricing\Pricing\Bundle\BundleSelectionPrice" />

	<preference for="Magento\Catalog\Model\ResourceModel\Product\Option" type="Bss\MultiStoreViewPricing\Model\ResourceModel\Product\Option" />
	<preference for="Magento\Catalog\Model\ResourceModel\Product\Option\Value" type="Bss\MultiStoreViewPricing\Model\ResourceModel\Product\Option\Value" />

	<type name="Magento\Catalog\Model\Product\Attribute\Backend\Price">
        <plugin name="Bss_MultiStoreViewPricing::Product_Attribute_Backend_Price" type="Bss\MultiStoreViewPricing\Plugin\Product\Attribute\Backend\Price" />
    </type>

	<type name="Magento\SalesRule\Model\Rule\Action\Discount\ByFixed">
		<plugin name="Bss_MultiStoreViewPricing::SalesRule_Rule_Action_Discount_ByFixed"
				type="Bss\MultiStoreViewPricing\Plugin\SalesRule\Model\Rule\Action\Discount\Fixed"
				sortOrder="0"/>
	</type>

	<type name="Magento\SalesRule\Model\Rule\Action\Discount\ToFixed">
		<plugin name="Bss_MultiStoreViewPricing::SalesRule_Rule_Action_Discount_ToFixed"
				type="Bss\MultiStoreViewPricing\Plugin\SalesRule\Model\Rule\Action\Discount\Fixed"
				sortOrder="0"/>
	</type>

	<type name="Magento\SalesRule\Model\Rule\Action\Discount\CartFixed">
		<plugin name="Bss_MultiStoreViewPricing::SalesRule_Rule_Action_Discount_CartFixed"
				type="Bss\MultiStoreViewPricing\Plugin\SalesRule\Model\Rule\Action\Discount\Fixed"
				sortOrder="0"/>
	</type>

	<type name="Magento\Rule\Model\Condition\AbstractCondition">
        <plugin name="bss_action_abstractcondition" type="Bss\MultiStoreViewPricing\Plugin\Rule\Item\AbstractCondition" sortOrder="1"/>
    </type>
    
    <!-- work with elasticsearch -->
    <type name="Magento\AdvancedSearch\Model\ResourceModel\Index">
        <plugin name="reindex-price-work-elasticsearch" type="Bss\MultiStoreViewPricing\Plugin\AdvancedSearchIndex" sortOrder="10"/>
    </type>
</config>
