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

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-shift"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="mediumLarge"
            sizing="largeSmall"
            background="grid"
            cardStyle="gradient-radial"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Midnight Cafe"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Our Story", id: "about" },
                            { name: "The Experience", id: "features" },
                            { name: "Community", id: "testimonials" },
                            { name: "Visit Us", id: "contact" },
                            { name: "Journal", id: "blog" }
                        ]}
                        button={{ text: "Find Us Tonight", 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 Chronicles"
                            description="Stories, insights, and musings from our midnight journeys through coffee culture"
                            tag="Journal"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tagAnimation="blur-reveal"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Navigate",                                items: [
                                    { label: "Our Story", href: "#about" },
                                    { label: "The Experience", href: "#features" },
                                    { label: "Community", href: "#testimonials" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Visit Us", href: "#contact" },
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Email", href: "mailto:hello@midnightcafe.local" }
                                ]
                            },
                            {
                                title: "Values",                                items: [
                                    { label: "Ethical Sourcing", href: "#about" },
                                    { label: "Slow Living", href: "#about" },
                                    { label: "Community First", href: "#testimonials" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Midnight Cafe. All rights reserved."
                        bottomRightText="Crafted with intention"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}