"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterSimple from '@/components/sections/footer/FooterSimple';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline';
import { useBlogPosts } from "@/hooks/useBlogPosts";

export default function BlogPage() {
    const { posts, isLoading } = useBlogPosts();

    return (
        <ThemeProvider
            defaultButtonVariant="shift-hover"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="mediumSmall"
            sizing="largeSizeMediumTitles"
            background="floatingGradient"
            cardStyle="subtle-shadow"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="FitFlow"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Plans", id: "plans" },
                            { name: "Features", id: "features" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Community", id: "metrics" }
                        ]}
                        button={{ text: "Download App", href: "#download" }}
                    />
                </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 on fitness, nutrition, and wellness"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Product",                                items: [
                                    { label: "Features", href: "#features" },
                                    { label: "Pricing", href: "#plans" },
                                    { label: "Download", href: "#download" },
                                    { label: "Security", href: "#" }
                                ]
                            },
                            {
                                title: "Community",                                items: [
                                    { label: "Stories", href: "#testimonials" },
                                    { label: "Blog", href: "#" },
                                    { label: "Events", href: "#" },
                                    { label: "Support", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About", href: "#" },
                                    { label: "Careers", href: "#" },
                                    { label: "Contact", href: "#" },
                                    { label: "Partners", href: "#" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy", href: "#" },
                                    { label: "Terms", href: "#" },
                                    { label: "Cookies", href: "#" },
                                    { label: "Accessibility", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 FitFlow. All rights reserved."
                        bottomRightText="Transform Your Fitness"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}