"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from "@/components/sections/blog/BlogCardThree";
import FooterBaseReveal from "@/components/sections/footer/FooterBaseReveal";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingInline from "@/components/navbar/NavbarLayoutFloatingInline";
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-shift"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="medium"
            sizing="mediumSizeLargeTitles"
            background="circleGradient"
            cardStyle="gradient-bordered"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="SaaSPro"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Features", id: "features" },
                            { name: "Pricing", id: "pricing" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{
                            text: "Get Started",                            href: "https://app.saaspro.com/signup"
                        }}
                    />
                </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="Latest Insights"
                            description="Explore our latest thoughts on technology, design, and business innovation"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Product",                                items: [
                                    { label: "Features", href: "features" },
                                    { label: "Pricing", href: "pricing" },
                                    { label: "Security", href: "https://saaspro.com/security" },
                                    { label: "Roadmap", href: "https://saaspro.com/roadmap" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About", href: "https://saaspro.com/about" },
                                    { label: "Blog", href: "https://saaspro.com/blog" },
                                    { label: "Careers", href: "https://saaspro.com/careers" },
                                    { label: "Contact", href: "contact" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "https://saaspro.com/privacy" },
                                    { label: "Terms of Service", href: "https://saaspro.com/terms" },
                                    { label: "Cookie Policy", href: "https://saaspro.com/cookies" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 SaaSPro. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}