"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
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="hover-bubble"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="medium"
            sizing="medium"
            background="none"
            cardStyle="gradient-bordered"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Webild"
                        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":"#contact"}}
                    />
                </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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Latest Articles"
                            description="Stay updated with our latest insights and expert perspectives"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                "title":"Product",                                "items":[
                                    {"label":"Features","href":"#features"},
                                    {"label":"Pricing","href":"#pricing"},
                                    {"label":"Security","href":"#features"},
                                    {"label":"Roadmap","href":"#features"}
                                ]
                            },
                            {
                                "title":"Company",                                "items":[
                                    {"label":"About Us","href":"#about"},
                                    {"label":"Blog","href":"#features"},
                                    {"label":"Careers","href":"#features"},
                                    {"label":"Contact","href":"#contact"}
                                ]
                            },
                            {
                                "title":"Resources",                                "items":[
                                    {"label":"Documentation","href":"#features"},
                                    {"label":"API Reference","href":"#features"},
                                    {"label":"Community","href":"#features"},
                                    {"label":"Support","href":"#contact"}
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Webild. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}