import { notFound } from "next/navigation";
import { ImageDetailView } from "@/components/image/ImageDetailView";
import { getImageDetail } from "@/lib/db/queries";

export const dynamic = "force-dynamic";

export default async function ImagePage({ params }: { params: Promise<{ id: string }> }) {
  const { id } = await params;
  const numId = Number(id);
  if (!Number.isFinite(numId)) notFound();
  if (!getImageDetail(numId)) notFound();
  return <ImageDetailView imageId={numId} />;
}
