"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterBase from '@/components/sections/footer/FooterBase';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="expand-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="mediumSmall"
            sizing="mediumSizeLargeTitles"
            background="circleGradient"
            cardStyle="soft-shadow"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="solid"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="FitFlow"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Workouts", id: "workouts" },
                            { name: "Features", id: "features" },
                            { name: "Reviews", id: "testimonials" },
                            { name: "FAQ", id: "faq" },
                            { name: "Download", id: "download" }
                        ]}
                        button={{ text: "Get Started", 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">
                        <BlogCardTwo
                            blogs={posts}
                            title="FitFlow Blog"
                            description="Discover fitness tips, workout guides, and wellness insights to help you achieve your health goals"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="FitFlow"
                        copyrightText="© 2025 FitFlow. All rights reserved."
                        columns={[
                            {
                                title: "Product",                                items: [
                                    { label: "Features", href: "features" },
                                    { label: "Workouts", href: "workouts" },
                                    { label: "Pricing", href: "download" },
                                    { label: "Download", href: "download" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "https://fitflow.com/about" },
                                    { label: "Blog", href: "https://fitflow.com/blog" },
                                    { label: "Careers", href: "https://fitflow.com/careers" },
                                    { label: "Contact", href: "contact" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "https://fitflow.com/privacy" },
                                    { label: "Terms of Service", href: "https://fitflow.com/terms" },
                                    { label: "Cookie Policy", href: "https://fitflow.com/cookies" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}