{#
/**
 * @file
 * Default theme implementation to status_property_element.
 *
 * Available variables:
 * - element: Element that will be rendered.
 * - element['value'] : the status string.
 *
 * @ingroup themeable
 */
#}
{% set statuses = {
  approved: 'success',
  active: 'success',
  revoked: 'danger',
  expired: 'warning',
  pending: 'warning',
} %}

{% set type = statuses[element.value|trim|lower]|default('info') %}
{% set content = element.value|capitalize %}

{% set classes = [
  'badge',
  type ? 'bg-' ~ type,
]|merge(block_utility_classes ? block_utility_classes : []) %}

{% set warning =  type == 'warning' ? "text-bg-warning text-dark" %}

{% set html_tag = html_tag ?? 'span' %}

{% if url %}
  {% set html_tag = 'a' %}
  {% set url = url|render %}
{% endif %}

{% if content %}
  <{{ html_tag }} {{ url ? 'href=' ~ url }} class="{{ classes|join(' ') }} {{ warning }}">

  {% block content %}
    {{ content }}
  {% endblock %}

  </{{ html_tag }}>
{% endif %}
