"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterSimple from '@/components/sections/footer/FooterSimple';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-shift"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="compact"
            sizing="largeSizeMediumTitles"
            background="none"
            cardStyle="inset"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="ShopHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Products", id: "/products" },
                            { name: "About", id: "/about" },
                            { name: "Contact", id: "contact" },
                            { name: "Cart", id: "/cart" }
                        ]}
                        bottomLeftText="Premium E-Commerce"
                        bottomRightText="hello@shophub.com"
                    />
                </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 latest insights and updates from the world of e-commerce"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "All Products", href: "/products" },
                                    { label: "New Arrivals", href: "/new" },
                                    { label: "Sale Items", href: "/sale" },
                                    { label: "Clearance", href: "/clearance" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Contact Us", href: "/contact" },
                                    { label: "Shipping Info", href: "/shipping" },
                                    { label: "Returns", href: "/returns" },
                                    { label: "Size Guide", href: "/size-guide" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "/about" },
                                    { label: "Blog", href: "/blog" },
                                    { label: "Careers", href: "/careers" },
                                    { label: "Press", href: "/press" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "/privacy" },
                                    { label: "Terms of Service", href: "/terms" },
                                    { label: "Cookie Policy", href: "/cookies" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 ShopHub. All rights reserved."
                        bottomRightText="Crafted with care for modern shoppers"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}