import { notFound } from "next/navigation";
import { DetailBackLink } from "@/components/detail-back-link";
import { getShareLinksForEntity } from "@/modules/_core/share";
import { ContainerDetail } from "@/modules/garden/components/container-detail";
import { getContainer } from "@/modules/garden/server/queries";

export default async function ContainerPage({ params }: { params: Promise<{ id: string }> }) {
  const { id } = await params;
  const [container, shareLinks] = await Promise.all([
    getContainer(id),
    getShareLinksForEntity("garden.container", id),
  ]);
  if (!container) notFound();
  return (
    <div className="page-content">
      <DetailBackLink href="/garden" label="Garden" className="mb-4" />
      <ContainerDetail container={container} shareLinks={shareLinks} />
    </div>
  );
}
