"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterLogoEmphasis from "@/components/sections/footer/FooterLogoEmphasis";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingOverlay from "@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay";
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="small"
            sizing="mediumSizeLargeTitles"
            background="none"
            cardStyle="subtle-shadow"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarLayoutFloatingOverlay
                        brandName="Drink Morning"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Menu", id: "menu" },
                            { name: "About", id: "about" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "FAQ", id: "faq" },
                            { 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>
                    ) : (
                        <BlogCardOne
                            blogs={posts}
                            title="Latest from Drink Morning"
                            description="Discover coffee culture, brewing tips, and stories from our community"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    )}

                    <FooterLogoEmphasis
                        logoText="Drink Morning"
                        columns={[
                            {
                                items: [
                                    { label: "Menu", href: "#menu" },
                                    { label: "Catering", href: "#contact" },
                                    { label: "Gift Cards", href: "https://example.com/giftcards" }
                                ]
                            },
                            {
                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Our Story", href: "#about" },
                                    { label: "Sustainability", href: "https://example.com/sustainability" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Contact", href: "#contact" },
                                    { label: "Location", href: "https://maps.google.com" },
                                    { label: "Hours", href: "#faq" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Facebook", href: "https://facebook.com" },
                                    { label: "Twitter", href: "https://twitter.com" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}