import HeroPressImage from "@/components/sections/PressDetailsPage/HeroPressImage/Index";
import ContentPressDetailsSection from "@/components/sections/PressDetailsPage/ContentPressDetailsSection/Index";
import { getPressDetails } from "@/lib/api/press";
import { notFound } from "next/navigation";

export default async function PressDetailsPage({
  params,
}: {
  params: Promise<{ slug: string }>;
}) {
  const { slug } = await params;

  const pressDetails = await getPressDetails(parseInt(slug));

  if (!pressDetails) {
    return notFound();
  }

  return (
    <>
      <HeroPressImage image={pressDetails.image} title={pressDetails.title} />
      <ContentPressDetailsSection pressDetails={pressDetails} />
    </>
  );
}
