"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="expand-hover"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="medium"
            sizing="largeSizeMediumTitles"
            background="none"
            cardStyle="glass-depth"
            primaryButtonStyle="flat"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Savor"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Menu", id: "menu" },
                            { name: "Gallery", id: "gallery" },
                            { name: "Reservations", id: "reservations" }
                        ]}
                        button={{ text: "Reserve Now", href: "reservations" }}
                    />
                </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="Latest Articles"
                            description="Insights and updates from our culinary team"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Restaurant",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Our Menu", href: "menu" },
                                    { label: "Gallery", href: "gallery" },
                                    { label: "Reservations", href: "reservations" }
                                ]
                            },
                            {
                                title: "Dining",                                items: [
                                    { label: "Lunch Hours", href: "#" },
                                    { label: "Dinner Hours", href: "#" },
                                    { label: "Private Events", href: "#" },
                                    { label: "Catering", href: "#" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Contact", href: "contact" },
                                    { label: "Phone: (555) 123-4567", href: "#" },
                                    { label: "Email: hello@savor.com", href: "#" },
                                    { label: "Follow Us", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2024 Savor Restaurant. All rights reserved."
                        bottomRightText="Crafted with culinary passion"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}