"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterMedia from '@/components/sections/footer/FooterMedia';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-stagger"
            defaultTextAnimation="entrance-slide"
            borderRadius="rounded"
            contentWidth="compact"
            sizing="largeSmallSizeLargeTitles"
            background="floatingGradient"
            cardStyle="layered-gradient"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="layered"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="Brew & Bean"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Menu", id: "menu" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        bottomLeftText="Coffee Culture"
                        bottomRightText="hello@brewandbean.com"
                    />
                </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 Coffee Stories"
                            description="Discover the stories behind our exceptional coffee and the culture that drives us"
                            tag="Coffee Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/table-chairs-bar_107420-65857.jpg"
                        imageAlt="Brew & Bean coffee shop storefront"
                        logoText="Brew & Bean"
                        copyrightText="© 2025 Brew & Bean Coffee. All rights reserved."
                        columns={[
                            {
                                title: "Menu",                                items: [
                                    { label: "Espresso", href: "#menu" },
                                    { label: "Cappuccino", href: "#menu" },
                                    { label: "Cold Brew", href: "#menu" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About", href: "#about" },
                                    { label: "Our Story", href: "#about" },
                                    { label: "Sustainability", href: "#about" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Phone: (555) 123-4567", href: "#" },
                                    { label: "Email: hello@brewandbean.com", href: "#" },
                                    { label: "123 Coffee Lane, Your City", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}