"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from '@/components/sections/blog/BlogCardOne';
import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal';
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="hover-bubble"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="small"
            sizing="medium"
            background="none"
            cardStyle="gradient-mesh"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Features", id: "features" },
                            { name: "Team", id: "team" },
                            { name: "Investors", id: "investors" },
                            { name: "Contact", id: "contact" }
                        ]}
                        brandName="StartupHub"
                        bottomLeftText="Empowering Innovation"
                        bottomRightText="hello@startuphub.io"
                    />
                </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">
                        <BlogCardOne
                            blogs={posts}
                            title="Latest Insights & Updates"
                            description="Discover the latest trends, insights, and updates from the StartupHub community"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Product",                                items: [
                                    { label: "Features", href: "features" },
                                    { label: "Security", href: "security" },
                                    { label: "Pricing", href: "pricing" },
                                    { label: "Updates", href: "updates" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Blog", href: "blog" },
                                    { label: "Careers", href: "careers" },
                                    { label: "Press", href: "press" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Documentation", href: "docs" },
                                    { label: "API Reference", href: "api" },
                                    { label: "Community", href: "community" },
                                    { label: "Support", href: "support" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 StartupHub. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}