"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterBase from "@/components/sections/footer/FooterBase";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import type { FooterColumn } from "@/components/shared/FooterColumns";
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="reveal-blur"
            borderRadius="soft"
            contentWidth="smallMedium"
            sizing="mediumLarge"
            background="blurBottom"
            cardStyle="gradient-mesh"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="layered"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Elite Track"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Features", id: "features" },
                            { name: "Programs", id: "programs" },
                            { name: "FAQ", id: "faq" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Book a Tour", href: "#contact" }}
                    />
                </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="Elite Track News & Insights"
                                description="Stay updated with the latest news, training tips, and insights from Elite Track Indoor Facility"
                                tag="Blog"
                                textboxLayout="default"
                                useInvertedBackground={false}
                                carouselMode="buttons"
                                animationType="slide-up"
                                tagAnimation="blur-reveal"
                                buttonAnimation="blur-reveal"
                            />
                        </div>
                    )}

                    <div id="footer" data-section="footer">
                        <FooterBase
                            logoText="Elite Track"
                            copyrightText="© 2025 Elite Track Indoor Facility. All rights reserved."
                            columns={[
                                {
                                    title: "Programs",                                    items: [
                                        { label: "Youth Development", href: "#programs" },
                                        { label: "Competitive Teams", href: "#programs" },
                                        { label: "Elite Coaching", href: "#programs" },
                                        { label: "Community Fitness", href: "#programs" }
                                    ]
                                },
                                {
                                    title: "About",                                    items: [
                                        { label: "Our Facility", href: "#about" },
                                        { label: "Track Features", href: "#features" },
                                        { label: "Coaching Staff", href: "#features" },
                                        { label: "Book a Tour", href: "#contact" }
                                    ]
                                },
                                {
                                    title: "Support",                                    items: [
                                        { label: "FAQ", href: "#faq" },
                                        { label: "Contact Us", href: "#contact" },
                                        { label: "Privacy Policy", href: "https://example.com/privacy" },
                                        { label: "Terms of Service", href: "https://example.com/terms" }
                                    ]
                                }
                            ]}
                        />
                    </div>
            </ReactLenis>
        </ThemeProvider>
    );
}