/**
 * @swagger
 * tags:
 *   name: Health
 *   description: 健康检查和监控端点
 */

/**
 * @swagger
 * /health:
 *   get:
 *     summary: 健康检查
 *     description: 检查服务器及所有依赖服务的运行状态
 *     tags: [Health]
 *     responses:
 *       200:
 *         description: 服务器运行正常
 *         content:
 *           application/json:
 *             schema:
 *               type: object
 *               properties:
 *                 success:
 *                   type: boolean
 *                   example: true
 *                 data:
 *                   type: object
 *                   properties:
 *                     status:
 *                       type: string
 *                       enum: [healthy, degraded, unhealthy]
 *                       example: healthy
 *                     timestamp:
 *                       type: string
 *                       format: date-time
 *                     uptime:
 *                       type: number
 *                       description: 服务器运行时间（秒）
 *                     version:
 *                       type: string
 *                       example: "1.0.0"
 *                     nodeVersion:
 *                       type: string
 *                       example: "v18.0.0"
 *                     services:
 *                       type: object
 *                       properties:
 *                         database:
 *                           type: object
 *                           properties:
 *                             status:
 *                               type: string
 *                               enum: [healthy, unhealthy]
 *                             pool:
 *                               type: object
 *                               properties:
 *                                 size:
 *                                   type: number
 *                                 available:
 *                                   type: number
 *                                 pending:
 *                                   type: number
 *                                 max:
 *                                   type: number
 *                                 min:
 *                                   type: number
 *                         redis:
 *                           type: object
 *                           properties:
 *                             status:
 *                               type: string
 *                               enum: [healthy, unhealthy, not_initialized]
 *                             ping:
 *                               type: string
 *                             connectedClients:
 *                               type: number
 *                     memory:
 *                       type: object
 *                       properties:
 *                         heapUsedMB:
 *                           type: number
 *                         heapTotalMB:
 *                           type: number
 *                         rssMB:
 *                           type: number
 *       503:
 *         description: 服务不可用
 */

/**
 * @swagger
 * /health/live:
 *   get:
 *     summary: 存活检查
 *     description: 简单的存活检查，用于Kubernetes liveness probe
 *     tags: [Health]
 *     responses:
 *       200:
 *         description: 服务存活
 *         content:
 *           application/json:
 *             schema:
 *               type: object
 *               properties:
 *                 success:
 *                   type: boolean
 *                   example: true
 *                 data:
 *                   type: object
 *                   properties:
 *                     status:
 *                       type: string
 *                       example: alive
 *                     timestamp:
 *                       type: string
 *                       format: date-time
 */

/**
 * @swagger
 * /health/ready:
 *   get:
 *     summary: 就绪检查
 *     description: 检查服务是否准备好接收流量，用于Kubernetes readiness probe
 *     tags: [Health]
 *     responses:
 *       200:
 *         description: 服务就绪
 *         content:
 *           application/json:
 *             schema:
 *               type: object
 *               properties:
 *                 success:
 *                   type: boolean
 *                   example: true
 *                 data:
 *                   type: object
 *                   properties:
 *                     status:
 *                       type: string
 *                       example: ready
 *                     timestamp:
 *                       type: string
 *                       format: date-time
 *       503:
 *         description: 服务未就绪
 *         content:
 *           application/json:
 *             schema:
 *               type: object
 *               properties:
 *                 success:
 *                   type: boolean
 *                   example: false
 *                 data:
 *                   type: object
 *                   properties:
 *                     status:
 *                       type: string
 *                       example: not_ready
 *                     timestamp:
 *                       type: string
 *                       format: date-time
 *                     services:
 *                       type: object
 *                       properties:
 *                         database:
 *                           type: string
 *                         redis:
 *                           type: string
 */

/**
 * @swagger
 * /metrics:
 *   get:
 *     summary: 获取系统指标
 *     description: 获取系统运行指标，包括请求统计、响应时间、内存使用等
 *     tags: [Health]
 *     responses:
 *       200:
 *         description: 指标数据
 *         content:
 *           application/json:
 *             schema:
 *               type: object
 *               properties:
 *                 success:
 *                   type: boolean
 *                   example: true
 *                 data:
 *                   type: object
 *                   properties:
 *                     uptime:
 *                       type: number
 *                       description: 运行时间（秒）
 *                     requests:
 *                       type: object
 *                       properties:
 *                         total:
 *                           type: number
 *                           description: 总请求数
 *                         success:
 *                           type: number
 *                           description: 成功请求数
 *                         error:
 *                           type: number
 *                           description: 错误请求数
 *                         errorRate:
 *                           type: string
 *                           description: 错误率
 *                           example: "0.5%"
 *                         byStatusCode:
 *                           type: object
 *                           description: 按状态码分类的请求数
 *                     responseTime:
 *                       type: object
 *                       properties:
 *                         average:
 *                           type: number
 *                           description: 平均响应时间（毫秒）
 *                         min:
 *                           type: number
 *                           description: 最小响应时间（毫秒）
 *                         max:
 *                           type: number
 *                           description: 最大响应时间（毫秒）
 *                     memory:
 *                       type: object
 *                       properties:
 *                         heapUsedMB:
 *                           type: number
 *                         heapTotalMB:
 *                           type: number
 *                         rssMB:
 *                           type: number
 *                     recentErrors:
 *                       type: array
 *                       description: 最近的错误记录
 *                       items:
 *                         type: object
 *                         properties:
 *                           timestamp:
 *                             type: string
 *                             format: date-time
 *                           message:
 *                             type: string
 *                           context:
 *                             type: object
 */
