import { NextIntlClientProvider } from "next-intl"
import { getMessages } from "next-intl/server"

import type { ReactNode } from "react"

import MarketingLayoutClient from "./marketing-layout-client"

// Force dynamic rendering — prevents NextAuth from being called at build time
// (AUTH_URL is not available during Docker image build)
export const dynamic = "force-dynamic"

export default async function MarketingLayout({
  children,
}: {
  children: ReactNode
}) {
  const messages = await getMessages()

  return (
    <NextIntlClientProvider messages={messages}>
      <MarketingLayoutClient>{children}</MarketingLayoutClient>
    </NextIntlClientProvider>
  )
}
