<!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
{% block sw_cms_create_wizard %}
<div class="sw-cms-create-wizard">
    <div class="sw-cms-create-wizard__inner">

        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_cms_create_wizard_first_step %}
        <div
            v-if="step === 1"
            class="sw-cms-create-wizard__step-1"
        >
            <h2 class="sw-cms-create-wizard__title">
                {{ $tc('sw-cms.createWizard.choosePageTypeTitle') }}
            </h2>

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_cms_create_wizard_page_type %}
            <div class="sw-cms-create-wizard__page-type-selection">
                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_cms_create_wizard_page_type_options %}
                <div
                    v-for="pageType in visiblePageTypes"
                    :key="pageType.name"
                    class="sw-cms-create-wizard__page-type"
                    :class="pageType.class"
                    role="button"
                    tabindex="0"
                    @click="onPageTypeSelect(pageType.name)"
                    @keyup.enter="onPageTypeSelect(pageType.name)"
                >
                    <sw-icon
                        :name="pageType.icon"
                        size="24"
                    />
                    <p>{{ $tc(pageType.title) }}</p>
                </div>
                {% endblock %}
            </div>
            {% endblock %}

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_cms_create_wizard_first_step_abort %}
            <router-link
                class="sw-cms-create-wizard__back"
                :to="{ name: 'sw.cms.index' }"
            >
                <sw-icon
                    name="regular-times-s"
                    small
                /> {{ $tc('global.default.cancel') }}
            </router-link>
            {% endblock %}

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_cms_create_wizard_first_step_helptext %}
            <p class="sw-cms-create-wizard__step1-helptext">
                {{ $tc('sw-cms.createWizard.choosePageTypeHelpText') }}
            </p>
            {% endblock %}

        </div>
        {% endblock %}

        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_cms_create_wizard_second_step %}
        <div
            v-if="step === 2"
            class="sw-cms-create-wizard__step-2"
        >
            <h2 class="sw-cms-create-wizard__title">
                {{ $tc('sw-cms.createWizard.chooseSectionTitle') }}
            </h2>

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_cms_create_wizard_section %}
            <div class="sw-cms-create-wizard__section-selection">
                <sw-cms-stage-section-selection @section-select="onSectionSelect" />
            </div>
            {% endblock %}

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_cms_create_wizard_second_step_back %}
            <div
                class="sw-cms-create-wizard__back"
                role="button"
                tabindex="0"
                @click="goToStep('pageType')"
                @keydown.enter="goToStep('pageType')"
            >
                <sw-icon
                    name="regular-long-arrow-left"
                    small
                /> {{ $tc('sw-cms.createWizard.stepBack') }}
            </div>
            {% endblock %}

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_cms_create_wizard_second_step_helptext %}
            <p class="sw-cms-create-wizard__step2-helptext">
                {{ $tc('sw-cms.createWizard.chooseSectionHelpText') }}
            </p>
            {% endblock %}
        </div>
        {% endblock %}

        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_cms_create_wizard_third_step %}
        <div
            v-if="step === 3"
            class="sw-cms-create-wizard__step-3"
        >
            <h2 class="sw-cms-create-wizard__title">
                {{ $tc('sw-cms.createWizard.chooseNameTitle') }}
            </h2>

            <div class="sw-cms-create-wizard__name-select">
                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_cms_create_wizard_page_preview %}
                <div class="sw-cms-create-wizard__page-preview">
                    <div
                        class="sw-cms-create-wizard__preview_image"
                        :style="pagePreviewStyle"
                    ></div>
                    <div class="sw-cms-create-wizard__preview_info">
                        <sw-icon
                            :name="currentPageType?.icon"
                            size="16"
                        />
                        <p>{{ $tc((currentPageType?.title ?? "")) }}</p>
                    </div>
                </div>
                {% endblock %}

                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_cms_create_wizard_page_completion %}
                <div class="sw-cms-create-wizard__page-completion">

                    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                    {% block sw_cms_create_wizard_page_name %}
                    <sw-text-field
                        v-model:value="page.name"
                        class="sw-cms-create-wizard__page-completion-name"
                        :label="$tc('sw-cms.detail.label.pageName')"
                        :placeholder="$tc('sw-cms.detail.label.pageNamePlaceholder')"
                        @keypress.enter="onCompletePageCreation"
                    />
                    {% endblock %}

                    <sw-single-select
                        v-if="isCustomEntityType"
                        v-model:value="page.entity"
                        class="sw-cms-create-wizard__page-completion-custom-entity"
                        :label="$tc('sw-cms.detail.label.pageEntity')"
                        :placeholder="$tc('sw-cms.detail.label.pageEntityPlaceholder')"
                        :options="customEntities"
                        require
                    />

                    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                    {% block sw_cms_create_wizard_page_completion_buttons %}
                    <div class="sw-cms-create-wizard__page-completion-buttons">
                        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                        {% block sw_cms_create_wizard_page_completion_save_button %}
                        <sw-button
                            variant="primary"
                            :disabled="!isCompletable"
                            @click="onCompletePageCreation"
                        >
                            {{ $tc('sw-cms.createWizard.createLayout') }}
                        </sw-button>
                        {% endblock %}
                    </div>
                    {% endblock %}
                </div>
                {% endblock %}
            </div>

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_cms_create_wizard_third_step_back %}
            <div
                class="sw-cms-create-wizard__back"
                role="button"
                tabindex="0"
                @click="goToStep('sectionType')"
                @keydown.enter="goToStep('sectionType')"
            >
                <sw-icon
                    name="regular-long-arrow-left"
                    small
                /> {{ $tc('sw-cms.createWizard.stepBack') }}
            </div>
            {% endblock %}
        </div>
        {% endblock %}
    </div>
</div>
{% endblock %}
