"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterMedia from '@/components/sections/footer/FooterMedia';
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-magnetic"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="small"
            sizing="largeSizeMediumTitles"
            background="none"
            cardStyle="layered-gradient"
            primaryButtonStyle="flat"
            secondaryButtonStyle="layered"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Bee & Honey"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Featured", id: "products" },
                            { name: "About Us", id: "about" },
                            { name: "How It Works", id: "process" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Shop Now", href: "#products" }}
                    />
                </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 Floral Insights"
                                description="Discover the art of floral arrangement and care tips from our expert florists"
                                textboxLayout="default"
                                useInvertedBackground="noInvert"
                                carouselMode="buttons"
                                animationType="slide-up"
                                tag="Blog"
                            />
                        </div>
                    )}

                    <div id="footer" data-section="footer">
                        <FooterMedia
                            imageSrc="https://img.b2bpic.net/free-photo/beautiful-shot-flowers-plants-garden_181624-43880.jpg"
                            imageAlt="Beautiful flower garden background"
                            logoText="Bee & Honey"
                            copyrightText="© 2025 Bee & Honey Flowers. All rights reserved."
                            columns={[
                                {
                                    title: "Shop",                                    items: [
                                        { label: "Featured Arrangements", href: "#products" },
                                        { label: "Custom Orders", href: "#contact" },
                                        { label: "Seasonal Collections", href: "#products" }
                                    ]
                                },
                                {
                                    title: "Company",                                    items: [
                                        { label: "About Us", href: "#about" },
                                        { label: "How We Work", href: "#process" },
                                        { label: "Careers", href: "#" }
                                    ]
                                },
                                {
                                    title: "Support",                                    items: [
                                        { label: "Contact Us", href: "#contact" },
                                        { label: "Delivery Info", href: "#" },
                                        { label: "Care Guide", href: "#" }
                                    ]
                                }
                            ]}
                        />
                    </div>
            </ReactLenis>
        </ThemeProvider>
    );
}