"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="bounce-effect"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="compact"
            sizing="mediumSizeLargeTitles"
            background="floatingGradient"
            cardStyle="inset"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="solid"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="PropFinder"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Browse Properties", id: "properties" },
                            { name: "How It Works", id: "how-it-works" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "List Property", href: "#contact" }}
                    />
                </div>

                {isLoading ? (
                    <div className="w-content-width mx-auto py-20 text-center">
                        <p className="text-foreground">Loading posts...</p>
                    </div>
                ) : (
                    <div id="blog" data-section="blog">
                        <BlogCardThree
                            blogs={posts}
                            title="PropFinder Insights"
                            description="Discover the latest trends, tips, and insights in real estate from our experts"
                            tag="Real Estate"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="PropFinder"
                        copyrightText="© 2025 PropFinder. All rights reserved."
                        columns={[
                            {
                                title: "Browse",                                items: [
                                    { label: "All Properties", href: "#properties" },
                                    { label: "New Listings", href: "#properties" },
                                    { label: "Open Houses", href: "#properties" }
                                ]
                            },
                            {
                                title: "For Agents",                                items: [
                                    { label: "Become an Agent", href: "#contact" },
                                    { label: "Agent Resources", href: "#" },
                                    { label: "Training & Support", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Contact Support", href: "contact" },
                                    { label: "Careers", href: "#" }
                                ]
                            }
                        ]}
                        onPrivacyClick={null}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}