{% macro status(status, icon_left, tag_name, class, attributes, iclass, content) %}

  {% set statuses = [
    {'status':'good', 'icon_left': global_status_icon_good|default('fas fa-check-circle')},
    {'status':'minor', 'icon_left': global_status_icon_minor|default('fas fa-exclamation-circle')},
    {'status':'major', 'icon_left': global_status_icon_major|default('fas fa-exclamation-triangle')},
    {'status':'incidents', 'icon_left': global_status_icon_incidents|default('fas fa-exclamation-circle')},
    {'status':'stationalert', 'icon_left': global_status_icon_stationalert|default('fas fa-info-circle')},
    {'status':'noservice', 'icon_left': global_status_icon_noservice|default('fas fa-exclamation-circle')},
    {'status':'amended', 'icon_left': global_status_icon_amended|default('fas fa-exclamation-circle')},
    {'status':'strike', 'icon_left': global_status_icon_strike|default('fas fa-exclamation-circle')},
  ] %}

  {% set tag_name = tag_name|default('span') %}
  {% set attributes = attributes|default('') %}
  {% set iclass = iclass|default('') %}
  {% set content = content|default('') %}

  {% for item in statuses %}
    {% if status == item.status %}
      {% set icon_left = icon_left ? icon_left : item.icon_left %}
      {% set class = [status, class]|join(' ') %}
    {% endif %}
  {% endfor %}

  <{{ tag_name }} {{ attributes }}{% if class %} class="{{ class }}"{% endif %}>
    {% if icon_left is not empty %}
      {% if icon_left is iterable %}
        <span class="f-stack">
            <i class="{{ icon_left[0] }} {{ iclass }}"></i>
            <i class="{{ icon_left[1] }} {{ iclass }}"></i>
          </span>
      {% else %}
        <i class="{{ icon_left }} {{ iclass }}"></i>
      {% endif %}
    {% endif %}

    {{ content }}
  </{{ tag_name }}>

{% endmacro %}
