"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="directional-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="small"
            sizing="mediumLargeSizeMediumTitles"
            background="none"
            cardStyle="gradient-mesh"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarLayoutFloatingInline
                        brandName="Brew Haven"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Menu", id: "menu" },
                            { name: "About", id: "about" },
                            { name: "Locations", id: "contact" },
                            { name: "Merch", id: "products" }
                        ]}
                        button={{ text: "Order Now", href: "#contact" }}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardThree
                            blogs={posts}
                            title="Brew Haven Blog"
                            description="Discover the world of coffee through our stories, tips, and brewing guides"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    )}

                    <FooterBaseCard
                        logoText="Brew Haven"
                        columns={[
                            {
                                title: "Menu",                                items: [
                                    { label: "Coffee", href: "#menu" },
                                    { label: "Pastries", href: "#menu" },
                                    { label: "Merchandise", href: "#products" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Careers", href: "/careers" },
                                    { label: "Blog", href: "/blog" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Facebook", href: "https://facebook.com" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Brew Haven. All rights reserved."
                        onPrivacyClick={null}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}