import { http } from "@/shared/api/httpClient";
import { API_ROUTES } from "@/shared/constants/api-routes";

import { IUserBalanceResponse, UserBalanceSchema } from "./types";

/**
 * Fetches the current user balance (server-side with httpOnly cookie access)
 * @returns Promise with user balance information
 */
export const getUserBalance = async (): Promise<IUserBalanceResponse> => {
  return http.get<IUserBalanceResponse>(API_ROUTES.getUserBalance(), {
    tags: ["balance"],
    schema: UserBalanceSchema,
    revalidate: 0,
  });
};
