"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterBase from '@/components/sections/footer/FooterBase';
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="text-shift"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="compact"
            sizing="mediumSizeLargeTitles"
            background="floatingGradient"
            cardStyle="gradient-radial"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Properties", id: "properties" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "contact" },
                            { name: "Blog", id: "blog" }
                        ]}
                        brandName="PropertyHub"
                        bottomLeftText="Premium Real Estate"
                        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">
                        <BlogCardTwo
                            blogs={posts}
                            title="PropertyHub Insights"
                            description="Stay updated with the latest real estate trends, market insights, and property investment tips from our expert team"
                            tag="Real Estate Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="PropertyHub"
                        columns={[
                            {
                                title: "Product",                                items: [
                                    { label: "Search Properties", href: "properties" },
                                    { label: "List Property", href: "https://seller.propertyhub.com" },
                                    { label: "Pricing", href: "featured" },
                                    { label: "Virtual Tours", href: "https://tours.propertyhub.com" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Blog", href: "blog" },
                                    { label: "Careers", href: "https://careers.propertyhub.com" },
                                    { label: "Contact", href: "contact" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "https://propertyhub.com/privacy" },
                                    { label: "Terms of Service", href: "https://propertyhub.com/terms" },
                                    { label: "Cookie Policy", href: "https://propertyhub.com/cookies" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 PropertyHub | All rights reserved"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}