"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterSimple from "@/components/sections/footer/FooterSimple";
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="text-stagger"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="medium"
            sizing="largeSmall"
            background="floatingGradient"
            cardStyle="subtle-shadow"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="layered"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleApple
                        brandName="Local Brew"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Products", id: "products" },
                            { name: "Merch", id: "merch" },
                            { name: "Contact", id: "contact" }
                        ]}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardOne
                            blogs={posts}
                            title="Coffee Stories & Brewing Insights"
                            description="Discover the art of coffee through our expert guides, brewing tips, and stories from passionate coffee lovers around the world."
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    )}

                    <FooterSimple
                        columns={[
                            {
                                title: "Cafe",                                items: [
                                    { label: "Menu", href: "#" },
                                    { label: "About", href: "#" },
                                    { label: "Locations", href: "#" }
                                ]
                            },
                            {
                                title: "Shop",                                items: [
                                    { label: "Merchandise", href: "#" },
                                    { label: "Coffee Beans", href: "#" },
                                    { label: "Gift Cards", href: "#" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Contact", href: "#" },
                                    { label: "Instagram", href: "#" },
                                    { label: "Newsletter", href: "#" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy", href: "#" },
                                    { label: "Terms", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Local Brew. All rights reserved."
                        bottomRightText="Made with love for coffee lovers"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}