{# Reusable view partials — status badges + empty states. Keeps the resource
   templates declarative and the brand vocabulary in one place. #}

{% macro badge(label, tone="neutral") -%}
<span class="badge badge-{{ tone }}">{{ label }}</span>
{%- endmacro %}

{# Compute → render a server status badge (colour + dot + label). #}
{% macro server_status(status) -%}
{%- set ok = ["ACTIVE", "available", "running"] -%}
{%- set info = ["BUILD", "BUILDING", "REBOOT", "HARD_REBOOT", "RESIZE"] -%}
{%- set warn = ["VERIFY_RESIZE", "PAUSED", "SUSPENDED", "SHUTOFF", "pending"] -%}
{%- if status in ok -%}{{ badge(status, "success") }}
{%- elif status in info -%}{{ badge(status, "info") }}
{%- elif status in warn -%}{{ badge(status, "warning") }}
{%- elif status == "ERROR" -%}{{ badge(status, "danger") }}
{%- else -%}{{ badge(status, "neutral") }}
{%- endif -%}
{%- endmacro %}

{# Volume status badge. #}
{% macro volume_status(status) -%}
{%- if status == "available" -%}{{ badge(status, "success") }}
{%- elif status == "in-use" -%}{{ badge(status, "info") }}
{%- elif status == "error" -%}{{ badge(status, "danger") }}
{%- else -%}{{ badge(status, "neutral") }}
{%- endif -%}
{%- endmacro %}

{# Empty state on the Federation Lattice (Brand Book Part VII — diagrammatic). #}
{% macro empty(title, sub="") -%}
<div class="empty">
  <p class="empty__title">{{ title }}</p>
  {% if sub %}<p>{{ sub }}</p>{% endif %}
</div>
{%- endmacro %}
