"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="slide-background"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="mediumSmall"
            sizing="mediumLargeSizeLargeTitles"
            background="aurora"
            cardStyle="glass-elevated"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="FitFlow"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Plans", id: "pricing" },
                            { name: "Reviews", id: "testimonial" },
                            { name: "FAQ", id: "faq" },
                            { name: "Download", id: "contact" }
                        ]}
                        bottomLeftText="Transform Your Fitness"
                        bottomRightText="hello@fitflow.app"
                    />
                </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"
                            description="Expert tips and guidance for your fitness journey"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="FitFlow"
                        columns={[
                            {
                                title: "Product",                                items: [
                                    { label: "Features", href: "#features" },
                                    { label: "Pricing", href: "#pricing" },
                                    { label: "Download", href: "#contact" },
                                    { label: "Security", href: "#" }
                                ]
                            },
                            {
                                title: "Community",                                items: [
                                    { label: "Success Stories", href: "#testimonial" },
                                    { label: "Fitness Blog", href: "#" },
                                    { label: "User Forum", href: "#" },
                                    { label: "Events", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#" },
                                    { label: "Careers", href: "#" },
                                    { label: "Contact", href: "#contact" },
                                    { label: "Press", href: "#" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Help Center", href: "#faq" },
                                    { label: "Guides", href: "#" },
                                    { label: "API Docs", href: "#" },
                                    { label: "Status", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 FitFlow. All rights reserved."
                        onPrivacyClick={null}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}