"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="mediumSmall"
            sizing="mediumLargeSizeMediumTitles"
            background="circleGradient"
            cardStyle="solid"
            primaryButtonStyle="flat"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Mobile One"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "Why Us", id: "about" },
                            { name: "Pricing", id: "pricing" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "FAQ", id: "faq" }
                        ]}
                        button={{ text: "Book Now", 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">
                        <BlogCardOne
                            blogs={posts}
                            title="Latest Auto Detailing Insights"
                            description="Expert tips and insights from Mobile One Detailing to keep your vehicle looking pristine"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        logoText="Mobile One Detailing"
                        columns={[
                            {
                                items: [
                                    { label: "Services", href: "services" },
                                    { label: "Pricing", href: "pricing" },
                                    { label: "About", href: "about" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Testimonials", href: "testimonials" },
                                    { label: "FAQ", href: "faq" },
                                    { label: "Contact", href: "contact" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Service Area", href: "#" },
                                    { label: "Book Now", href: "#contact" },
                                    { label: "Mobile App", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}