import { cache } from "react"
import { db } from "@/lib/db"

export const getCountryConfig = cache(async () => {
  const code = process.env.NEXT_PUBLIC_COUNTRY_CODE ?? "KW"
  const country = await db.country.findUnique({
    where: { countryCode: code, status: true },
  })
  if (!country) throw new Error(`Invalid COUNTRY_CODE: ${code}`)
  return country
})
