"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="small"
            sizing="largeSizeMediumTitles"
            background="none"
            cardStyle="glass-depth"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="FitFlow"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Workouts", id: "workouts" },
                            { name: "Features", id: "features" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Download", id: "download" },
                            { name: "Contact", id: "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">
                        <BlogCardThree
                            blogs={posts}
                            title="Fitness Insights & Training Tips"
                            description="Discover expert advice, workout techniques, and wellness strategies to elevate your fitness journey"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="FitFlow Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/attractive-powerful-bodybuilder-is-doing-exercises-training-apparatus-sunny-gym_613910-20342.jpg"
                        imageAlt="Sunset fitness training"
                        logoText="FitFlow"
                        copyrightText="© 2025 FitFlow. All rights reserved."
                        columns={[
                            {
                                title: "Product",                                items: [
                                    { label: "Workout Plans", href: "#workouts" },
                                    { label: "Features", href: "#features" },
                                    { label: "Pricing", href: "#" },
                                    { label: "Download App", href: "#download" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#" },
                                    { label: "Blog", href: "#" },
                                    { label: "Careers", href: "#" },
                                    { label: "Contact", href: "#" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms of Service", href: "#" },
                                    { label: "Cookie Policy", href: "#" },
                                    { label: "Accessibility", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}