"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterLogoEmphasis from '@/components/sections/footer/FooterLogoEmphasis';
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="entrance-slide"
            borderRadius="rounded"
            contentWidth="medium"
            sizing="medium"
            background="none"
            cardStyle="glass-elevated"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="solid"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Growth Coach"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "features" },
                            { name: "About", id: "team" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "FAQ", id: "faq" }
                        ]}
                        button={{ text: "Book Free Consultation", 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">
                        <BlogCardThree
                            blogs={posts}
                            title="Growth Insights"
                            description="Discover strategies, tips, and insights to accelerate your business growth and unlock your potential"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        logoText="Growth Coach"
                        columns={[
                            {
                                items: [
                                    { label: "Services", href: "features" },
                                    { label: "About", href: "team" },
                                    { label: "Testimonials", href: "testimonials" }
                                ]
                            },
                            {
                                items: [
                                    { label: "FAQ", href: "faq" },
                                    { label: "Book a Call", href: "#contact" },
                                    { label: "Contact", href: "mailto:hello@growthcoach.com" }
                                ]
                            },
                            {
                                items: [
                                    { label: "LinkedIn", href: "https://linkedin.com" },
                                    { label: "Twitter", href: "https://twitter.com" },
                                    { label: "Email", href: "mailto:hello@growthcoach.com" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}