"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
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="text-stagger"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="medium"
            sizing="largeSmall"
            background="aurora"
            cardStyle="glass-elevated"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Culinary Haven"
                        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: "Reserve 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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Culinary Chronicles"
                            description="Discover the stories behind our dishes, cooking techniques, and culinary inspirations from our kitchen to your table."
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Restaurant",                                items: [
                                    { label: "Menu", href: "#menu" },
                                    { label: "Gallery", href: "#gallery" },
                                    { label: "Reservations", href: "#reservations" }
                                ]
                            },
                            {
                                title: "Information",                                items: [
                                    { label: "About Us", href: "#" },
                                    { label: "Our Chef", href: "#" },
                                    { label: "Events", href: "#" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Phone", href: "#" },
                                    { label: "Email", href: "#" },
                                    { label: "Location", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Culinary Haven. All rights reserved."
                        bottomRightText="Made with Webild"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}