"use client"

import { useQuery } from "@tanstack/react-query"
import { useAuthApi } from "@/shared/useApi"
import type { HomeDashboardQuery, HomeDashboardResponse } from "@garage/api"

export type DashboardData = HomeDashboardResponse & Record<string, any>

export function useDashboardData(filters?: HomeDashboardQuery) {
    const api = useAuthApi()

    return useQuery<DashboardData>({
        queryKey: ["home", "dashboard", filters],
        queryFn: () => api.home.dashboard(filters),
    })
}
