"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterBaseCard from '@/components/sections/footer/FooterBaseCard';
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="elastic-effect"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="compact"
            sizing="largeSizeMediumTitles"
            background="none"
            cardStyle="outline"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="glass"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="ProShop"
                        navItems={[
                            {"name":"Home","id":"/"},
                            {"name":"Shop","id":"products"},
                            {"name":"About","id":"about"},
                            {"name":"Reviews","id":"reviews"},
                            {"name":"FAQ","id":"faq"},
                            {"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="ProShop Blog"
                            description="Discover the latest trends, shoe care tips, and style guides from our team"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Latest"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="ProShop"
                        columns={[
                            {
                                "title":"Shop",                                "items":[
                                    {"label":"Men's Shoes","href":"/shop/mens"},
                                    {"label":"Women's Shoes","href":"/shop/womens"},
                                    {"label":"New Arrivals","href":"/shop/new"},
                                    {"label":"Sale","href":"/shop/sale"}
                                ]
                            },
                            {
                                "title":"Support",                                "items":[
                                    {"label":"Track Order","href":"/track"},
                                    {"label":"Returns","href":"/returns"},
                                    {"label":"Size Guide","href":"/size-guide"},
                                    {"label":"Contact Us","href":"/contact"}
                                ]
                            },
                            {
                                "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"}
                                ]
                            }
                        ]}
                        copyrightText="© 2025 ProShop. All rights reserved."
                        onPrivacyClick={() => console.log("Privacy clicked")}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}