"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterBaseCard from '@/components/sections/footer/FooterBaseCard';
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="reveal-blur"
            borderRadius="pill"
            contentWidth="smallMedium"
            sizing="large"
            background="noise"
            cardStyle="gradient-radial"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="D2B Marketing"
                        navItems={[
                            {"name":"Home","id":"/"},
                            {"name":"Services","id":"features"},
                            {"name":"Results","id":"about"},
                            {"name":"Pricing","id":"pricing"},
                            {"name":"Contact","id":"contact"}
                        ]}
                        button={{"text":"Get Free Strategy","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="Digital Marketing Insights"
                            description="Expert strategies, proven results, and actionable marketing insights to grow your business"
                            tag="Marketing Blog"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="D2B Marketing"
                        columns={[
                            {
                                "title":"Services",                                "items":[
                                    {"label":"SEO Optimization","href":"#features"},
                                    {"label":"Social Media Marketing","href":"#features"},
                                    {"label":"PPC Advertising","href":"#features"},
                                    {"label":"Content Marketing","href":"#features"}
                                ]
                            },
                            {
                                "title":"Company",                                "items":[
                                    {"label":"About Us","href":"#about"},
                                    {"label":"Our Results","href":"#about"},
                                    {"label":"Pricing","href":"#pricing"},
                                    {"label":"Contact","href":"#contact"}
                                ]
                            },
                            {
                                "title":"Resources",                                "items":[
                                    {"label":"Blog","href":"#"},
                                    {"label":"Case Studies","href":"#"},
                                    {"label":"Free Tools","href":"#"},
                                    {"label":"FAQ","href":"#faq"}
                                ]
                            },
                            {
                                "title":"Legal",                                "items":[
                                    {"label":"Privacy Policy","href":"#"},
                                    {"label":"Terms of Service","href":"#"},
                                    {"label":"Cookie Policy","href":"#"}
                                ]
                            }
                        ]}
                        copyrightText="© 2025 D2B Marketing. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}