import { useQuery } from "@tanstack/react-query";
import * as api from "../service/StatisticsService";

export const useGetStatistics = () => {
  return useQuery({
    queryKey: ["statistics"],
    queryFn: api.getStatistics,
  });
};

interface GetFoodSalesPieChartParams {
  period?: "daily" | "monthly" | "yearly";
  startDate?: string;
  endDate?: string;
}

export const useGetFoodSalesPieChart = (
  params?: GetFoodSalesPieChartParams
) => {
  return useQuery({
    queryKey: ["food-sales-pie-chart", params],
    queryFn: () => api.getFoodSalesPieChart(params),
  });
};

interface GetPaymentsChartParams {
  period?: "daily" | "monthly" | "yearly";
  startDate?: string;
  endDate?: string;
}

export const useGetPaymentsChart = (params?: GetPaymentsChartParams) => {
  return useQuery({
    queryKey: ["payments-chart", params],
    queryFn: () => api.getPaymentsChart(params),
  });
};
