import { api } from "@/config/axios";
import {
  CouponsResponse,
  WalletBalanceResponse,
  TransactionsResponse,
} from "../types/Types";

export const getMyCoupons = async (): Promise<CouponsResponse> => {
  const { data } = await api.get<CouponsResponse>("/public/coupons/me");
  return data;
};

export const getUserWalletBalance = async (): Promise<
  WalletBalanceResponse
> => {
  const { data } = await api.get<WalletBalanceResponse>(
    "/public/user/wallet/balance"
  );
  return data;
};
export const getUserPointsBalance = async (): Promise<
  WalletBalanceResponse
> => {
  const { data } = await api.get<WalletBalanceResponse>(
    "/public/user/points/balance"
  );
  return data;
};

export const convertScoreToWallet = async () => {
  const { data } = await api.post("/public/user/convert-score-to-wallet");
  return data;
};

export const getTransactions = async (): Promise<TransactionsResponse> => {
  const { data } = await api.get<TransactionsResponse>("/public/payments");
  return data;
};
