"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterLogoReveal from '@/components/sections/footer/FooterLogoReveal';
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="hover-magnetic"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="small"
            sizing="largeSmall"
            background="circleGradient"
            cardStyle="glass-elevated"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="RealEstate"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Listings", id: "products" },
                            { name: "Market", id: "metric" },
                            { name: "Testimonials", id: "testimonial" },
                            { name: "Contact", id: "contact" }
                        ]}
                        bottomLeftText="Premium Properties"
                        bottomRightText="hello@realestate.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">
                        <BlogCardThree
                            blogs={posts}
                            title="Real Estate Insights"
                            description="Explore our latest market insights and property trends"
                            tag="Market Updates"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoReveal
                        logoText="RealEstate"
                        leftLink={{ text: "Privacy Policy", href: "#privacy" }}
                        rightLink={{ text: "Terms of Service", href: "#terms" }}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}