"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterLogoReveal from '@/components/sections/footer/FooterLogoReveal';
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="reveal-blur"
            borderRadius="rounded"
            contentWidth="smallMedium"
            sizing="medium"
            background="circleGradient"
            cardStyle="outline"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="solid"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="FlowPilates"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Workouts", id: "product" },
                            { name: "Pricing", id: "pricing" },
                            { name: "Testimonials", id: "testimonial" },
                            { name: "FAQ", id: "faq" }
                        ]}
                    />
                </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="FlowPilates Blog"
                            description="Discover expert insights, workout tips, and wellness guidance to enhance your Pilates journey"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoReveal
                        logoText="FlowPilates"
                        leftLink={{ text: "Privacy Policy", href: "https://flowpilates.example.com/privacy" }}
                        rightLink={{ text: "Terms of Service", href: "https://flowpilates.example.com/terms" }}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}