"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 NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="directional-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="mediumSmall"
            sizing="mediumLarge"
            background="floatingGradient"
            cardStyle="outline"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="PropertyHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Browse", id: "properties" },
                            { name: "Features", id: "features" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "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="PropertyHub Insights"
                            description="Explore the latest trends and insights in real estate"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="PropertyHub"
                        copyrightText="© 2025 PropertyHub. All rights reserved."
                        columns={[
                            {
                                title: "Browse",                                items: [
                                    { label: "All Properties", href: "properties" },
                                    { label: "New Listings", href: "#" },
                                    { label: "Saved Favorites", href: "#" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Buying Guide", href: "#" },
                                    { label: "Market Insights", href: "#" },
                                    { label: "Agent Directory", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#" },
                                    { label: "Contact", href: "contact" },
                                    { label: "Privacy Policy", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}