"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterSimple from '@/components/sections/footer/FooterSimple';
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="shift-hover"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="small"
            sizing="largeSmall"
            background="none"
            cardStyle="glass-elevated"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Harvest"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Menu", id: "menu" },
                            { name: "Gallery", id: "gallery" },
                            { name: "About", id: "about" },
                            { name: "Reservations", id: "reservations" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Book Now", href: "reservations" }}
                    />
                </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">
                        <BlogCardThree
                            blogs={posts}
                            title="Featured Articles"
                            description="Discover culinary insights and seasonal inspirations"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Navigate",                                items: [
                                    { label: "Menu", href: "#menu" },
                                    { label: "Gallery", href: "#gallery" },
                                    { label: "About", href: "#about" }
                                ]
                            },
                            {
                                title: "Dine With Us",                                items: [
                                    { label: "Reservations", href: "#reservations" },
                                    { label: "Private Events", href: "#" },
                                    { label: "Gift Cards", href: "#" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Contact Us", href: "#contact" },
                                    { label: "Follow on Instagram", href: "#" },
                                    { label: "Newsletter", href: "#reservations" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Harvest Restaurant. All rights reserved."
                        bottomRightText="Celebrating local, seasonal, sustainable dining"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}