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

export const useGetSellers = (page: number = 1) => {
  return useQuery({
    queryKey: ["sellers", page],
    queryFn: () => api.getSellers(page),
  });
};

export const useToggleSellerStatus = () => {
  return useMutation({
    mutationFn: api.toggleSellerStatus,
  });
};

export const useApproveContract = () => {
  return useMutation({
    mutationFn: api.approveContract,
  });
};

export const useGetWholesaleRequests = (page: number = 1) => {
  return useQuery({
    queryKey: ["wholesale-requests", page],
    queryFn: () => api.getWholesaleRequests(page),
  });
};

export const useApproveWholesaleRequest = () => {
  return useMutation({
    mutationFn: api.approveWholesaleRequest,
  });
};

export const useGetWithdrawalRequests = (page: number = 1) => {
  return useQuery({
    queryKey: ["withdrawal-requests", page],
    queryFn: () => api.getWithdrawalRequests(page),
  });
};
