import request from './request'

export interface DashboardStats {
  data_sources: number
  tables: number
  columns: number
  labeled: number
  sensitive: number
  projects: number
}

export interface LevelDistItem {
  name: string
  code: string
  color: string
  count: number
}

export interface CategoryDistItem {
  name: string
  count: number
}

export interface SourceDistItem {
  source: string
  count: number
}

export interface ProjectProgressItem {
  id: number
  name: string
  status: string
  progress: number
  planned_end: string | null
}

export interface HeatmapItem {
  source_name: string
  level_code: string
  count: number
}

export interface DashboardDistribution {
  level_distribution: LevelDistItem[]
  category_distribution: CategoryDistItem[]
  source_distribution: SourceDistItem[]
  project_progress: ProjectProgressItem[]
  heatmap: HeatmapItem[]
}

export function getDashboardStats() {
  return request.get('/dashboard/stats')
}

export function getDashboardDistribution() {
  return request.get('/dashboard/distribution')
}
