{% extends "casa/layouts/main.njk" %}

{% from "govuk/components/back-link/macro.njk" import govukBackLink %}

{# Automatically apply padding with/without back link #}
{% set mainClasses %}{{ mainClasses }} govuk-main-wrapper--auto-spacing{% endset %}


{% block beforeContent %}
  {# Phase banner #}
  {# TODO: remove phase variable - just get template author to override a `casa/partials/phase_banner.njk` template #}
  {% if casa.phase == 'alpha' %}
    {% include "casa/partials/phase_banner_alpha.njk" %}
  {% elseif casa.phase == 'beta' %}
    {% include "casa/partials/phase_banner_beta.njk" %}
  {% endif %}

  {# Add back link, if appropriate #}
  {% if not inEditMode and casa.journeyPreviousUrl %}
    {{ govukBackLink({
      text: t('common:back'),
      href: casa.journeyPreviousUrl
    }) }}
  {% endif %}
{% endblock %}


{# Use `casaPageTitle` instead of `pageTitle` if you want CASA to automatically prefix with `Error` when appropriate #}
{% block pageTitle -%}
  {{- t("error:documentTtlePrefix") if formErrors -}}
  {% block casaPageTitle %}{% endblock %}
{%- endblock %}
