import { useQuery } from '@tanstack/react-query'
import * as api from '@/api/stats'
import type { StatsQueryParams } from '@/types'

export const statsKeys = {
  filtered: (params?: StatsQueryParams) => ['stats', params] as const,
}

export function useStats(params?: StatsQueryParams) {
  return useQuery({
    queryKey: statsKeys.filtered(params),
    queryFn: () => api.getStats(params),
  })
}
