"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBase from '@/components/sections/footer/FooterBase';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import type { FooterColumn } from "@/components/shared/FooterColumns";
import NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="icon-arrow"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="smallMedium"
            sizing="mediumLarge"
            background="floatingGradient"
            cardStyle="soft-shadow"
            primaryButtonStyle="flat"
            secondaryButtonStyle="solid"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarLayoutFloatingInline
                        brandName="BrewHaven"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Menu", id: "products" },
                            { name: "Reviews", id: "testimonial" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Order Now", href: "https://example.com/order" }}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardThree
                            blogs={posts}
                            title="BrewHaven Coffee Stories"
                            description="Discover the world of coffee through our carefully crafted articles about brewing, origins, and culture"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Coffee Blog"
                        />
                    )}

                    <FooterBase
                        logoText="BrewHaven"
                        copyrightText="© 2025 BrewHaven Coffee. All rights reserved."
                        columns={[
                            {
                                title: "Menu",                                items: [
                                    { label: "Coffee Drinks", href: "products" },
                                    { label: "Brewing Guide", href: "menu" },
                                    { label: "Gift Cards", href: "https://example.com/gifts" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Our Story", href: "about" },
                                    { label: "Sustainability", href: "https://example.com/sustainability" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Contact", href: "contact" },
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Newsletter", href: "contact" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}