"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 NavbarLayoutFloatingOverlay from "@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay";
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="slide-background"
            defaultTextAnimation="background-highlight"
            borderRadius="sharp"
            contentWidth="medium"
            sizing="largeSmallSizeMediumTitles"
            background="aurora"
            cardStyle="gradient-bordered"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="SaaS Pro"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Features", id: "features" },
                            { name: "Pricing", id: "pricing" },
                            { name: "About", id: "about" },
                            { name: "FAQ", id: "faq" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Get Started", href: "#pricing" }}
                    />
                </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 expert perspectives on technology, innovation, and industry trends"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                            buttons={[
                                { text: "View All Posts", href: "#" },
                                { text: "Subscribe", href: "#" }
                            ]}
                        />
                    </div>
                )}

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