"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBase from '@/components/sections/footer/FooterBase';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import type { FooterColumn } from "@/components/shared/FooterColumns";
import NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline';
import { useBlogPosts } from "@/hooks/useBlogPosts";

const footerColumns: FooterColumn[] = [
    {
        title: "Product",        items: [
            { label: "Features", href: "about" },
            { label: "Pricing", href: "pricing" },
            { label: "Security", href: "#" },
            { label: "Roadmap", href: "#" },
        ],
    },
    {
        title: "Resources",        items: [
            { label: "Blog", href: "#" },
            { label: "Founder Toolkit", href: "#" },
            { label: "Investor Guide", href: "#" },
            { label: "Community", href: "#" },
        ],
    },
    {
        title: "Company",        items: [
            { label: "About Us", href: "about" },
            { label: "Careers", href: "#" },
            { label: "Contact", href: "contact" },
            { label: "Partners", href: "#" },
        ],
    },
];

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

    return (
        <ThemeProvider
            defaultButtonVariant="expand-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="small"
            sizing="largeSmallSizeLargeTitles"
            background="circleGradient"
            cardStyle="glass-depth"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="StartupHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Team", id: "team" },
                            { name: "Investors", id: "socialProof" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Get Started", href: "contact" }}
                        className="z-50"
                        navItemClassName="text-sm font-medium"
                        buttonClassName="px-6 py-2"
                    />
                </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">
                        <BlogCardThree
                            blogs={posts}
                            title="Featured Articles"
                            description="Explore our latest insights and updates from our team"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="StartupHub"
                        copyrightText="© 2025 StartupHub. All rights reserved."
                        columns={footerColumns}
                        className="bg-opacity-50"
                        logoTextClassName="text-2xl font-light"
                        columnTitleClassName="font-medium text-base mb-4"
                        columnItemClassName="text-sm text-opacity-70 hover:text-opacity-100"
                        copyrightTextClassName="text-xs text-opacity-50"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}