import { notFound } from "next/navigation";

import { OutlineEditor } from "@/components/outline/OutlineEditor";
import { fetchProject } from "@/lib/api/server";

interface PageProps {
  params: Promise<{ id: string }>;
}

// 大纲编辑器页（UX §6.7）。Server Component 取项目；OutlineEditor（Client）按需
// 触发 POST .../outline 生成大纲（M3 无 GET 大纲端点，进页空、生成后填充）。
export default async function OutlinePage({ params }: PageProps) {
  const { id } = await params;
  try {
    const project = await fetchProject(id);
    return <OutlineEditor project={project} initialChapters={[]} />;
  } catch {
    notFound();
  }
}
