/**
 * 统计分析 API 接口
 *
 * @module api/stats
 * @author czj
 * @date 2026-07-09
 */

import request from '@/utils/request'

/**
 * 统计分析 API 服务
 */
export const statsApi = {
  /**
   * 获取总览统计
   */
  async getOverview(days: number = 30): Promise<any> {
    const response = await request.get('/api/stats/overview', {
      params: { days }
    })
    return response.data
  },

  /**
   * 获取趋势统计
   */
  async getTrend(days: number = 30): Promise<any> {
    const response = await request.get('/api/stats/trend', {
      params: { days }
    })
    return response.data
  },

  /**
   * 获取模块统计
   */
  async getModules(): Promise<any> {
    const response = await request.get('/api/stats/modules')
    return response.data
  },

  /**
   * 获取模块详细统计
   */
  async getModuleDetail(moduleId: string, days: number = 30): Promise<any> {
    const response = await request.get(`/api/stats/module/${moduleId}`, {
      params: { days }
    })
    return response.data
  },

  /**
   * 获取优先级分布
   */
  async getPriority(): Promise<any> {
    const response = await request.get('/api/stats/priority')
    return response.data
  },

  /**
   * 获取状态分布
   */
  async getStatus(): Promise<any> {
    const response = await request.get('/api/stats/status')
    return response.data
  },
}