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

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-stagger"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="smallMedium"
            sizing="mediumLarge"
            background="circleGradient"
            cardStyle="gradient-mesh"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="layered"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleCentered
                        brandName="Luxury Estates HK"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Properties", id: "featured" },
                            { name: "Services", id: "services" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{
                            text: "Schedule Viewing",                            href: "contact"
                        }}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardTwo
                            blogs={posts}
                            title="Latest Real Estate Insights"
                            description="Stay informed with expert analysis and market trends in Hong Kong's luxury property sector"
                            tag="Property Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    )}

                    <FooterBase
                        logoText="Luxury Estates HK"
                        copyrightText="© 2025 Luxury Estates Hong Kong. All rights reserved."
                        columns={[
                            {
                                title: "Properties",                                items: [
                                    { label: "Featured Listings", href: "featured" },
                                    { label: "New Projects", href: "featured" },
                                    { label: "Investment", href: "services" }
                                ]
                            },
                            {
                                title: "Services",                                items: [
                                    { label: "Property Sales", href: "services" },
                                    { label: "Leasing", href: "services" },
                                    { label: "Valuation", href: "services" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Our Team", href: "#team" },
                                    { label: "Contact", href: "contact" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}