"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
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="hover-magnetic"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="mediumSmall"
            sizing="largeSmallSizeLargeTitles"
            background="none"
            cardStyle="glass-elevated"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarLayoutFloatingOverlay
                        brandName="Rory Gibbs"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Achievements", id: "features" },
                            { name: "Stats", id: "metrics" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Get in Touch", href: "contact" }}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardTwo
                            blogs={posts}
                            title="Training Insights & Updates"
                            description="Discover the latest insights from my training journey, competition experiences, and athletic development strategies"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    )}

                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Navigation",                                items: [
                                    { label: "Home", href: "hero" },
                                    { label: "About", href: "about" },
                                    { label: "Achievements", href: "features" },
                                    { label: "Stats", href: "metrics" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Contact", href: "contact" },
                                    { label: "Email", href: "mailto:contact@rorygibbs.com" },
                                    { label: "Social Media", href: "https://instagram.com" },
                                    { label: "Newsletter", href: "contact" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Training Tips", href: "features" },
                                    { label: "Success Stories", href: "testimonials" },
                                    { label: "Events", href: "contact" },
                                    { label: "Press", href: "contact" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Rory Gibbs | Olympic Champion. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}