"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="slide-background"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="small"
            sizing="largeSmall"
            background="floatingGradient"
            cardStyle="elevated"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="PropertyHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Browse", id: "properties" },
                            { name: "About", id: "about" },
                            { name: "How It Works", id: "features" },
                            { name: "FAQ", id: "faq" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{
                            text: "List Property",                            href: "https://example.com/list"
                        }}
                    />
                </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">
                        <BlogCardOne
                            blogs={posts}
                            title="Property Insights & News"
                            description="Stay updated with the latest real estate trends, market insights, and expert tips from PropertyHub"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="PropertyHub"
                        columns={[
                            {
                                title: "Explore",                                items: [
                                    { label: "Browse Listings", href: "#properties" },
                                    { label: "Advanced Search", href: "#search-filters" },
                                    { label: "Market Reports", href: "#" },
                                    { label: "Investment Guide", href: "#" }
                                ]
                            },
                            {
                                title: "For Sellers",                                items: [
                                    { label: "List Your Property", href: "https://example.com/list" },
                                    { label: "Pricing Guide", href: "#" },
                                    { label: "Selling Timeline", href: "#" },
                                    { label: "Success Stories", href: "#testimonials" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Buyer's Guide", href: "#" },
                                    { label: "Financing Options", href: "#" },
                                    { label: "Market Insights", href: "#" },
                                    { label: "Blog", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Contact", href: "#contact" },
                                    { label: "Careers", href: "#" },
                                    { label: "Press", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 PropertyHub. All rights reserved."
                        onPrivacyClick={null}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}