#!/bin/bash

# 图表组件库验证脚本

echo "=================================="
echo "图表组件库验证"
echo "=================================="
echo ""

# 检查核心组件
echo "1. 检查核心组件..."
files=(
  "src/components/charts/BaseChart.vue"
  "src/components/charts/PieChart.vue"
  "src/components/charts/BarChart.vue"
  "src/components/charts/LineChart.vue"
  "src/components/charts/GaugeChart.vue"
  "src/components/charts/FunnelChart.vue"
)

for file in "${files[@]}"; do
  if [ -f "$file" ]; then
    echo "  ✅ $file"
  else
    echo "  ❌ $file (缺失)"
  fi
done

echo ""
echo "2. 检查业务图表组件..."
files=(
  "src/components/charts/business/AssetStatusChart.vue"
  "src/components/charts/business/AssetDistributionChart.vue"
  "src/components/charts/business/AssetValueTrendChart.vue"
  "src/components/charts/business/AssetUtilizationChart.vue"
)

for file in "${files[@]}"; do
  if [ -f "$file" ]; then
    echo "  ✅ $file"
  else
    echo "  ❌ $file (缺失)"
  fi
done

echo ""
echo "3. 检查统计卡片组件..."
files=(
  "src/components/statistics/StatCard.vue"
  "src/components/statistics/StatCardGroup.vue"
)

for file in "${files[@]}"; do
  if [ -f "$file" ]; then
    echo "  ✅ $file"
  else
    echo "  ❌ $file (缺失)"
  fi
done

echo ""
echo "4. 检查 Composables..."
files=(
  "src/composables/useECharts.ts"
  "src/composables/useChartData.ts"
)

for file in "${files[@]}"; do
  if [ -f "$file" ]; then
    echo "  ✅ $file"
  else
    echo "  ❌ $file (缺失)"
  fi
done

echo ""
echo "5. 检查工具函数..."
files=(
  "src/utils/echarts.ts"
  "src/utils/echarts/performance.ts"
)

for file in "${files[@]}"; do
  if [ -f "$file" ]; then
    echo "  ✅ $file"
  else
    echo "  ❌ $file (缺失)"
  fi
done

echo ""
echo "6. 检查类型定义..."
files=(
  "src/types/charts.ts"
  "src/components/charts/charts.d.ts"
)

for file in "${files[@]}"; do
  if [ -f "$file" ]; then
    echo "  ✅ $file"
  else
    echo "  ❌ $file (缺失)"
  fi
done

echo ""
echo "7. 检查文档..."
files=(
  "CHARTS_README.md"
  "CHARTS_QUICKSTART.md"
  "CHARTS_DELIVERY.md"
  "CHARTS_SUMMARY.md"
  "CHARTES_START_HERE.md"
)

for file in "${files[@]}"; do
  if [ -f "$file" ]; then
    echo "  ✅ $file"
  else
    echo "  ❌ $file (缺失)"
  fi
done

echo ""
echo "8. 检查示例页面..."
files=(
  "src/views/examples/ChartsExample.vue"
  "tests/unit/components/PieChart.test.ts"
  "tests/unit/composables/useECharts.test.ts"
)

for file in "${files[@]}"; do
  if [ -f "$file" ]; then
    echo "  ✅ $file"
  else
    echo "  ❌ $file (缺失)"
  fi
done

echo ""
echo "9. 检查导出文件..."
files=(
  "src/components/charts/index.ts"
  "src/components/statistics/index.ts"
)

for file in "${files[@]}"; do
  if [ -f "$file" ]; then
    echo "  ✅ $file"
  else
    echo "  ❌ $file (缺失)"
  fi
done

echo ""
echo "=================================="
echo "验证完成！"
echo "=================================="
echo ""
echo "下一步："
echo "1. 运行项目：npm run dev"
echo "2. 访问示例：http://localhost:5173/examples/charts"
echo "3. 查看文档：CHARTES_START_HERE.md"
echo ""
