import { About } from "@/components/About";
import { ContactCta } from "@/components/ContactCta";
import { Hero } from "@/components/Hero";
import { Marquee } from "@/components/Marquee";
import { News } from "@/components/News";
import { Projects } from "@/components/Projects";
import { Services } from "@/components/Services";
import { SiteFooter } from "@/components/SiteFooter";
import { SiteHeader } from "@/components/SiteHeader";
import { contact, site } from "@/data/site";
import { getPortfolios, toDisplayProject } from "@/lib/api";

const organizationJsonLd = {
  "@context": "https://schema.org",
  "@type": "Organization",
  name: site.name,
  url: site.url,
  slogan: site.tagline,
  foundingDate: "2000",
  address: {
    "@type": "PostalAddress",
    addressLocality: "قم",
    addressCountry: "IR",
    streetAddress: contact.address,
  },
  telephone: contact.phoneLinks,
  email: contact.email,
  sameAs: [contact.instagramUrl],
};

export default async function HomePage() {
  const portfolios = await getPortfolios();
  const displayProjects = portfolios.map(toDisplayProject);

  return (
    <>
      <script
        type="application/ld+json"
        dangerouslySetInnerHTML={{ __html: JSON.stringify(organizationJsonLd) }}
      />

      <SiteHeader />

      <main>
        <Hero />
        <About />
        <Marquee />
        <Projects projects={displayProjects} />
        <Services />
        <News />
        <ContactCta />
      </main>

      <SiteFooter />
    </>
  );
}
