"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterSimple from '@/components/sections/footer/FooterSimple';
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="text-stagger"
            defaultTextAnimation="entrance-slide"
            borderRadius="soft"
            contentWidth="mediumSmall"
            sizing="largeSmall"
            background="floatingGradient"
            cardStyle="solid"
            primaryButtonStyle="flat"
            secondaryButtonStyle="solid"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="Delicious Haven"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Menu", id: "menu" },
                            { name: "Gallery", id: "gallery" },
                            { name: "Reservations", id: "reservations" },
                            { name: "About", id: "about" },
                            { 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">
                        <BlogCardOne
                            blogs={posts}
                            title="Culinary Chronicles"
                            description="Discover the stories behind our signature dishes, seasonal ingredients, and culinary inspirations"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Restaurant",                                items: [
                                    { label: "Menu", href: "#menu" },
                                    { label: "Reservations", href: "#reservations" },
                                    { label: "Gallery", href: "#gallery" }
                                ]
                            },
                            {
                                title: "Information",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Contact", href: "#contact" },
                                    { label: "Hours", href: "#" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Facebook", href: "#" },
                                    { label: "Instagram", href: "#" },
                                    { label: "Email", href: "mailto:info@delicioushaven.com" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Delicious Haven Restaurant. All rights reserved."
                        bottomRightText="Made with passion for great food"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}