"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 NavbarLayoutFloatingOverlay from '@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="bounce-effect"
            defaultTextAnimation="reveal-blur"
            borderRadius="sharp"
            contentWidth="smallMedium"
            sizing="medium"
            background="aurora"
            cardStyle="gradient-radial"
            primaryButtonStyle="flat"
            secondaryButtonStyle="glass"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="RealEstate"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Browse Properties", id: "properties" },
                            { name: "Featured Homes", id: "featured" },
                            { name: "About Us", id: "about" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Schedule Viewing", href: "#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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Real Estate Insights"
                            description="Stay informed with the latest trends, tips, and market updates in real estate"
                            tag="Property Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="RealEstate"
                        columns={[
                            {
                                title: "Browse",                                items: [
                                    { label: "All Properties", href: "#properties" },
                                    { label: "Featured Listings", href: "#featured-premium" },
                                    { label: "New Developments", href: "#properties" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Buying Guide", href: "https://example.com/guide" },
                                    { label: "Market Insights", href: "https://example.com/insights" },
                                    { label: "Mortgage Calculator", href: "https://example.com/calculator" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Contact", href: "#contact" },
                                    { label: "Careers", href: "https://example.com/careers" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 RealEstate Platform. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}