/**
 * 数据库健康监控 API 调用。
 */

import { apiClient } from './client';

/** 数据库健康状态 */
export interface DbHealthItem {
  db_name: string;
  status: 'connected' | 'disconnected';
  active_connections: number | null;
  idle_connections: number | null;
  db_size_mb: number | null;
  slow_query_count: number | null;
}

/** 获取所有数据库健康状态 */
export async function fetchDbHealth(): Promise<DbHealthItem[]> {
  const { data } = await apiClient.get<DbHealthItem[]>('/admin/db-health');
  return data;
}
