/**
 * Server-side registration for the HeroVideo client component.
 *
 * We wrap the client component in a tiny async server shim so we can read the
 * active locale via `getRequestLocale()` (which depends on `headers()`, only
 * available in server components) and inject it as a prop. That way the
 * client component renders with the right locale on first paint, instead of
 * starting in AR and snapping to EN after `useEffect` runs.
 */
import { HeroVideo } from "./HeroVideo";
import { HeroVideoSchema, type HeroVideoData } from "./HeroVideo.schema";
import { registerSection } from "./registry";
import { registerSchema } from "./schemas";
import { getRequestLocale } from "@/lib/i18n/strings";

async function HeroVideoServer({ data }: { data: HeroVideoData }) {
  const locale = await getRequestLocale();
  return <HeroVideo data={data} locale={locale} />;
}

registerSection<HeroVideoData>("hero_video", HeroVideoServer);
registerSchema("hero_video", HeroVideoSchema);
