{#
/**
 * @file
 * Cache runtime health section for Native Observability Dashboard.
 *
 * Available variables:
 * - section: Cache observability section payload.
 */
#}

<section class="no-dashboard-section no-dashboard-section--cache-observability">
  <div class="no-section-toolbar">
    <div class="no-section-header">
      <div class="no-section-header__content">
        <span class="no-section-title">{{ section.title }}</span>

        {% if section.time_range is defined and section.time_range %}
          <span class="no-section-subtitle">{{ section.time_range }}</span>
        {% endif %}
      </div>
    </div>
  </div>

  {% if section.subtitle is defined and section.subtitle %}
    <div class="no-section-description">{{ section.subtitle }}</div>
  {% endif %}

  <span class="no-section-divider"></span>

  {% if section.enabled %}
    <div class="no-cache-runtime-health">

      {% if section.environment_notice is defined and section.environment_notice.enabled %}
        {% include '@native_observability_dashboard/components/cache/cache-environment-notice.html.twig' with {
          notice: section.environment_notice
        } only %}
      {% endif %}

      {% include '@native_observability_dashboard/components/cache/cache-health.html.twig' with {
        health: section.health,
        signals: section.signals
      } only %}

      <div class="no-cache-runtime-health__main-grid">
        <div class="no-cache-runtime-health__main-column">
          {% include '@native_observability_dashboard/components/cache/cache-activity-trend.html.twig' with {
            trend: section.activity_trend,
            cacheability: section.cacheability,
            invalidations: section.invalidations
          } only %}

          {% include '@native_observability_dashboard/components/cache/cache-behavior-overview.html.twig' with {
            health: section.health,
            behavior: section.behavior
          } only %}

          {% include '@native_observability_dashboard/components/cache/cache-runtime-records.html.twig' with {
            section: section.runtime_records
          } only %}
        </div>

        <aside class="no-cache-runtime-health__side-column">
          {% include '@native_observability_dashboard/components/cache/cache-efficiency-panel.html.twig' with {
            score: section.efficiency_score
          } only %}

          {% include '@native_observability_dashboard/components/cache/cache-insights.html.twig' with {
            insights: section.insights
          } only %}
        </aside>
      </div>
    </div>
  {% else %}
    <div class="no-dashboard-empty-state">
      <strong>{{ section.reason }}</strong>

      {% if section.help_message is defined and section.help_message %}
        <div class="no-cache-runtime-health__disabled-help">{{ section.help_message }}</div>
      {% endif %}
    </div>
  {% endif %}
</section>
