<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <!-- Logger definition -->
    <type name="Quantilus\VersaPayDebug\Logger\Handler">
        <arguments>
            <argument name="filesystem" xsi:type="object">Magento\Framework\Filesystem\Driver\File</argument>
        </arguments>
    </type>
    <type name="Quantilus\VersaPayDebug\Logger\Logger">
        <arguments>
            <argument name="name" xsi:type="string">versapay_debug</argument>
            <argument name="handlers" xsi:type="array">
                <item name="system" xsi:type="object">Quantilus\VersaPayDebug\Logger\Handler</item>
            </argument>
        </arguments>
    </type>

    <!-- Plugins -->
    <!-- Custom Quantilus VersaPay Sales controller (if used) -->
    <type name="Quantilus\Versapay\Controller\Sales\Index">
        <plugin name="quantilus_versapaydebug_index_plugin" type="Quantilus\VersaPayDebug\Plugin\IndexControllerPlugin" sortOrder="10"/>
    </type>

    <!-- Vendor Versapay Sales controller (the actual one called on Place Order) -->
    <type name="Versapay\Versapay\Controller\Sales\Index">
        <plugin name="quantilus_versapaydebug_vendor_index_plugin" type="Quantilus\VersaPayDebug\Plugin\IndexControllerPlugin" sortOrder="10"/>
    </type>

    <type name="Versapay\Versapay\Controller\Sales\Savetransaction">
        <plugin name="quantilus_versapaydebug_savetransaction_plugin" type="Quantilus\VersaPayDebug\Plugin\SaveTransactionControllerPlugin" sortOrder="10"/>
    </type>

    <type name="Magento\Checkout\Api\ShippingInformationManagementInterface">
        <plugin name="quantilus_versapaydebug_shipping_information" type="Quantilus\VersaPayDebug\Plugin\ShippingInformationManagementPlugin" sortOrder="10"/>
    </type>

    <type name="Magento\Checkout\Api\GuestShippingInformationManagementInterface">
        <plugin name="quantilus_versapaydebug_guest_shipping_information" type="Quantilus\VersaPayDebug\Plugin\ShippingInformationManagementPlugin" sortOrder="10"/>
    </type>

    <type name="Magento\Checkout\Api\PaymentInformationManagementInterface">
        <plugin name="quantilus_versapaydebug_payment_information" type="Quantilus\VersaPayDebug\Plugin\PaymentInformationManagementPlugin" sortOrder="10"/>
    </type>

    <type name="Magento\Checkout\Api\GuestPaymentInformationManagementInterface">
        <plugin name="quantilus_versapaydebug_guest_payment_information" type="Quantilus\VersaPayDebug\Plugin\GuestPaymentInformationManagementPlugin" sortOrder="10"/>
    </type>
</config>
