"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="slide-background"
            defaultTextAnimation="entrance-slide"
            borderRadius="soft"
            contentWidth="small"
            sizing="largeSizeMediumTitles"
            background="floatingGradient"
            cardStyle="glass-elevated"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Experience", id: "experience" },
                            { name: "Impact", id: "impact" },
                            { name: "Vision", id: "vision" },
                            { name: "Contact", id: "contact" }
                        ]}
                        brandName="Lorenzo Noya"
                        bottomLeftText="Digital Innovator"
                        bottomRightText="hello@webild.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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Digital Innovation & Strategy"
                            description="Insights and perspectives from a Chief Product Officer on digital transformation, strategic planning, and executive leadership"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Leadership"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="Lorenzo Noya"
                        copyrightText="© 2025 | Lorenzo Noya. Chief Product Officer at Webild."
                        columns={[
                            {
                                title: "About",                                items: [
                                    { label: "Executive Profile", href: "about" },
                                    { label: "Experience", href: "experience" },
                                    { label: "Impact", href: "impact" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Email", href: "mailto:hello@webild.io" },
                                    { label: "LinkedIn", href: "https://linkedin.com" },
                                    { label: "Vision", href: "vision" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Webild", href: "https://webild.io" },
                                    { label: "DialedWeb Legacy", href: "#" },
                                    { label: "Contact", href: "contact" }
                                ]
                            }
                        ]}
                        onPrivacyClick={null}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}