"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="expand-hover"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="small"
            sizing="medium"
            background="aurora"
            cardStyle="solid"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="solid"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="Dashboard"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Overview", id: "overview" },
                            { name: "Analytics", id: "analytics" },
                            { name: "Reports", id: "reports" },
                            { name: "Settings", id: "settings" }
                        ]}
                    />
                </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">
                        <BlogCardOne
                            blogs={posts}
                            title="Latest Articles"
                            description="Discover insights, tips, and updates from our team"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Product",                                items: [
                                    { label: "Overview", href: "#overview" },
                                    { label: "Analytics", href: "#analytics" },
                                    { label: "Reports", href: "#reports" },
                                    { label: "Pricing", href: "#pricing" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Documentation", href: "https://docs.example.com" },
                                    { label: "API Reference", href: "https://api.example.com" },
                                    { label: "Support", href: "https://support.example.com" },
                                    { label: "Community", href: "https://community.example.com" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About", href: "#about" },
                                    { label: "Blog", href: "https://blog.example.com" },
                                    { label: "Careers", href: "https://careers.example.com" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Dashboard Analytics. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}