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

  {% set statuses = [
    {'status':'good', 'icon_left': global_status_icon_good|default('far fa-check-circle')},
    {'status':'minor', 'icon_left': global_status_icon_minor|default('far fa-exclamation-circle')},
    {'status':'major', 'icon_left': global_status_icon_major|default('far fa-exclamation-triangle')},
    {'status':'incidents', 'icon_left': global_status_icon_incidents|default(["far fa-hexagon", "fas fa-exclamation"])},
    {'status':'stationalert', 'icon_left': global_status_icon_stationalert|default('far fa-info-circle')},
    {'status':'noservice', 'icon_left': global_status_icon_noservice|default('far fa-ban')},
    {'status':'amended', 'icon_left': global_status_icon_amended|default(["far fa-circle", "fas fa-pen"])},
    {'status':'strike', 'icon_left': global_status_icon_strike|default(["far fa-hexagon", "fas fa-user"])},
    {'status':'replacement', 'icon_left': global_status_icon_replacement|default(["far fa-circle", "fas fa-bus"])},
    {'status':'weather', 'icon_left': global_status_icon_weather|default(["far fa-triangle", "far fa-clouds"])},
    {'status':'planned', 'icon_left': global_status_icon_planned|default(["far fa-hexagon", "fas fa-calendar-times"])},
    {'status':'engineering', 'icon_left': global_status_icon_engineering|default(["far fa-circle", "fas fa-wrench"])},
  ] %}

  {% 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 icon_right = icon_right ? icon_right : item.icon_right %}
      {% 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 %}
        {% if icon_stack_fa %}
          <span class="fa-stack">
            <i class="{{ icon_left[0] }} fa-stack-2x icon-stacked belil"></i>
            <i class="{{ icon_left[1] }} fa-stack-1x icon-stacked belil"></i>
          </span>
        {% else %}
          <span class="f-stack">
            <i class="{{ icon_left[0] }} beli belil"></i>
            <i class="{{ icon_left[1] }} beli belil"></i>
          </span>
        {% endif %}
      {% else %}
        <i class="{{ icon_left }} {{ iclass }} beli belil"></i>
      {% endif %}
    {% endif %}

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

{% endmacro %}
