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

// 获取理赔列表
router.get('/', jwtAuth, checkPermission('claim', 'read'), 
  claimController.getClaims
);

// 创建理赔申请
router.post('/', jwtAuth, checkPermission('claim', 'create'),
  claimController.createClaim
);

// 获取单个理赔详情
router.get('/:id', jwtAuth, checkPermission('claim', 'read'),
  claimController.getClaimById
);

// 审核理赔申请
router.patch('/:id/review', jwtAuth, checkPermission('claim', 'review'),
  claimController.reviewClaim
);

// 更新理赔支付状态
router.patch('/:id/payment', jwtAuth, checkPermission('claim', 'update'),
  claimController.updateClaimPayment
);

// 获取理赔统计
router.get('/stats/overview', jwtAuth, checkPermission('claim', 'read'),
  claimController.getClaimStats
);

module.exports = router;