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

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-shift"
            defaultTextAnimation="entrance-slide"
            borderRadius="soft"
            contentWidth="mediumSmall"
            sizing="mediumLargeSizeMediumTitles"
            background="none"
            cardStyle="soft-shadow"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="glass"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Cuisine"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Menu", id: "menu" },
                            { name: "Gallery", id: "gallery" },
                            { name: "Reservations", id: "contact" }
                        ]}
                        button={{ text: "Reserve Table", href: "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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Culinary Stories"
                            description="Discover the latest from our kitchen, dining experiences, and culinary insights"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="Cuisine"
                        copyrightText="© 2025 Cuisine Restaurant. All rights reserved."
                        columns={[
                            {
                                title: "Restaurant",                                items: [
                                    { label: "Home", href: "home" },
                                    { label: "Menu", href: "menu" },
                                    { label: "Gallery", href: "gallery" }
                                ]
                            },
                            {
                                title: "Dining",                                items: [
                                    { label: "Reservations", href: "contact" },
                                    { label: "Private Events", href: "#" },
                                    { label: "Catering", href: "#" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Phone", href: "#" },
                                    { label: "Email", href: "#" },
                                    { label: "Location", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}