"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from '@/components/sections/blog/BlogCardOne';
import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal';
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="hover-bubble"
            defaultTextAnimation="reveal-blur"
            borderRadius="sharp"
            contentWidth="smallMedium"
            sizing="mediumSizeLargeTitles"
            background="circleGradient"
            cardStyle="gradient-radial"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Savoria"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Menu", id: "menu" },
                            { name: "Gallery", id: "gallery" },
                            { name: "About", id: "about" },
                            { name: "Reservations", id: "reservation" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Book Now", href: "reservation" }}
                    />
                </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">
                            <BlogCardOne
                                blogs={posts}
                                title="Culinary Stories"
                                description="Discover the stories behind our dishes, culinary traditions, and the passionate chefs who make it all possible"
                                textboxLayout="default"
                                useInvertedBackground="noInvert"
                                carouselMode="buttons"
                                animationType="slide-up"
                            />
                        </div>
                    )}

                    <div id="footer" data-section="footer">
                        <FooterBaseReveal
                            columns={[
                                {
                                    title: "Restaurant",                                    items: [
                                        { label: "Menu", href: "menu" },
                                        { label: "Reservations", href: "reservation" },
                                        { label: "Gallery", href: "gallery" },
                                        { label: "Private Events", href: "about" }
                                    ]
                                },
                                {
                                    title: "Company",                                    items: [
                                        { label: "About Us", href: "about" },
                                        { label: "Contact", href: "contact" },
                                        { label: "Press", href: "menu" },
                                        { label: "Careers", href: "about" }
                                    ]
                                },
                                {
                                    title: "Connect",                                    items: [
                                        { label: "Instagram", href: "https://instagram.com" },
                                        { label: "Facebook", href: "https://facebook.com" },
                                        { label: "Email", href: "https://example.com" },
                                        { label: "Newsletter", href: "reservation" }
                                    ]
                                }
                            ]}
                            copyrightText="© 2025 Savoria. All rights reserved."
                        />
                    </div>
            </ReactLenis>
        </ThemeProvider>
    );
}