"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterLogoEmphasis from '@/components/sections/footer/FooterLogoEmphasis';
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="icon-arrow"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="small"
            sizing="mediumLargeSizeMediumTitles"
            background="circleGradient"
            cardStyle="solid"
            primaryButtonStyle="flat"
            secondaryButtonStyle="layered"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "About", id: "about" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        brandName="FitForce"
                        bottomLeftText="Transform Your Body"
                        bottomRightText="contact@fitforce.com"
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardThree
                            blogs={posts}
                            title="Featured Articles"
                            description="Explore our latest insights and expert tips on fitness, nutrition, and wellness"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    )}

                    <FooterLogoEmphasis
                        logoText="FitForce"
                        columns={[
                            {
                                items: [
                                    { label: "Home", href: "home" },
                                    { label: "Services", href: "services" },
                                    { label: "Testimonials", href: "testimonials" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Pricing", href: "pricing" },
                                    { label: "About", href: "about" },
                                    { label: "Contact", href: "contact" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Phone", href: "#" },
                                    { label: "Email", href: "#" },
                                    { label: "Address", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}