"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
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="slide-background"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="smallMedium"
            sizing="medium"
            background="none"
            cardStyle="soft-shadow"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="LuxeShop"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Shop", id: "products" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "contact" },
                            { name: "Cart", id: "cart" }
                        ]}
                        button={{ text: "Shop Now", href: "https://example.com/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">
                        <BlogCardThree
                            blogs={posts}
                            title="Featured Articles"
                            description="Discover our premium collection insights and luxury lifestyle stories"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        logoText="LuxeShop"
                        columns={[
                            {
                                items: [
                                    { label: "Shop", href: "shop" },
                                    { label: "New Arrivals", href: "new-arrivals" },
                                    { label: "Collections", href: "collections" }
                                ]
                            },
                            {
                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Our Story", href: "story" },
                                    { label: "Craftsmanship", href: "craftsmanship" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Customer Care", href: "support" },
                                    { label: "Shipping Info", href: "shipping" },
                                    { label: "Returns", href: "returns" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Contact", href: "contact" },
                                    { label: "Privacy Policy", href: "privacy" },
                                    { label: "Terms of Service", href: "terms" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Follow Us", href: "https://instagram.com" },
                                    { label: "Facebook", href: "https://facebook.com" },
                                    { label: "Pinterest", href: "https://pinterest.com" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}