{# Parameters:
  - variant (string) (default: 'neutral')
    - options: ['eu', 'ec', 'neutral']
  - rows (object[]) (default: []) - format:
  [
    {
      extra_classes: ""
      cols: [
        {
          classes: "",
          items: [
            {
              type: "links" or "content" or "image",
              -- for type "links" --
                links: (link[]),

              -- for type "image" --
                path: "",
                alt: "",
                classes: ""

              -- for type "content" --
                content: "",
            },
          ]
        }
      ]
    }
  ]
  - attributes (drupal attrs)
#}

{%- set _variant = variant|default('neutral') %}
{% set _rows = rows|default([]) %}

{%- if attributes is empty %}
  {%- set attributes = create_attribute() %}
{% endif %}

{%- set attributes = attributes.addClass(['bcl-footer', 'bcl-footer--' ~ _variant]) -%}

<footer
  {{ attributes }}
>{# -#}
  <div class="container">
    {%- if rows is not empty and rows is iterable %}
      {%- for row in _rows -%}
        <div class="{{ row.extra_classes ? row.extra_classes ~ ' row' : 'row' }}">
          {%- for col in row.cols -%}
            <div class="{{ col.classes }}">
              {%- if col.items is not empty and col.items is iterable %}
                {%- for item in col.items %}
                  {%- if item.type == 'image' -%}
                    <img
                      {% if item.path is not empty %}
                        src="{{ item.path }}"
                      {% endif %}
                      {%- if item.alt is not empty %}
                        alt="{{ item.alt }}"
                      {% endif %}
                      {%- if item.classes is not empty %}
                        class="{{ item.classes }}"
                      {% endif %}
                    >
                  {%- endif %}
                  {%- if item.type == 'content' %}
                    {{- item.content }}
                  {%- endif %}
                  {%- if item.type == 'links' %}
                    {%- for link in item.links -%}
                      <div class="mb-1">
                      {%- include '@oe-bcl/bcl-link/link.html.twig' with link|merge({
                        attributes: create_attribute().addClass(['standalone'])
                      }) only -%}
                      </div>
                    {%- endfor %}
                  {%- endif %}
                {%- endfor %}
              {%- endif -%}
            </div>
          {%- endfor -%}
        </div>
      {%- endfor %}
    {%- endif -%}
  </div>{# -#}
</footer>
{#--#}
