"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="mediumLarge"
            sizing="mediumLarge"
            background="grid"
            cardStyle="gradient-mesh"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "/#about" },
                            { name: "Innovations", id: "/#features" },
                            { name: "Metrics", id: "/#metrics" },
                            { name: "Testimonials", id: "/#testimonials" },
                            { name: "FAQ", id: "/#faq" },
                            { name: "Contact", id: "/#contact" },
                        ]}
                        button={{ text: "Hire Vitality", href: "/#contact" }}
                        brandName="Vitality"
                    />
                </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="Latest Articles"
                                description="Insights and updates from our team"
                                animationType="slide-up"
                                textboxLayout="default"
                                useInvertedBackground={false}
                                carouselMode="buttons"
                            />
                        </div>
                    )}

                    <div id="footer" data-section="footer">
                        <FooterBaseReveal
                            columns={[
                                {
                                    title: "Vitality",                                    items: [
                                        { label: "About", href: "/#about" },
                                        { label: "Innovations", href: "/#features" },
                                    ],
                                },
                                {
                                    title: "Connect",                                    items: [
                                        { label: "Contact", href: "/#contact" },
                                        { label: "FAQ", href: "/#faq" },
                                    ],
                                },
                                {
                                    title: "Resources",                                    items: [
                                        { label: "Insights", href: "/blog" },
                                        { label: "Press", href: "#" },
                                    ],
                                },
                            ]}
                            copyrightText="© 2025 Vitality. All rights reserved."
                            className="bg-gray-800 text-white"
                        />
                    </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
