"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="bounce-effect"
            defaultTextAnimation="entrance-slide"
            borderRadius="soft"
            contentWidth="smallMedium"
            sizing="mediumLarge"
            background="aurora"
            cardStyle="gradient-radial"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Browse", id: "properties" },
                            { name: "About", id: "about" },
                            { name: "Services", id: "services" },
                            { name: "Contact", id: "contact" },
                            { name: "Blog", id: "blog" }
                        ]}
                        brandName="PropertyHub"
                        bottomLeftText="Find Your Dream Home"
                        bottomRightText="hello@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">
                        <BlogCardOne
                            blogs={posts}
                            title="PropertyHub Blog"
                            description="Discover the latest real estate insights, market trends, and property investment tips from our expert team."
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        logoText="PropertyHub"
                        columns={[
                            {
                                items: [
                                    { label: "Browse Properties", href: "properties" },
                                    { label: "Featured Listings", href: "properties" },
                                    { label: "New Listings", href: "properties" }
                                ]
                            },
                            {
                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Our Team", href: "team" },
                                    { label: "Careers", href: "#" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Buyer Guide", href: "#" },
                                    { label: "Seller Resources", href: "#" },
                                    { label: "Blog", href: "blog" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Contact", href: "contact" },
                                    { label: "Support", href: "#" },
                                    { label: "FAQ", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}