"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterSimple from '@/components/sections/footer/FooterSimple';
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="directional-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="mediumSmall"
            sizing="mediumLarge"
            background="floatingGradient"
            cardStyle="outline"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "Why MJ", id: "why-mj" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Book Now", id: "booking" },
                            { name: "Contact", id: "contact" }
                        ]}
                        brandName="MJ Cleaning"
                        bottomLeftText="Family-Owned & Insured"
                        bottomRightText="Same-Day Available"
                    />
                </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="Cleaning Insights & Tips"
                            description="Expert advice and updates from your trusted cleaning professionals"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Services",                                items: [
                                    { label: "Residential Deep Clean", href: "#services" },
                                    { label: "Move-Out/In Clean", href: "#services" },
                                    { label: "Post-Construction", href: "#services" },
                                    { label: "Commercial Cleaning", href: "#services" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About MJ", href: "#why-mj" },
                                    { label: "Testimonials", href: "#testimonials" },
                                    { label: "Book Now", href: "#booking" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Phone: (555) 123-4567", href: "tel:+15551234567" },
                                    { label: "Email: hello@mjcleaning.com", href: "mailto:hello@mjcleaning.com" },
                                    { label: "FAQ", href: "#faq" }
                                ]
                            },
                            {
                                title: "Trust",                                items: [
                                    { label: "Family-Owned" },
                                    { label: "Fully Insured" },
                                    { label: "Background-Checked" },
                                    { label: "5-Star Rated" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2024 MJ Commercial & Residential Cleaning LLC. All rights reserved."
                        bottomRightText="Crafted with care by Jacy"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}