"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="bounce-effect"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="small"
            sizing="mediumSizeLargeTitles"
            background="circleGradient"
            cardStyle="outline"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="layered"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Menu", id: "menu" },
                            { name: "Gallery", id: "gallery" },
                            { name: "Reserve", id: "reservations" }
                        ]}
                        brandName="Elegance"
                        bottomLeftText="Fine Dining Experience"
                        bottomRightText="info@elegance.com"
                    />
                </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="Culinary Stories"
                            description="Discover the artistry behind our culinary creations"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Navigate",                                items: [
                                    { label: "Home", href: "hero" },
                                    { label: "About Us", href: "about" },
                                    { label: "Menu", href: "menu" }
                                ]
                            },
                            {
                                title: "Dine With Us",                                items: [
                                    { label: "Reservations", href: "reservations" },
                                    { label: "Gallery", href: "gallery" },
                                    { label: "Private Events", href: "#" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Hours", href: "#" },
                                    { label: "Location", href: "#" },
                                    { label: "Phone", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Elegance Restaurant. All rights reserved."
                        bottomRightText="Crafted with culinary passion"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}