const express = require('express');
const router = express.Router();
const systemController = require('../controllers/systemController');
const { jwtAuth, checkPermission } = require('../middleware/auth');

// 获取系统统计信息（需要管理员权限）
router.get('/stats', jwtAuth, checkPermission('system', 'read'), systemController.getSystemStats);

// 获取系统日志
router.get('/logs', jwtAuth, checkPermission('system', 'read'), systemController.getSystemLogs);

// 获取系统配置
router.get('/config', jwtAuth, checkPermission('system', 'read'), systemController.getSystemConfig);

// 更新系统配置
router.put('/config', jwtAuth, checkPermission('system', 'update'), systemController.updateSystemConfig);

// 备份数据库
router.post('/backup', jwtAuth, checkPermission('system', 'admin'), systemController.backupDatabase);

// 恢复数据库
router.post('/restore', jwtAuth, checkPermission('system', 'admin'), systemController.restoreDatabase);

module.exports = router;