import Contact1 from "@/components/contact/Contact1";
import React from "react";
import Banner from "@/components/banner/Banner";

export const revalidate = 3600;

export async function generateMetadata() {
  const slugArr = ["contact"];
  const res = await fetch(`${process.env.PUBLIC_SITE_URL}/api/get-page-data`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ slug_list: slugArr })
  });
  const { data, error } = await res.json();
  if (error) {
    return {
      title: error.title || '',
      description: error.message || '',
    };
  }
  return {
    title: data?.meta_title || data?.title || '',
    description: data?.meta_description || data?.description || '',
  };
}

export default async function ContactPage() {
  const res = await fetch(`${process.env.PUBLIC_SITE_URL}/api/get-component-data?component_name=Contact`, { cache: 'no-store' });
  const { data } = await res.json();

  return (
    <>
      <div className="grow shrink-0">
        <Banner
          componentName="Banner-contact"
          className="contact-banner"
        />
        <Contact1 ssrData={data} />
      </div>
    </>
  );
}
