"use client";

import { useMemo } from "react";
import { BlogGallery } from "@/components/BlogGallery";
import { CruiseSection } from "@/components/CruiseSection";
import { CruiseTypes } from "@/components/CruiseTypes";
import { CustomerReviews } from "@/components/CustomerReviews";
import { Destinations } from "@/components/Destinations";
import { Footer } from "@/components/Footer";
import { Header } from "@/components/Header";
import { Hero } from "@/components/Hero";
import { useHomeSettings } from "@/components/HomeProvider";
import { Specialists } from "@/components/Specialists";
import { TrustBar } from "@/components/TrustBar";

export default function Home() {
  const { home } = useHomeSettings();
  const s = home.sections;

  const bestSellerParams = useMemo(
    () => ({ category: "best-seller", per_page: 7 }),
    [],
  );
  const halongParams = useMemo(
    () => ({ bay: "Ha Long Bay", per_page: 12 }),
    [],
  );
  const lanhaParams = useMemo(
    () => ({ bay: "Lan Ha Bay", per_page: 12 }),
    [],
  );
  const baitulongParams = useMemo(
    () => ({ bay: "Bai Tu Long Bay", per_page: 12 }),
    [],
  );

  return (
    <>
      <Header />
      <main className="flex-1 bg-background">
        <Hero />
        <TrustBar />
        <Destinations />
        <CruiseSection
          id="best-sellers"
          title={s.best_sellers?.title || "Top 10 best seller cruise 2025"}
          description={
            s.best_sellers?.description ||
            "Booking a cruise through VNSAILS guarantees both reliability and the best prices on the market."
          }
          layout="mosaic"
          fetchParams={bestSellerParams}
          seeAllHref="/cruise-tours?category=best-seller"
          limit={7}
        />
        <CruiseTypes />
        <CruiseSection
          title={s.halong?.title || "Cruise tours of Halong Bay"}
          description={
            s.halong?.description ||
            "Halong Bay cruises offer a unique way to explore the stunning limestone islands and crystal-clear waters, providing an unforgettable experience."
          }
          fetchParams={halongParams}
          seeAllHref="/cruise-tours?destination=Ha%20Long%20Bay"
        />
        <CruiseSection
          title={s.lanha?.title || "Cruise tours of Lanha Bay"}
          description={
            s.lanha?.description ||
            "Lan Ha Bay, located next to the famous Halong Bay, is a hidden gem known for its tranquil beauty and numerous outdoor activities."
          }
          fetchParams={lanhaParams}
          seeAllHref="/cruise-tours?destination=Lan%20Ha%20Bay"
        />
        <CruiseSection
          title={s.baitulong?.title || "Cruise tours of Baitulong Bay"}
          description={
            s.baitulong?.description ||
            "Bai Tu Long Bay is a peaceful and less touristy destination, offering a tranquil escape from the crowds."
          }
          fetchParams={baitulongParams}
          seeAllHref="/cruise-tours?destination=Bai%20Tu%20Long%20Bay"
        />
        <CustomerReviews />
        <Specialists />
        <BlogGallery />
      </main>
      <Footer />
    </>
  );
}
