import { useQuery } from "@tanstack/react-query";
import { QUERY_KEYS } from "@/utils/query-key";
import { getPaymentMethodsReport, getPaymentTransactionsReport } from "./_requests";
import { PaymentMethodsFilters, PaymentTransactionsFilters } from "./_models";

export const usePaymentMethodsReport = (filters: PaymentMethodsFilters) => {
  return useQuery({
    queryKey: [QUERY_KEYS.GET_PAYMENT_METHODS_REPORT, filters],
    queryFn: () => getPaymentMethodsReport(filters),
    enabled: filters.limit > 0,
  });
};

export const usePaymentTransactionsReport = (
  filters: PaymentTransactionsFilters,
  enabled: boolean = true
) => {
  return useQuery({
    queryKey: [QUERY_KEYS.GET_PAYMENT_TRANSACTIONS_REPORT, filters],
    queryFn: () => getPaymentTransactionsReport(filters),
    enabled: enabled && filters.limit > 0,
  });
};
