"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="elastic-effect"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="smallMedium"
            sizing="mediumSizeLargeTitles"
            background="circleGradient"
            cardStyle="subtle-shadow"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="StartupHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Features", id: "features" },
                            { name: "Team", id: "team" },
                            { name: "Investors", id: "investors" },
                            { name: "Metrics", id: "metrics" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Get Started", href: "contact" }}
                    />
                </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 Articles"
                                description="Discover insights, updates, and stories from the StartupHub community"
                                textboxLayout="default"
                                useInvertedBackground="noInvert"
                                animationType="slide-up"
                                carouselMode="buttons"
                            />
                        </div>
                    )}

                    <div id="footer" data-section="footer">
                        <FooterBase
                            logoText="StartupHub"
                            copyrightText="© 2025 StartupHub. All rights reserved."
                            columns={[
                                {
                                    title: "Product",                                    items: [
                                        { label: "Features", href: "features" },
                                        { label: "Pricing", href: "https://example.com/pricing" },
                                        { label: "Security", href: "https://example.com/security" }
                                    ]
                                },
                                {
                                    title: "Company",                                    items: [
                                        { label: "About", href: "https://example.com/about" },
                                        { label: "Blog", href: "https://example.com/blog" },
                                        { label: "Careers", href: "https://example.com/careers" }
                                    ]
                                },
                                {
                                    title: "Resources",                                    items: [
                                        { label: "Documentation", href: "https://example.com/docs" },
                                        { label: "Community", href: "https://example.com/community" },
                                        { label: "Contact", href: "contact" }
                                    ]
                                }
                            ]}
                        />
                    </div>
            </ReactLenis>
        </ThemeProvider>
    );
}