<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <!-- Enriquece los items del minicart con datos de rebaja (elg_*) -->
    <type name="Magento\Checkout\CustomerData\DefaultItem">
        <plugin name="elg_enrich_cart_item_default"
                type="Yeboyebo\CheckoutShopify\Plugin\CustomerData\EnrichCartItemPlugin"
                sortOrder="10"/>
    </type>

    <!-- Recogida (tienda / punto MRW): al cambiar de método de envío aplica la
         dirección del punto o restaura la del cliente -->
    <type name="Hyva\Checkout\Magewire\Checkout\Shipping\MethodList">
        <plugin name="elg_pickup_shipping_method_address"
                type="Yeboyebo\CheckoutShopify\Plugin\Hyva\ShippingMethodListPlugin"
                sortOrder="10"/>
    </type>

    <!-- Total a 0: solo "Pago no requerido" (free), sin tarjeta, PayPal… -->
    <type name="Hyva\Checkout\ViewModel\Checkout\Payment\MethodList">
        <plugin name="elg_free_payment_only"
                type="Yeboyebo\CheckoutShopify\Plugin\Hyva\FreePaymentOnlyPlugin"
                sortOrder="10"/>
    </type>

    <!-- Términos y condiciones: variables de CMS ({{store url="..."}}) en el texto del check y el popup -->
    <type name="Hyva\Checkout\Magewire\Checkout\TermsConditions">
        <plugin name="elg_agreements_cms_filter"
                type="Yeboyebo\CheckoutShopify\Plugin\Hyva\AgreementsCmsFilterPlugin"
                sortOrder="10"/>
    </type>

    <!-- Sobre de regalo: borrar ítem → limpia dedicatoria; solo-sobre → vacía -->
    <type name="Magento\Quote\Model\Quote">
        <plugin name="elg_gift_wrap_remove_item"
                type="Yeboyebo\CheckoutShopify\Plugin\Quote\GiftWrapRemoveItemPlugin"
                sortOrder="20"/>
    </type>
    <type name="Magento\Quote\Model\Quote\Item">
        <plugin name="elg_gift_wrap_item_qty"
                type="Yeboyebo\CheckoutShopify\Plugin\Quote\GiftWrapItemQtyPlugin"
                sortOrder="20"/>
    </type>
</config>
