import { useQuery } from '@tanstack/react-query'
import { woocommerceApi, type StatsPeriod } from '@/api/woocommerce'

export function useWooCommerceStats(language: string, period: StatsPeriod = '30d') {
  return useQuery({
    queryKey: ['woocommerce-stats', language, period],
    queryFn: () => woocommerceApi.getStats(language, period),
    staleTime: 5 * 60 * 1000,
    enabled: !!language,
  })
}
