"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBase from '@/components/sections/footer/FooterBase';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="slide-background"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="mediumSmall"
            sizing="largeSmallSizeLargeTitles"
            background="circleGradient"
            cardStyle="outline"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="Buona Tavola"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Menu", id: "menu" },
                            { name: "About", id: "about" },
                            { name: "Reservations", id: "reservations" },
                            { name: "Gallery", id: "gallery" },
                            { name: "Contact", id: "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">
                        <BlogCardThree
                            blogs={posts}
                            title="From Our Kitchen"
                            description="Discover authentic Italian recipes, cooking tips, and the stories behind our traditional dishes"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Culinary Stories"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="Buona Tavola"
                        columns={[
                            {
                                title: "Restaurant",                                items: [
                                    { label: "Hours", href: "#contact" },
                                    { label: "Location", href: "#contact" },
                                    { label: "Menu", href: "#menu" }
                                ]
                            },
                            {
                                title: "Dining",                                items: [
                                    { label: "Reservations", href: "https://www.resy.com" },
                                    { label: "Private Events", href: "#contact" },
                                    { label: "Wine List", href: "#menu" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Contact Us", href: "#contact" },
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Facebook", href: "https://facebook.com" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Buona Tavola. Authentic Italian Cuisine."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}