import { cookies } from 'next/headers';
import { getRequestConfig } from 'next-intl/server';

export default getRequestConfig(async () => {
  const store = await cookies();
  const cookieLocale = store.get('locale')?.value || 'en';

  return {
    locale: cookieLocale,
    messages: (await import(`@/locales/${cookieLocale}.ts`)).default,
  };
});
