/**
 * Dashboard API hooks (Task 5.25).
 */

import { useQuery } from '@tanstack/react-query';
import { apiGet } from './client';

export interface DashboardWidgetDef {
  id: string;
  label_key: string;
  label: string;
  component: string;
  icon: string;
  order: number;
  col_span: number;
  row_span: number;
  permission: string;
  plugin_name: string;
}

export interface DashboardWidgetsResponse {
  items: DashboardWidgetDef[];
  total: number;
}

export function useDashboardWidgets() {
  return useQuery({
    queryKey: ['dashboardWidgets'],
    queryFn: () =>
      apiGet<DashboardWidgetsResponse>('/dashboard/widgets'),
    staleTime: 60 * 1000,
  });
}
