<?xml version="1.0"?>
<!--
/**
 * Simplyin HyvaPayment - Success Page Layout XML
 * 
 * Adds payment status template to the Hyva checkout success page
 * 
 * Requirements: 18.1
 * - 18.1: Display payment method with logo and name on success page
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    
    <head>
        <!-- Required utilities for success page -->
        <script src="Simplyin_HyvaPayment::js/session-storage.js" defer="defer"/>
        <script src="Simplyin_HyvaPayment::js/3ds-handler.js" defer="defer"/>
    </head>
    
    <body>
        <!-- CSRF form_key injection for SimplyIN API calls on success page -->
        <referenceContainer name="before.body.end">
            <block class="Magento\Framework\View\Element\Template"
                   name="simplyin.success.csrf.formkey"
                   template="Simplyin_HyvaPayment::checkout/csrf-form-key.phtml"/>
        </referenceContainer>

        <!-- Add Simplyin payment status to the success page content -->
        <referenceContainer name="content">
            <!-- Payment Status Display -->
            <block class="Magento\Framework\View\Element\Template"
                   name="simplyin.success.payment.status"
                   template="Simplyin_HyvaPayment::success/payment-status.phtml"
                   after="-">
                <arguments>
                    <argument name="payment_config" xsi:type="object">Simplyin\HyvaPayment\ViewModel\PaymentConfig</argument>
                    <argument name="checkout_config" xsi:type="object">Simplyin\HyvaPayment\ViewModel\CheckoutConfig</argument>
                </arguments>
            </block>
        </referenceContainer>
    </body>
</page>
