"use client";

import { useEffect } from "react";
import { useLocale } from "next-intl";
import { useRouter } from "@/i18n/routing";
import { useAuthStore } from "@/lib/stores/auth.store";

/** Full-viewport routes (queue TV display) — auth only, no dashboard chrome. */
export default function FullscreenLayout({ children }: { children: React.ReactNode }) {
  const locale = useLocale();
  const router = useRouter();
  const user = useAuthStore((s) => s.user);

  useEffect(() => {
    if (!user?.accessToken) {
      router.replace("/login");
    }
  }, [user, router]);

  return (
    <div className="min-h-svh" dir={locale === "en" ? "ltr" : "rtl"}>
      {children}
    </div>
  );
}
