<script setup lang="ts">
defineProps<{
  data: {
    brief_text: string
    summary: { immediate_count: number; monitor_count: number; fyi_count: number }
    items: { immediate: string[]; monitor: string[]; fyi: string[] }
    generated_at: string
    duration_ms: number
    hubs: string[]
  }
}>()
</script>

<template>
  <div class="handover-brief">
    <div class="brief-header">
      <span class="brief-title">SHIFT HANDOVER BRIEF</span>
      <div class="summary-badges">
        <span v-if="data.summary.immediate_count" class="badge immediate">
          {{ data.summary.immediate_count }} IMMEDIATE
        </span>
        <span v-if="data.summary.monitor_count" class="badge monitor">
          {{ data.summary.monitor_count }} MONITOR
        </span>
        <span v-if="data.summary.fyi_count" class="badge fyi">
          {{ data.summary.fyi_count }} FYI
        </span>
      </div>
    </div>

    <div class="brief-body">
      <section v-if="data.items.immediate.length" class="section immediate">
        <h3>━━━ IMMEDIATE ACTION ━━━</h3>
        <div v-for="(item, i) in data.items.immediate" :key="i" class="item">
          <span class="marker">▶</span> {{ item }}
        </div>
      </section>

      <section v-if="data.items.monitor.length" class="section monitor">
        <h3>━━━ MONITOR ━━━</h3>
        <div v-for="(item, i) in data.items.monitor" :key="i" class="item">
          <span class="marker">⚠</span> {{ item }}
        </div>
      </section>

      <section v-if="data.items.fyi.length" class="section fyi">
        <h3>━━━ FYI ━━━</h3>
        <div v-for="(item, i) in data.items.fyi" :key="i" class="item">
          <span class="marker">ℹ</span> {{ item }}
        </div>
      </section>
    </div>

    <div class="brief-footer">
      <span>Hubs: {{ data.hubs.join(', ') }}</span>
      <span>{{ data.duration_ms }}ms</span>
    </div>
  </div>
</template>

<style scoped>
.handover-brief {
  background: var(--surface-1);
  border: var(--panel-border);
}

.brief-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: var(--panel-border);
}

.brief-title {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
}

.summary-badges {
  display: flex;
  gap: 6px;
}

.badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  font-weight: 600;
}

.badge.immediate { background: var(--status-error); color: var(--surface-0); }
.badge.monitor { background: var(--status-warning); color: var(--surface-0); }
.badge.fyi { background: var(--surface-3); color: var(--text-secondary); }

.brief-body {
  padding: 16px;
}

.section {
  margin-bottom: 16px;
}

.section h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.section.immediate h3 { color: var(--status-error); }
.section.monitor h3 { color: var(--status-warning); }
.section.fyi h3 { color: var(--text-dim); }

.item {
  font-size: 13px;
  line-height: 1.6;
  padding: 4px 0;
  padding-left: 20px;
  position: relative;
}

.marker {
  position: absolute;
  left: 0;
}

.brief-footer {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px;
  border-top: var(--panel-border);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}
</style>
