import { notFound } from "next/navigation";
import { MembershipPlanForm } from "@/components/admin/MembershipPlanForm";
import { getPlanByIdAdmin } from "@/lib/queries/membership";

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

export default async function EditMembershipPlanPage({ params }: EditPlanPageProps) {
  const { id } = await params;
  const plan = await getPlanByIdAdmin(id);
  if (!plan) notFound();

  return (
    <div className="space-y-6">
      <h1 className="text-2xl font-bold">編輯方案：{plan.nameZh}</h1>
      <MembershipPlanForm plan={plan} />
    </div>
  );
}