<template>
  <t-card title="统计概览" :bordered="false">
    <t-row :gutter="16">
      <t-col :span="4"><t-card :bordered="true"><t-statistic title="文档总数" :value="stats?.totalDocuments||0" /></t-card></t-col>
      <t-col :span="4"><t-card :bordered="true"><t-statistic title="分类数" :value="stats?.totalCategories||0" /></t-card></t-col>
      <t-col :span="4"><t-card :bordered="true"><t-statistic title="分块总数" :value="stats?.totalChunks||0" /></t-card></t-col>
      <t-col :span="4"><t-card :bordered="true"><t-statistic title="处理中" :value="stats?.processingCount||0" :color="stats?.processingCount?'orange':'default'" /></t-card></t-col>
      <t-col :span="4"><t-card :bordered="true"><t-statistic title="失败" :value="stats?.failedCount||0" :color="stats?.failedCount?'red':'default'" /></t-card></t-col>
      <t-col :span="4"><t-card :bordered="true"><t-statistic title="FAQ 总数" :value="stats?.faqCount||0" /></t-card></t-col>
    </t-row>
  </t-card>
</template>

<script setup lang="ts">
import { onMounted } from 'vue'
import { useDocumentStore } from '@/stores/document'
const { stats, loadStats } = useDocumentStore()
onMounted(()=>{loadStats()})
</script>
