import { formatPrice, formatWeight } from "../lib/formatters";
import { useCurrency } from "./useCurrency";
import { useLanguage } from "./useLanguage";
import { useWeightUnit } from "./useWeightUnit";

export function useFormatters() {
	const unit = useWeightUnit();
	const { currency } = useCurrency();
	const locale = useLanguage();
	return {
		weight: (grams: number | null) => formatWeight(grams, unit, locale),
		price: (cents: number | null) => formatPrice(cents, currency, locale),
		unit,
		currency,
		locale,
	};
}
