"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterSimple from '@/components/sections/footer/FooterSimple';
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="directional-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="rounded"
            contentWidth="mediumSmall"
            sizing="large"
            background="floatingGradient"
            cardStyle="gradient-bordered"
            primaryButtonStyle="flat"
            secondaryButtonStyle="layered"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="PropertyHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Browse", id: "properties" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "contact" },
                            { name: "Resources", id: "resources" },
                            { name: "Sign In", id: "signin" }
                        ]}
                        bottomLeftText="Real Estate Solutions"
                        bottomRightText="info@propertyhub.com"
                    />
                </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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Property Insights & News"
                            description="Stay informed with the latest real estate market trends, investment tips, and property news from our experts"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Browse",                                items: [
                                    { label: "All Properties", href: "#properties" },
                                    { label: "New Listings", href: "#properties" },
                                    { label: "Featured", href: "#products" },
                                    { label: "Price Guide", href: "#" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Buyer's Guide", href: "#" },
                                    { label: "Market Insights", href: "#" },
                                    { label: "Investment Tips", href: "#" },
                                    { label: "Blog", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#" },
                                    { label: "Contact", href: "#contact" },
                                    { label: "Careers", href: "#" },
                                    { label: "Press", href: "#" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms & Conditions", href: "#" },
                                    { label: "Disclaimer", href: "#" },
                                    { label: "Accessibility", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 PropertyHub. All rights reserved."
                        bottomRightText="Made with PropertyHub"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}