"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from "@/components/sections/blog/BlogCardThree";
import FooterBaseReveal from "@/components/sections/footer/FooterBaseReveal";
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="hover-magnetic"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="mediumSmall"
            sizing="medium"
            background="floatingGradient"
            cardStyle="outline"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Midnight Cafe"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Experience", id: "experience" },
                            { name: "About", id: "about" },
                            { name: "Community", id: "community" }
                        ]}
                        button={{ text: "Visit Us", 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">
                        <BlogCardThree
                            blogs={posts}
                            title="Featured Articles"
                            description="Discover stories from the heart of our cafe community"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Visit",                                items: [
                                    { label: "Location", href: "#" },
                                    { label: "Hours", href: "#" },
                                    { label: "Menu", href: "#" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Contact Us", href: "contact" },
                                    { label: "Reservations", href: "#" }
                                ]
                            },
                            {
                                title: "About",                                items: [
                                    { label: "Our Story", href: "#" },
                                    { label: "Sustainability", href: "#" },
                                    { label: "Press", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Midnight Cafe | Made with care. Served with love."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}