"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from '@/components/sections/blog/BlogCardOne';
import FooterLogoReveal from '@/components/sections/footer/FooterLogoReveal';
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="text-shift"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="mediumLarge"
            sizing="largeSizeMediumTitles"
            background="none"
            cardStyle="solid"
            primaryButtonStyle="flat"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="PropertyHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Browse", id: "properties" },
                            { name: "About", id: "about" },
                            { name: "How It Works", id: "features" },
                            { 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">
                        <BlogCardOne
                            blogs={posts}
                            title="Latest Property Insights"
                            description="Stay informed with the latest real estate trends, market updates, and property investment tips from our experts."
                            tag="Property Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            ariaLabel="Property blog section"
                        />
                    </div>
                )}

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