"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBaseCard from '@/components/sections/footer/FooterBaseCard';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen';
import { useBlogPosts } from "@/hooks/useBlogPosts";

export default function BlogPage() {
    const { posts, isLoading } = useBlogPosts();

    return (
        <ThemeProvider
            defaultButtonVariant="icon-arrow"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="medium"
            sizing="medium"
            background="none"
            cardStyle="gradient-bordered"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="layered"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Features", id: "features" },
                            { name: "Pricing", id: "pricing" },
                            { name: "Results", id: "results" },
                            { name: "FAQ", id: "faq" },
                            { name: "Contact", id: "contact" }
                        ]}
                        brandName="RealtimeAI"
                        bottomLeftText="Real Estate Automation"
                        bottomRightText="hello@realtimeai.com"
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardThree
                            blogs={posts}
                            title="Featured Articles"
                            description="Explore our latest insights and updates from the RealtimeAI team"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    )}

                    <FooterBaseCard
                        logoText="RealtimeAI"
                        columns={[
                            {
                                title: "Product",                                items: [
                                    { label: "Features", href: "#features-bento" },
                                    { label: "Pricing", href: "#pricing" },
                                    { label: "Security", href: "/security" },
                                    { label: "API Docs", href: "https://docs.realtimeai.com" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "/about" },
                                    { label: "Blog", href: "/blog" },
                                    { label: "Careers", href: "/careers" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Help Center", href: "https://help.realtimeai.com" },
                                    { label: "Webinars", href: "/webinars" },
                                    { label: "Case Studies", href: "/case-studies" },
                                    { label: "Community", href: "https://community.realtimeai.com" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "/privacy" },
                                    { label: "Terms of Service", href: "/terms" },
                                    { label: "Compliance", href: "/compliance" },
                                    { label: "Fair Housing", href: "/fair-housing" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 RealtimeAI. All rights reserved. Automating real estate, one agent at a time."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}