"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="slide-background"
            defaultTextAnimation="background-highlight"
            borderRadius="sharp"
            contentWidth="compact"
            sizing="large"
            background="none"
            cardStyle="gradient-radial"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="layered"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="BrewCraft"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Products", id: "products" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" },
                            { name: "Order Now", id: "https://www.example.com/order" }
                        ]}
                    />
                </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="Coffee Chronicles"
                            description="Dive into the art and science of brewing, discover the stories behind our beans, and explore the culture that makes each cup special."
                            tag="Featured"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "Menu", href: "https://www.example.com/menu" },
                                    { label: "Order Online", href: "https://www.example.com/order" },
                                    { label: "Gift Cards", href: "https://www.example.com/gifts" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Careers", href: "https://www.example.com/careers" },
                                    { label: "Blog", href: "https://www.example.com/blog" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Contact", href: "contact" },
                                    { label: "Instagram", href: "https://instagram.com/brewcraft" },
                                    { label: "Facebook", href: "https://facebook.com/brewcraft" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 BrewCraft Coffee. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}