<script setup lang="ts">
import { LayoutDashboard } from '@lucide/vue'

import AdminDashboardActivitySection from '../../components/admin/AdminDashboardActivitySection.vue'
import AdminDashboardChecksSection from '../../components/admin/AdminDashboardChecksSection.vue'
import AdminDashboardHeroSection from '../../components/admin/AdminDashboardHeroSection.vue'
import AdminDashboardPrioritySection from '../../components/admin/AdminDashboardPrioritySection.vue'
import AdminDashboardTopCategoriesSection from '../../components/admin/AdminDashboardTopCategoriesSection.vue'
import AdminDashboardYearTotalsSection from '../../components/admin/AdminDashboardYearTotalsSection.vue'
import AdminPageHeader from '../../components/admin/AdminPageHeader.vue'
import AdminSeasonToolbar from '../../components/admin/AdminSeasonToolbar.vue'
import { useAdminDashboardOverview } from '../../components/admin/useAdminDashboardOverview'

const {
  store,
  activities,
  topCategories,
  metricCards,
  openReviewCount,
  openRiskCount,
  liveSummary,
  liveStatusBadge,
  maxCategoryVotes,
  totalCategoryVotes,
  yearTotals,
  priorityActions,
  operationChecks,
} = useAdminDashboardOverview()
</script>

<template>
  <div class="space-y-6">
    <AdminPageHeader
      eyebrow="Dashboard"
      :icon="LayoutDashboard"
    />

    <AdminSeasonToolbar />

    <section class="grid gap-4 xl:grid-cols-[1.15fr_0.85fr]">
      <AdminDashboardHeroSection
        :metric-cards="metricCards"
        :live-summary="liveSummary"
        :live-status-badge="liveStatusBadge"
        :open-risk-count="openRiskCount"
        :open-review-count="openReviewCount"
      />

      <AdminDashboardPrioritySection :priority-actions="priorityActions" />
    </section>

    <AdminDashboardChecksSection :operation-checks="operationChecks" />

    <section class="grid gap-6 xl:grid-cols-[0.92fr_1.08fr]">
      <AdminDashboardYearTotalsSection
        :year="store.adminSeasonDetail.year"
        :year-totals="yearTotals"
      />

      <AdminDashboardTopCategoriesSection
        :total-category-votes="totalCategoryVotes"
        :max-category-votes="maxCategoryVotes"
        :top-categories="topCategories"
      />
    </section>

    <AdminDashboardActivitySection :activities="activities" />
  </div>
</template>
