import { useQuery } from "@tanstack/react-query";
import { QUERY_KEYS } from "@/utils/query-key";
import {
  getSalesGrowthReport,
  getUserRegistrationGrowthReport,
  getSalesByCategoryReport,
} from "./_requests";
import {
  SalesGrowthFilters,
  UserRegistrationGrowthFilters,
  SalesByCategoryFilters,
} from "./_models";

export const useSalesGrowthReport = (filters?: SalesGrowthFilters) => {
  return useQuery({
    queryKey: [QUERY_KEYS.GET_SALES_GROWTH_REPORT, filters],
    queryFn: () => getSalesGrowthReport(filters),
  });
};

export const useUserRegistrationGrowthReport = (
  filters?: UserRegistrationGrowthFilters
) => {
  return useQuery({
    queryKey: [QUERY_KEYS.GET_USER_REGISTRATION_GROWTH_REPORT, filters],
    queryFn: () => getUserRegistrationGrowthReport(filters),
  });
};

export const useSalesByCategoryReport = (filters?: SalesByCategoryFilters) => {
  return useQuery({
    queryKey: [QUERY_KEYS.GET_SALES_BY_CATEGORY_REPORT, filters],
    queryFn: () => getSalesByCategoryReport(filters),
  });
};
