"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from "@/components/sections/blog/BlogCardThree";
import FooterBaseReveal from "@/components/sections/footer/FooterBaseReveal";
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="directional-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="mediumLarge"
            sizing="large"
            background="floatingGradient"
            cardStyle="layered-gradient"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="solid"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Portfolio"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Projects", id: "projects" },
                            { name: "Skills", id: "skills" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Get In Touch", href: "contact" }}
                        buttonClassName="px-4 py-2 rounded-lg"
                    />
                </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="Explore our latest insights and thought leadership"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Navigation",                                items: [
                                    { label: "Home", href: "#" },
                                    { label: "About", href: "about" },
                                    { label: "Projects", href: "projects" },
                                    { label: "Contact", href: "contact" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "LinkedIn", href: "#" },
                                    { label: "GitHub", href: "#" },
                                    { label: "Twitter", href: "#" },
                                    { label: "Dribbble", href: "#" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms of Service", href: "#" },
                                    { label: "Sitemap", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Portfolio. All rights reserved."
                        onPrivacyClick={function() { console.log('Privacy clicked'); }}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}