{% macro stat(title, value, desc="", accent="") %}
<div class="stat">
  <div class="stat-title">{{ title }}</div>
  <div class="stat-value {% if accent %}text-{{ accent }}{% endif %}">{{ value }}</div>
  {% if desc %}<div class="stat-desc">{{ desc }}</div>{% endif %}
</div>
{% endmacro stat %}

{% macro badge(text, kind="neutral") %}
<span class="badge badge-{{ kind }} badge-sm font-mono">{{ text }}</span>
{% endmacro badge %}

{% macro event_badge(event) %}
{% if event == "OntologyChanged" %}
  <span class="badge badge-warning badge-sm">ontology</span>
{% elif event == "AdrChanged" %}
  <span class="badge badge-info badge-sm">adr</span>
{% elif event == "ReflectionChanged" %}
  <span class="badge badge-success badge-sm">reflection</span>
{% else %}
  <span class="badge badge-neutral badge-sm">{{ event }}</span>
{% endif %}
{% endmacro event_badge %}

{% macro actor_badge(actor_type) %}
{% if actor_type == "developer" %}
  <span class="badge badge-primary badge-sm">developer</span>
{% elif actor_type == "agent" %}
  <span class="badge badge-secondary badge-sm">agent</span>
{% elif actor_type == "ci" %}
  <span class="badge badge-accent badge-sm">ci</span>
{% else %}
  <span class="badge badge-neutral badge-sm">{{ actor_type }}</span>
{% endif %}
{% endmacro actor_badge %}

{% macro age(secs) %}
{% if secs < 60 %}{{ secs }}s ago
{% elif secs < 3600 %}{{ secs / 60 | round }}m ago
{% else %}{{ secs / 3600 | round }}h ago
{% endif %}
{% endmacro age %}

{% macro empty_state(message) %}
<div class="flex flex-col items-center justify-center py-16 text-base-content/40">
  <svg class="w-12 h-12 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"
          d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"/>
  </svg>
  <p class="text-sm">{{ message }}</p>
</div>
{% endmacro empty_state %}
