"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="directional-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="sharp"
            contentWidth="smallMedium"
            sizing="mediumLarge"
            background="none"
            cardStyle="glass-elevated"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="BlogHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Articles", id: "articles" },
                            { name: "Categories", id: "categories" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "contact" }
                        ]}
                        bottomLeftText="Digital Stories"
                        bottomRightText="hello@bloghub.com"
                    />
                </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 the freshest insights and perspectives from our team of expert writers"
                            tag="Featured"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            buttons={[
                                { text: "View All Articles", href: "#all-articles" },
                                { text: "Subscribe", href: "#subscribe" }
                            ]}
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Navigate",                                items: [
                                    { label: "Home", href: "#home" },
                                    { label: "Articles", href: "#articles" },
                                    { label: "Categories", href: "#categories" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            },
                            {
                                title: "Categories",                                items: [
                                    { label: "Digital Marketing", href: "#marketing" },
                                    { label: "Web Design", href: "#design" },
                                    { label: "Content Strategy", href: "#content" },
                                    { label: "SEO & Analytics", href: "#seo" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Newsletter", href: "#newsletter" },
                                    { label: "About Us", href: "#about" },
                                    { label: "Privacy Policy", href: "#privacy" },
                                    { label: "Terms of Service", href: "#terms" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 BlogHub. All rights reserved."
                        bottomRightText="Crafted with passion for content creators"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}