import { apiClient, getDataOrThrow } from "@/core/api";
import { FALLBACK_CURRENCY, type Currency } from "@customer-portal/domain/billing";

export { FALLBACK_CURRENCY };

export const currencyService = {
  async getDefaultCurrency(): Promise<Currency> {
    const response = await apiClient.GET<Currency>("/api/currency/default");
    return getDataOrThrow(response, "Failed to get default currency");
  },

  async getAllCurrencies(): Promise<Currency[]> {
    const response = await apiClient.GET<Currency[]>("/api/currency/all");
    return getDataOrThrow(response, "Failed to get currencies");
  },
};
