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

export const useGetMyCoupons = () => {
  return useQuery({
    queryKey: ["my-coupons"],
    queryFn: api.getMyCoupons,
  });
};

export const useGetUserWallet = () => {
  return useQuery({
    queryKey: ["user-wallet"],
    queryFn: api.getUserWalletBalance,
  });
};

export const useGetUserPointsBalance = () => {
  return useQuery({
    queryKey: ["user-points-balance"],
    queryFn: api.getUserPointsBalance,
  });
};

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

export const useGetTransactions = () => {
  return useQuery({
    queryKey: ["transactions"],
    queryFn: api.getTransactions,
  });
};
