import Seo from '@/components/Seo';
import PlatformLayout from '@/Layouts/PlatformLayout';
import type { PageProps } from '@/types';
import { usePage } from '@inertiajs/react';
import ArchitectureSection from './components/ArchitectureSection';
import CoverageSection from './components/CoverageSection';
import CtaSection from './components/CtaSection';
import HeroSection from './components/HeroSection';
import HowItWorksSection from './components/HowItWorksSection';
import LoanLifecycleSection from './components/LoanLifecycleSection';
import MetricsSection from './components/MetricsSection';
import ModulesSection from './components/ModulesSection';
import PricingTeaserSection, {
    type DbPlan,
} from './components/PricingTeaserSection';
import ProductDemoSection from './components/ProductDemoSection';
import TestimonialsSection from './components/TestimonialsSection';
import TrustedStrip from './components/TrustedStrip';

interface Props {
    plans: DbPlan[];
}

export default function Home({ plans }: Props) {
    const { ziggy } = usePage<PageProps>().props;
    const origin = ziggy?.url ?? '';

    return (
        <PlatformLayout>
            <Seo
                title="MFI Operating System for East Africa"
                description="Upepo Finance is the loan, savings, accounting, HR, and collections operating system built for microfinance institutions across Kenya, Uganda, Tanzania, and Rwanda."
            >
                <script
                    type="application/ld+json"
                    dangerouslySetInnerHTML={{
                        __html: JSON.stringify({
                            '@context': 'https://schema.org',
                            '@type': 'Organization',
                            name: 'Upepo Finance',
                            url: origin,
                            logo: `${origin}/images/logo.png`,
                            description:
                                'Upepo Finance is the MFI operating system for East Africa — loans, savings, accounting, HR, and collections, built for microfinance institutions.',
                            areaServed: [
                                'Kenya',
                                'Uganda',
                                'Tanzania',
                                'Rwanda',
                            ],
                        }),
                    }}
                />
            </Seo>

            <HeroSection />
            <TrustedStrip />
            <MetricsSection />
            <LoanLifecycleSection />
            <ProductDemoSection />
            <ModulesSection />
            <HowItWorksSection />
            <ArchitectureSection />
            <PricingTeaserSection plans={plans} />
            <TestimonialsSection />
            <CoverageSection />
            <CtaSection />
        </PlatformLayout>
    );
}
