"use client";

import { useState } from "react";
import { LandingHero } from "./landing/LandingHero";
import { AssetStats } from "./landing/AssetStats";
import { TopicEbookShowcase } from "./landing/TopicEbookShowcase";
import { CompareSection } from "./landing/CompareSection";
import { CommunityPreview } from "./landing/CommunityPreview";
import { FAQSection } from "./landing/FAQSection";
import { LandingCTA } from "./landing/LandingCTA";
import { LoginModal } from "./landing/LoginModal";

type LandingPageProps = {
  onJoin: () => void;
  onVerify: (userId: string) => Promise<boolean>;
  onVerifyByEmail?: (email: string, password: string) => Promise<boolean>;
  onVerifySuccess: () => void;
};

export function LandingPage({
  onJoin,
  onVerify,
  onVerifyByEmail,
  onVerifySuccess,
}: LandingPageProps) {
  const [loginModalOpen, setLoginModalOpen] = useState(false);

  return (
    <>
      <LandingHero />
      <AssetStats />
      <TopicEbookShowcase onLockedClick={() => setLoginModalOpen(true)} />
      <CompareSection />
      <CommunityPreview />
      <FAQSection />
      <LandingCTA onJoin={onJoin} onLogin={() => setLoginModalOpen(true)} />
      <LoginModal
        open={loginModalOpen}
        onClose={() => setLoginModalOpen(false)}
        onVerify={onVerify}
        onVerifyByEmail={onVerifyByEmail}
        onSuccess={onVerifySuccess}
      />
    </>
  );
}
