import { redirect } from "next/navigation";
import { getServerSession } from "next-auth";
import { authOptions } from "@/lib/auth";
import { JobProgress } from "@/components/JobProgress";

type Props = {
  params: Promise<{ id: string }>;
};

export default async function JobPage({ params }: Props) {
  const session = await getServerSession(authOptions);
  if (!session) redirect("/");

  const { id } = await params;

  return (
    <main className="min-h-screen">
      <header className="border-b border-gray-800 bg-surface">
        <div className="mx-auto flex max-w-4xl items-center justify-between px-6 py-4">
          <a href="/dashboard" className="text-xl font-bold text-white">
            s2yt
          </a>
        </div>
      </header>

      <div className="mx-auto max-w-4xl px-6 py-8">
        <JobProgress jobId={id} />
      </div>
    </main>
  );
}
