"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
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="FitLife Coach"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "features" },
                            { name: "About", id: "team" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "FAQ", id: "faq" }
                        ]}
                        button={{ text: "Book a Session", 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="Health & Fitness Insights"
                            description="Expert tips and guidance to help you achieve your fitness goals"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        logoText="FitLife Coach"
                        columns={[
                            {
                                items: [
                                    { label: "Services", href: "features" },
                                    { label: "About", href: "team" },
                                    { label: "Testimonials", href: "testimonials" }
                                ]
                            },
                            {
                                items: [
                                    { label: "FAQ", href: "faq" },
                                    { label: "Contact", href: "contact" },
                                    { label: "Privacy Policy", href: "#" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Facebook", href: "https://facebook.com" },
                                    { label: "LinkedIn", href: "https://linkedin.com" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}