import { DEFAULT_PUBLIC_LOCALE, normalizePublicLocale } from '~/utils/public-locales'

export function usePublicPreferences() {
  const language = useCookie('bent-preferred-language', {
    default: () => DEFAULT_PUBLIC_LOCALE,
    sameSite: 'lax',
  })
  const currency = useCookie('bent-preferred-currency', {
    default: () => 'USD',
    sameSite: 'lax',
  })

  language.value = normalizePublicLocale(language.value)

  return {
    language,
    currency,
  }
}
