import { notFound } from "next/navigation";
import { getRow } from "@/lib/data";
import { TABLES } from "@/lib/appwrite-rest";
import type { SolutionRow } from "@/lib/types";
import { SolutionForm } from "../../form";

export default async function EditSolutionPage({
  params,
}: {
  params: Promise<{ id: string }>;
}) {
  const { id } = await params;
  const solution = await getRow<SolutionRow>(TABLES.solutions, id);
  if (!solution) notFound();
  return <SolutionForm solution={solution} />;
}
