"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterSimple from '@/components/sections/footer/FooterSimple';
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="expand-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="smallMedium"
            sizing="largeSmallSizeLargeTitles"
            background="aurora"
            cardStyle="soft-shadow"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Imperio"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "About", id: "about" },
                            { name: "Process", id: "process" },
                            { name: "Gallery", id: "gallery" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{
                            text: "Book Your Detail",                            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 Detailing Insights"
                            description="Discover expert tips, industry secrets, and behind-the-scenes looks at professional car detailing"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Navigate",                                items: [
                                    { label: "Home", href: "#" },
                                    { label: "Services", href: "#services" },
                                    { label: "About", href: "#about" },
                                    { label: "Gallery", href: "#gallery" }
                                ]
                            },
                            {
                                title: "Services",                                items: [
                                    { label: "Paint Correction", href: "#services" },
                                    { label: "Ceramic Coating", href: "#services" },
                                    { label: "Interior Detail", href: "#services" },
                                    { label: "Full Detail Package", href: "#services" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Instagram", href: "https://instagram.com/imperio-detailing" },
                                    { label: "Contact", href: "#contact" },
                                    { label: "Book Now", href: "#contact" },
                                    { label: "FAQ", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Imperio Car Detailing. All rights reserved."
                        bottomRightText="Command the Road."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}