"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterMedia from '@/components/sections/footer/FooterMedia';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingOverlay from '@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay';
import { useBlogPosts } from "@/hooks/useBlogPosts";
import { Coffee } from 'lucide-react';

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-stagger"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="small"
            sizing="mediumLarge"
            background="none"
            cardStyle="gradient-radial"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Midnight Cafe"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Menu", id: "menu" },
                            { name: "About", id: "about" },
                            { name: "Atmosphere", id: "atmosphere" },
                            { name: "Community", id: "community" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Visit Today", 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="Cafe Stories"
                            description="Discover the heart of our community through stories, recipes, and moments shared at Midnight Cafe"
                            tag="Blog"
                            tagIcon={Coffee}
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/full-shot-business-owner-standing-outdoors_23-2149434497.jpg"
                        imageAlt="Midnight Cafe storefront in the evening"
                        logoText="Midnight Cafe"
                        copyrightText="© 2025 Midnight Cafe. A neighborhood ritual."
                        columns={[
                            {
                                title: "Hours",                                items: [
                                    { label: "Mon-Fri: 7am - 11pm", href: "" },
                                    { label: "Sat-Sun: 8am - 12am", href: "" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Email", href: "mailto:hello@midnightcafe.local" },
                                    { label: "Phone", href: "tel:+1234567890" }
                                ]
                            },
                            {
                                title: "Visit",                                items: [
                                    { label: "123 Neighborhood St", href: "https://maps.google.com" },
                                    { label: "Parking Available", href: "" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}