import Link from "next/link";
import { requireOperator } from "@/lib/auth";
import LogoutButton from "@/components/LogoutButton";

export default async function OperatorLayout({ children }: { children: React.ReactNode }) {
  const user = await requireOperator();

  return (
    <div className="min-h-dvh flex flex-col">
      <header className="border-b border-slate-200 bg-white">
        <div className="mx-auto max-w-3xl px-4 py-3 flex items-center gap-3">
          <Link href="/op" className="font-semibold tracking-tight">
            MRP
          </Link>
          <span className="ml-auto text-sm text-slate-500">{user.name}</span>
          <LogoutButton />
        </div>
      </header>
      <main className="flex-1">{children}</main>
    </div>
  );
}
