<?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\Quote\Model\CouponManagement" type="Yeboyebo\Bonos\Model\CouponManagement" />

    <preference for="\Magento\SalesRule\Model\Rule\Action\Discount\CartFixed" type="Yeboyebo\Bonos\Model\Rule\Action\Discount\CartFixed" />

    <type name="Magento\Quote\Api\CartTotalRepositoryInterface">
        <plugin name="yeboyebo_bonos_add_quote_data" type="Yeboyebo\Bonos\Plugin\Cart\Totals\TotalsConverterPlugin"/>
    </type>

    <preference for="\Magento\SalesRule\Model\Rule\Action\Discount\ByPercent" type="Yeboyebo\Bonos\Model\Rule\Action\Discount\ByPercent" />
    <preference for="\Magento\SalesRule\Model\RulesApplier" type="Yeboyebo\Bonos\Model\RulesApplier" />

    <type name="Magento\Rule\Model\Condition\AbstractCondition">
        <plugin name="AbstractConditionPlugin" type="Yeboyebo\Bonos\Plugin\Condition\AbstractConditionPlugin"/>
    </type>

    <!-- Promocion El Ganso x UCM -->
    <type name="Magento\SalesRule\Model\Utility">
        <plugin name="yeboyebo_bonos_promocion_ucm" type="Yeboyebo\Bonos\Plugin\SalesRule\UtilityPlugin"/>
    </type>
    <type name="Magento\SalesRule\Model\Validator">
        <plugin name="yeboyebo_bonos_promocion_ucm" type="Yeboyebo\Bonos\Plugin\SalesRule\ValidatorPlugin"/>
    </type>

    <preference for="Yeboyebo\Bonos\Api\GenerateCouponInterface" type="Yeboyebo\Bonos\Model\GenerateCoupon"/>
    <preference for="Yeboyebo\Bonos\Api\Data\CouponResponseInterface" type="Yeboyebo\Bonos\Model\Data\CouponResponse" />

    <!-- COMENTAMOS LA SOBREESCRITURA DEL FICHERO USAR PLUGIN -->
    <!-- <preference for="\MageMe\WebForms\Controller\Form\Submit" type="Yeboyebo\Bonos\Form\Submit"/>
    <preference for="\MageMe\WebForms\Helper\Result\PostHelper" type="Yeboyebo\Bonos\Form\PostHelper"/> -->
</config>