"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
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="slide-background"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="medium"
            sizing="largeSmallSizeMediumTitles"
            background="floatingGradient"
            cardStyle="glass-elevated"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="solid"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleCentered
                        brandName="Bean & Leaf"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Menu", id: "menu" },
                            { name: "Gallery", id: "gallery" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Reserve a Table", href: "contact" }}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardThree
                            blogs={posts}
                            title="Featured Articles"
                            description="Discover our latest stories about coffee, community, and culinary craftsmanship"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            tag="Blog"
                            carouselMode="buttons"
                        />
                    )}

                    <FooterSimple
                        columns={[
                            {
                                title: "Menu",                                items: [
                                    { label: "Coffee & Drinks", href: "#menu" },
                                    { label: "Pastries & Desserts", href: "#menu" },
                                    { label: "Lunch Options", href: "#menu" },
                                    { label: "Seasonal Specials", href: "#menu" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Our Story", href: "#about" },
                                    { label: "Contact", href: "#contact" },
                                    { label: "Instagram", href: "https://instagram.com" }
                                ]
                            },
                            {
                                title: "Visit Us",                                items: [
                                    { label: "Hours: 7 AM - 7 PM", href: "#" },
                                    { label: "123 Main Street", href: "#" },
                                    { label: "(555) 123-4567", href: "tel:+15551234567" },
                                    { label: "Reserve a Table", href: "#contact" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Bean & Leaf Coffee Roastery. All rights reserved."
                        bottomRightText="Crafted with care for our community."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}