/**
 * 管理员仪表盘 API
 */

import { get } from '../request'

// 仪表盘统计数据接口
export interface DashboardStats {
  users: {
    total: number
    growth: number
    growthRate: string
  }
  courses: {
    total: number
    completed: number
    completionRate: string
  }
  exams: {
    total: number
    avgScore: number
    passRate: string
  }
  learning: {
    totalHours: number
    avgHours: number
    activeRate: string
  }
}

// 用户增长数据接口
export interface UserGrowthData {
  dates: string[]
  newUsers: number[]
  activeUsers: number[]
}

// 课程完成率数据接口
export interface CourseCompletionData {
  courses: string[]
  completionRates: number[]
}

// 获取仪表盘统计数据
export const getDashboardStats = () => {
  return get('/api/v1/admin/dashboard/stats')
}

// 获取用户增长数据
export const getUserGrowthData = () => {
  return get('/api/v1/admin/dashboard/user-growth')
}

// 获取课程完成率数据
export const getCourseCompletionData = () => {
  return get('/api/v1/admin/dashboard/course-completion')
}
