{% embed "system/embed/card/card-with-info-panel.html.twig" %}
    {% import "system/macro/card/card-heading.html.twig" as card_heading %}

    {% block mainHeader %}
        {{ card_heading.component({
            title: localized.headline.contentBlockerSettings,
        }) }}
    {% endblock %}

    {% block mainContent %}
        {% import "system/macro/row/input.html.twig" as row_input %}
        {% import "system/macro/row/language-name.html.twig" as row_language_name %}
        {% import "system/macro/row/save.html.twig" as row_save %}
        {% import "system/macro/row/switch-button.html.twig" as row_switch_button %}

        {{ row_input.component({
            errorMessage: localized.validation.key,
            hint: localized.hint.key,
            id: 'key',
            isDisabled: isCreateAction ? false : true,
            isRequired: isCreateAction ? true : false,
            label: localized.field.key,
            value: data.key,
        }) }}

        {% if isEditAction %}
            {{ row_input.component({
                clipboard: true,
                hint: localized.hint.shortcode,
                id: 'shortcode',
                isDisabled: true,
                isRequired: false,
                label: localized.field.shortcode,
                value: "[borlabs-cookie id=\"#{data.key}\" type=\"content-blocker\"]#{localized.placeholder.blockThis | raw}[/borlabs-cookie]",
            }, localized) }}
        {% endif %}

        {{ row_switch_button.component({
            hint: localized.hint.status,
            id: 'status',
            label: localized.field.status,
            value: data.status,
        }) }}

        {{ row_language_name.component({
            language: data.language,
        }, localized) }}

        <!-- Synchronization Settings -->
        {{ synchronizationSettingsFields(
            languages,
            {
                collectionName: "languages",
                hasRepository: true,
                isCreateAction: isCreateAction,
            }
        ) | raw }}

        {{ row_save.component({
            action: 'save',
            backLink: "?page=#{controllerId}",
            nonce: wpNonceField("#{controllerId}-#{data.id}-save"),
            value: data.id,
        }, localized) }}
    {% endblock %}

    {% block infoPanelHeader %}
        {{ localized.global.headline.thingsToKnow | raw }}
    {% endblock %}

    {% block infoPanelContent %}
        {% embed "system/embed/accordion/accordion-group.html.twig" %}
            {% block content %}
                {% embed "system/embed/accordion/accordion.html.twig" with {id: 'accordionShortcodeExplained', expanded: true} %}
                    {% block title %}
                        {{ localized.thingsToKnow.headlineShortcode | raw }}
                    {% endblock %}

                    {% block content %}
                        <p>{{ localized.thingsToKnow.shortcodeExplained | raw }}</p>

                        {% if isCreateAction %}
                            <div class="brlbs-cmpnt-alert brlbs-cmpnt-alert-info">
                                {{ localized.thingsToKnow.shortcodesAvailableAfterCreation | raw }}
                            </div>
                        {% endif %}
                    {% endblock %}
                {% endembed %}
            {% endblock %}
        {% endembed %}
    {% endblock %}
{% endembed %}
