<!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
{% block sw_extension_sdk_module %}
<sw-page
    class="sw-extension-sdk-module"
    :show-search-bar="showSearchBar"
    :show-smart-bar="showSmartBar"
>
    <template
        v-if="showSmartBar"
        #smart-bar-header
    >
        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_extension_sdk_module_header %}
        <template v-if="!isLoading">
            <h2>{{ $tc(module.heading ?? '') }}</h2>
        </template>
        {% endblock %}
    </template>

    <template
        v-if="showSmartBar && back"
        #smart-bar-back
    >
        <router-link
            :to="{ name: back }"
        >
            <sw-icon
                name="regular-chevron-left"
                small
            />
        </router-link>
    </template>

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_extension_sdk_module_smart_bar_buttons %}
    <template
        v-if="showSmartBar"
        #smart-bar-actions
    >
        <sw-button
            v-for="button in smartBarButtons"
            :id="button.buttonId"
            :key="button.buttonId"
            :disabled="button.disabled"
            :variant="button.variant"
            @click="button.onClickCallback"
        >
            {{ $tc(button.label ?? '') }}
        </sw-button>
    </template>
    {% endblock %}

    <template #content>
        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_extension_sdk_module_content %}
        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_extension_sdk_module_content_iframe_renderer %}
        <sw-iframe-renderer
            v-if="!isLoading"
            ref="iframeRenderer"
            :src="module.baseUrl"
            :location-id="module.locationId"
            full-screen
        />
        {% endblock %}

        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_extension_sdk_module_content_loader %}
        <sw-loader v-else-if="!timedOut" />
        {% endblock %}

        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_extension_sdk_module_content_error_state %}
        <sw-my-apps-error-page v-if="timedOut" />
        {% endblock %}
        {% endblock %}
    </template>

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_extension_sdk_module_language_switch %}
    <template
        v-if="showSmartBar && showLanguageSwitch"
        #language-switch
    >
        <sw-language-switch
            :change-global-language="true"
            @on-change="onChangeLanguage"
        />
    </template>
    {% endblock %}
</sw-page>
{% endblock %}
