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

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-shift"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="smallMedium"
            sizing="mediumSizeLargeTitles"
            background="none"
            cardStyle="gradient-bordered"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Café Madrid"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Menu", id: "features" },
                            { name: "About", id: "about" },
                            { name: "Community", id: "testimonials" },
                            { name: "Visit", id: "contact" }
                        ]}
                        button={{ text: "Find Your Spot", 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">
                        <BlogCardOne
                            blogs={posts}
                            title="Coffee Stories & Insights"
                            description="Discover the rich flavors, traditions, and community stories that make Café Madrid special"
                            tag="Our Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Navigate",                                items: [
                                    { label: "Menu", href: "#features" },
                                    { label: "About", href: "#about" },
                                    { label: "Community", href: "#testimonials" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Instagram", href: "https://instagram.com/cafemadrid" },
                                    { label: "Contact", href: "mailto:info@cafemadrid.es" },
                                    { label: "Location", href: "https://maps.google.com" }
                                ]
                            },
                            {
                                title: "Info",                                items: [
                                    { label: "Hours", href: "#faq" },
                                    { label: "Privacy", href: "#" },
                                    { label: "Terms", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Café Madrid. All rights reserved."
                        bottomRightText="Quality coffee, where Madrid meets calm."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}