import { notFound } from "next/navigation";
import { getPlant, listContainers } from "@/modules/garden/server/queries";
import { PlantForm } from "@/modules/garden/components/plant-form";

export default async function EditPlantPage({ params }: { params: Promise<{ id: string }> }) {
  const { id } = await params;
  const [plant, containers] = await Promise.all([getPlant(id), listContainers()]);
  if (!plant) notFound();

  return (
    <div className="page-content max-w-xl">
      <h1 className="page-title">Edit Plant</h1>
      <PlantForm existingPlant={plant} containers={containers} />
    </div>
  );
}
