/**
 * 仪表盘 Hooks
 *
 * contract §2.4：adminDashboard
 */
import { useGraphQuery } from "./use-graphql";
import { ADMIN_DASHBOARD_QUERY } from "@/lib/graphql-client";
import type { AdminDashboardViewModel } from "@/types/view-models";

interface AdminDashboardResponse {
  adminDashboard: AdminDashboardViewModel;
}

export function useDashboard() {
  const result = useGraphQuery<AdminDashboardResponse>(ADMIN_DASHBOARD_QUERY);
  return {
    ...result,
    data: result.data?.adminDashboard ?? null,
  };
}
