import { get } from './apiClient';
import type { DashboardStats, HourlyTrend, ServiceRatio, ErrorTrend, TopApi } from '../types/dashboard';
import type { RequestLog } from '../types/monitoring';
import type { HeartbeatStatus } from '../types/service';

export const getSummary = () => get<DashboardStats>('/dashboard/summary');
export const getHourlyTrend = () => get<HourlyTrend[]>('/dashboard/hourly-trend');
export const getServiceRatio = () => get<ServiceRatio[]>('/dashboard/service-ratio');
export const getErrorTrend = () => get<ErrorTrend[]>('/dashboard/error-trend');
export const getTopApis = (limit = 10) => get<TopApi[]>(`/dashboard/top-apis?limit=${limit}`);
export const getRecentLogs = () => get<RequestLog[]>('/dashboard/recent-logs');
export const getHeartbeat = () => get<HeartbeatStatus[]>('/dashboard/heartbeat');
