"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterSimple from '@/components/sections/footer/FooterSimple';
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="slide-background"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="mediumSmall"
            sizing="largeSmall"
            background="floatingGradient"
            cardStyle="gradient-radial"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="glass"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="SaaS Pro"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Features", id: "features" },
                            { name: "Pricing", id: "pricing" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "contact" },
                            { name: "Blog", id: "blog" }
                        ]}
                        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">
                        <BlogCardThree
                            blogs={posts}
                            title="Featured Articles"
                            description="Explore our latest insights and discover innovative solutions for modern businesses"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Product",                                items: [
                                    { label: "Features", href: "#features" },
                                    { label: "Pricing", href: "#pricing" },
                                    { label: "Security", href: "#" },
                                    { label: "Roadmap", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About", href: "#" },
                                    { label: "Blog", href: "#" },
                                    { label: "Careers", href: "#" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Documentation", href: "#" },
                                    { label: "API Reference", href: "#" },
                                    { label: "Community", href: "#" },
                                    { label: "Status", href: "#" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy", href: "#" },
                                    { label: "Terms", href: "#" },
                                    { label: "Compliance", href: "#" },
                                    { label: "Cookies", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 SaaS Pro. All rights reserved."
                        bottomRightText="Built for modern teams"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}