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

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

    return (
        <ThemeProvider
            defaultButtonVariant="elastic-effect"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="mediumSmall"
            sizing="largeSmallSizeMediumTitles"
            background="none"
            cardStyle="gradient-mesh"
            primaryButtonStyle="flat"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Alisa"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Shop", id: "/shop" },
                            { name: "About", id: "about" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Order Now", href: "/shop" }}
                    />
                </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="Latest Flower Care Tips"
                            description="Discover expert insights on flower care, arrangement ideas, and seasonal gardening tips"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        logoText="Alisa"
                        columns={[
                            {
                                items: [
                                    { label: "Shop Flowers", href: "/shop" },
                                    { label: "About Us", href: "about" },
                                    { label: "Testimonials", href: "testimonials" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Contact Us", href: "contact" },
                                    { label: "Delivery Info", href: "#" },
                                    { label: "Care Tips", href: "#" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms of Service", href: "#" },
                                    { label: "Return Policy", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}