"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterLogoEmphasis from '@/components/sections/footer/FooterLogoEmphasis';
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="shift-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="compact"
            sizing="largeSmallSizeLargeTitles"
            background="none"
            cardStyle="elevated"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="StartupHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Team", id: "team" },
                            { name: "Investors", id: "social-proof" },
                            { name: "Features", id: "features" },
                            { name: "Contact", id: "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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Latest Insights"
                            description="Discover the latest updates, insights, and innovations from our team"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        logoText="StartupHub"
                        columns={[
                            {
                                items: [
                                    { label: "Product", href: "#" },
                                    { label: "Features", href: "#" },
                                    { label: "Pricing", href: "#" },
                                    { label: "Security", href: "#" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Company", href: "#" },
                                    { label: "About", href: "about" },
                                    { label: "Team", href: "team" },
                                    { label: "Blog", href: "#" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Resources", href: "#" },
                                    { label: "Documentation", href: "#" },
                                    { label: "API Reference", href: "#" },
                                    { label: "Guides", href: "#" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Legal", href: "#" },
                                    { label: "Privacy", href: "#" },
                                    { label: "Terms", href: "#" },
                                    { label: "Contact", href: "contact" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}