"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
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="expand-hover"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="smallMedium"
            sizing="mediumLarge"
            background="circleGradient"
            cardStyle="soft-shadow"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="glass"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="ShopHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Shop", id: "products" },
                            { name: "Categories", id: "categories" },
                            { name: "About", id: "about" },
                            { name: "Reviews", id: "reviews" },
                            { name: "Contact", id: "contact" }
                        ]}
                        bottomLeftText="Premium Shopping"
                        bottomRightText="support@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">
                        <BlogCardOne
                            blogs={posts}
                            title="ShopHub Blog"
                            description="Discover the latest trends, shopping tips, and product insights from our team"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "All Products", href: "#products" },
                                    { label: "New Arrivals", href: "#new" },
                                    { label: "Best Sellers", href: "#bestsellers" },
                                    { label: "Sale", href: "#sale" }
                                ]
                            },
                            {
                                title: "Customer Care",                                items: [
                                    { label: "Contact Us", href: "#contact" },
                                    { label: "Shipping Info", href: "#shipping" },
                                    { label: "Returns", href: "#returns" },
                                    { label: "FAQ", href: "#faq" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Blog", href: "#blog" },
                                    { label: "Careers", href: "#careers" },
                                    { label: "Sustainability", href: "#sustainability" }
                                ]
                            },
                            {
                                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="Made with quality in mind"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}