import { notFound } from "next/navigation";
import { prisma } from "@/lib/db";
import { SoftwareVersionForm } from "@/components/admin/SoftwareVersionForm";

export const dynamic = "force-dynamic";

export default async function NewSoftwareVersionPage({
  params,
}: {
  params: Promise<{ id: string }>;
}) {
  const { id } = await params;
  const software = await prisma.software.findUnique({
    where: { id },
    select: { id: true, name: true, slug: true },
  });

  if (!software) notFound();

  return (
    <div className="mx-auto max-w-2xl space-y-6">
      <h1 className="text-3xl font-bold">
        发布新版本 - {software.name}
      </h1>
      <SoftwareVersionForm softwareId={software.id} />
    </div>
  );
}
