import { db } from "@/lib/db";
import { notFound } from "next/navigation";
import Link from "next/link";
import RoundForm from "../../RoundForm";

export default async function EditRoundPage({ params }: { params: Promise<{ id: string }> }) {
  const { id } = await params;
  const round = await db.round.findUnique({
    where: { id },
  });

  if (!round) notFound();

  return (
    <div className="max-w-2xl mx-auto">
      <div className="flex items-center gap-3 mb-6">
        <Link href="/admin/rounds" className="text-gray-400 hover:text-gray-600">← بازگشت</Link>
        <h1 className="text-2xl font-bold">ویرایش دور {round.number}</h1>
      </div>
      <RoundForm editRound={round} />
    </div>
  );
}
