const express = require('express');
const router = express.Router();
const governmentController = require('../controllers/governmentController');

// 数据览仓接口 - 整合到dashboard模块
router.get('/data-center', governmentController.getDataCenterStats);

// 市场行情接口 - 整合到dashboard模块
router.get('/market-price', governmentController.getMarketPrice);

// 监管统计接口
router.get('/supervision-stats', async (req, res) => {
  try {
    // 这里可以调用监管相关的统计方法
    res.json({
      success: true,
      data: {
        totalSupervisions: 0,
        pendingSupervisions: 0,
        completedSupervisions: 0
      }
    });
  } catch (error) {
    res.status(500).json({
      success: false,
      message: '获取监管统计失败',
      error: error.message
    });
  }
});

// 疫情统计接口
router.get('/epidemic-stats', async (req, res) => {
  try {
    // 这里可以调用疫情相关的统计方法
    res.json({
      success: true,
      data: {
        totalEpidemics: 0,
        activeEpidemics: 0,
        resolvedEpidemics: 0
      }
    });
  } catch (error) {
    res.status(500).json({
      success: false,
      message: '获取疫情统计失败',
      error: error.message
    });
  }
});

// 总体仪表盘数据
router.get('/overview', async (req, res) => {
  try {
    // 整合所有统计数据
    const data = {
      farmers: { total: 0, active: 0 },
      animals: { total: 0, healthy: 0 },
      transactions: { total: 0, amount: 0 },
      supervisions: { total: 0, pending: 0 },
      epidemics: { total: 0, active: 0 }
    };
    
    res.json({
      success: true,
      data
    });
  } catch (error) {
    res.status(500).json({
      success: false,
      message: '获取仪表盘数据失败',
      error: error.message
    });
  }
});

module.exports = router;
