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

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

    return (
        <ThemeProvider
            defaultButtonVariant="icon-arrow"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="compact"
            sizing="mediumLargeSizeLargeTitles"
            background="floatingGradient"
            cardStyle="subtle-shadow"
            primaryButtonStyle="flat"
            secondaryButtonStyle="solid"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarLayoutFloatingInline
                        brandName="SaasFlow"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Features", id: "features" },
                            { name: "Pricing", id: "pricing" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{
                            text: "Get Started",                            href: "https://app.saasflow.com/signup"
                        }}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardThree
                            blogs={posts}
                            title="Featured Articles"
                            description="Explore our latest insights and industry expertise"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    )}

                    <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: "Guides", href: "#" },
                                    { label: "Community", href: "#" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms of Service", href: "#" },
                                    { label: "Cookie Policy", href: "#" },
                                    { label: "Compliance", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 SaasFlow. All rights reserved."
                        bottomRightText="Made with passion for productivity"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}