"use client";
import PhoenixTopBar from "./phoenix_components/PhoenixTopBar";
import PhoenixLeftSideBar from "./phoenix_components/PhoenixLeftSideBar";
import PhoenixFooter from "./phoenix_components/PhoenixFooter";
import { useIdleTimeout } from "@/app/hooks/useIdleTimeout";
import { useAuthGuard } from "@/app/hooks/useAuthGuard";

export default function HomeLayout({ children }: { children: React.ReactNode }) {
  const isReady = useAuthGuard();  // redirect to /log-in if not authenticated
  useIdleTimeout();                // lock screen after 30 min idle

  if (!isReady) return null;

  return (
    <main className="main" id="top">
      <PhoenixLeftSideBar />
      <PhoenixTopBar />
      <div className="content">
        {children}
        <PhoenixFooter />
      </div>
    </main>
  );
}
