"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterMedia from '@/components/sections/footer/FooterMedia';
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="elastic-effect"
            defaultTextAnimation="entrance-slide"
            borderRadius="rounded"
            contentWidth="smallMedium"
            sizing="largeSizeMediumTitles"
            background="aurora"
            cardStyle="subtle-shadow"
            primaryButtonStyle="double-inset"
            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: "Testimonials", id: "testimonials" },
                            { 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 discover cutting-edge strategies for modern software development"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/financial-charts-kpi-metrics-displays-office_482257-126638.jpg"
                        imageAlt="Modern office workspace"
                        logoText="SaaS Pro"
                        copyrightText="© 2025 SaaS Pro. All rights reserved."
                        columns={[
                            {
                                title: "Product",                                items: [
                                    { label: "Features", href: "#features" },
                                    { label: "Pricing", href: "#pricing" },
                                    { label: "Security", href: "#" },
                                    { label: "Roadmap", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Blog", href: "#" },
                                    { label: "Careers", href: "#" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Documentation", href: "#" },
                                    { label: "API Reference", href: "#" },
                                    { label: "Community", href: "#" },
                                    { label: "Support", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}