"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterBaseReveal from "@/components/sections/footer/FooterBaseReveal";
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="shift-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="sharp"
            contentWidth="mediumSmall"
            sizing="largeSizeMediumTitles"
            background="none"
            cardStyle="subtle-shadow"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="BrewCraft"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Products", id: "products" },
                            { name: "How We Work", id: "process" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Order Now", 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="Discover the world of specialty coffee through expert insights, brewing guides, and stories from our roasters"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Product",                                items: [
                                    { label: "Shop Coffee", href: "products" },
                                    { label: "Brewing Guides", href: "#" },
                                    { label: "Gift Cards", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Our Story", href: "#" },
                                    { label: "Careers", href: "#" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Contact Us", href: "contact" },
                                    { label: "FAQ", href: "#" },
                                    { label: "Shipping Info", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 BrewCraft | Specialty Coffee Roasters"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}