"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="medium"
            sizing="mediumLargeSizeMediumTitles"
            background="fluid"
            cardStyle="solid"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="layered"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Dubai Realty"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Properties", id: "properties" },
                            { name: "Services", id: "services" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Schedule Tour", 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="Latest Insights"
                            description="Stay updated with the latest trends and insights from Dubai's real estate market"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                            tagAnimation="slide-up"
                            buttonAnimation="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Our Team", href: "about" },
                                    { label: "Careers", href: "#" },
                                    { label: "Blog", href: "#" }
                                ]
                            },
                            {
                                title: "Services",                                items: [
                                    { label: "Buy Property", href: "properties" },
                                    { label: "Sell Property", href: "#" },
                                    { label: "Property Management", href: "#" },
                                    { label: "Investment Advisory", href: "#" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Contact Us", href: "contact" },
                                    { label: "FAQ", href: "#" },
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms & Conditions", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Dubai Realty. All rights reserved. | Dubai, UAE"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}