import type { Metadata } from 'next'
import Navbar from '@/components/Navbar'
import GuideLinks from '@/components/GuideLinks'
import Hero from '@/components/Hero'
import Ticker from '@/components/Ticker'
import Features from '@/components/Features'
import BrownLeaf from '@/components/BrownLeaf'
import Intelligence from '@/components/Intelligence'
import HowItWorks from '@/components/HowItWorks'
import FAQ from '@/components/FAQ'
import CTA from '@/components/CTA'
import Footer from '@/components/Footer'
import type { Lang } from '@/lib/i18n'
import { getHomeSchemas } from '@/lib/homeSchema'

export const metadata: Metadata = {
  title: 'GreenLens — Pflanze scannen, Name + Pflegeplan sofort',
  description:
    'Foto machen, Pflanze erkennen und sofort den Pflegeplan bekommen — bevor sie eingeht. Über 450 Arten, 1 Scan gratis, keine Kreditkarte nötig.',
  alternates: {
    canonical: '/',
    languages: {
      de: '/',
      en: '/en',
      es: '/es',
      'x-default': '/',
    },
  },
}

export default function Home({ locale = 'de' }: { locale?: Lang }) {
  const { howTo: howToSchema, faq: faqSchema } = getHomeSchemas(locale)
  return (
    <>
      <script
        type="application/ld+json"
        dangerouslySetInnerHTML={{ __html: JSON.stringify(howToSchema) }}
      />
      <script
        type="application/ld+json"
        dangerouslySetInnerHTML={{ __html: JSON.stringify(faqSchema) }}
      />
      <Navbar />
      <main>
        <Hero />
        <Ticker />
        <Features />
        <BrownLeaf />
        <Intelligence />
        <HowItWorks />
        <FAQ />
        <GuideLinks />
        <CTA />
      </main>
      <Footer />
    </>
  )
}
