{# legend 
 @param {string} lang The language used. Can be 'en','el'. Optional. 
 @param {object} legend The legend text. Will escape text. Example `{en:"Content",el:"Περιεχομένο"}` 
 @param {string} id The legend id. Will escape text 
 @param {boolean} isPageHeading Is the legend also the page heading? Optional, default is false. Can be true,false 
 @param {string} classes Additional classes to add to the outer div. Optional 
 @returns govcy legend html 
#}
{% macro legend(params) -%}
{#- Import localizer from utilities -#}
{%- from "../utilities/govcyUtilities.njk" import govcyLocalizeContent, govcyLangAttribute -%}
{# set default values #}
{%- set isPageHeading = params.isPageHeading | default(false) -%}
{# legend is mandatory #}
{%- if params.legend -%}
    {%- if isPageHeading -%}
        <legend {% if params.id %}id="{{ params.id }}" {% endif %}class="govcy-legend{% if params.classes %} {{ params.classes }}{% endif %}"{{ govcyLangAttribute(params.lang) }}><h1>{{ govcyLocalizeContent(params.legend , params.lang) }}</h1></legend>
    {%- else -%}
        <legend {% if params.id %}id="{{ params.id }}" {% endif %}class="govcy-legend{% if params.classes %} {{ params.classes }}{% endif %}"{{ govcyLangAttribute(params.lang) }}>{{ govcyLocalizeContent(params.legend , params.lang) }}</legend>
    {%- endif -%}
{%- endif -%}
{%- endmacro %}