"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 NavbarLayoutFloatingInline from "@/components/navbar/NavbarLayoutFloatingInline";
import { useBlogPosts } from "@/hooks/useBlogPosts";
import { Coffee } from "lucide-react";

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

    return (
        <ThemeProvider
            defaultButtonVariant="shift-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="soft"
            contentWidth="smallMedium"
            sizing="largeSmall"
            background="floatingGradient"
            cardStyle="elevated"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="solid"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Brew Haven"
                        navItems={[
                            { name: "Home", id: "hero" },
                            { name: "About", id: "about" },
                            { name: "Menu", id: "products" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Visit Us", 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="Brew Haven Journal"
                            description="Discover stories, tips, and insights from the world of coffee. From brewing techniques to origin stories, explore our passion for exceptional coffee experiences."
                            tag="Coffee Blog"
                            tagIcon={Coffee}
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tagAnimation="slide-up"
                            buttons={[
                                { text: "View All Posts", href: "#blog" },
                                { text: "Subscribe", href: "#newsletter" }
                            ]}
                            buttonAnimation="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Navigate",                                items: [
                                    { label: "Home", href: "#hero" },
                                    { label: "About", href: "#about" },
                                    { label: "Menu", href: "#products" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Facebook", href: "https://facebook.com" },
                                    { label: "Twitter", href: "https://twitter.com" },
                                    { label: "Email", href: "mailto:hello@brewhaven.com" }
                                ]
                            },
                            {
                                title: "Hours",                                items: [
                                    { label: "Monday - Friday: 6 AM - 8 PM", href: "#" },
                                    { label: "Saturday - Sunday: 7 AM - 9 PM", href: "#" },
                                    { label: "Closed Holidays", href: "#" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms of Service", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Brew Haven. All rights reserved."
                        bottomRightText="Crafted with ☕ and passion"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
