import { useMutation, useQuery } from "@tanstack/react-query";
import * as api from "../service/ReceiptService";
import { CreateReceiptType } from "../types/ReceiptTypes";

export const useGetInvoices = (
  status: string,
  customerId: string,
  search: string,
  date: string,
  endDate: string
) => {
  return useQuery({
    queryKey: ["invoices", status, customerId, search, date, endDate],
    queryFn: () => api.getInvoces(status, customerId, search, date, endDate),
  });
};

export const useCreateInvoice = () => {
  return useMutation({
    mutationFn: (variables: CreateReceiptType) => api.createInvoice(variables),
  });
};
