"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-magnetic"
            defaultTextAnimation="background-highlight"
            borderRadius="sharp"
            contentWidth="medium"
            sizing="mediumLargeSizeMediumTitles"
            background="aurora"
            cardStyle="glass-depth"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "About", id: "about" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        brandName="DetailPro Mobile"
                        bottomLeftText="Available 24/7"
                        bottomRightText="hello@detailpro.com"
                    />
                </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 Car Care Tips"
                            description="Expert advice and insights for maintaining your vehicle"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Services",                                items: [
                                    { label: "Exterior Detailing", href: "services" },
                                    { label: "Interior Cleaning", href: "services" },
                                    { label: "Ceramic Coating", href: "services" },
                                    { label: "Fleet Services", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Contact", href: "contact" },
                                    { label: "FAQ", href: "faq" },
                                    { label: "Blog", href: "#" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "hello@detailpro.com", href: "#" },
                                    { label: "(555) 123-4567", href: "#" },
                                    { label: "Available 24/7", href: "#" },
                                    { label: "Service Area Map", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 DetailPro Mobile | Professional Car Detailing"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}