"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
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="directional-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="smallMedium"
            sizing="largeSmallSizeMediumTitles"
            background="circleGradient"
            cardStyle="glass-depth"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="TN Lawn Care Pros"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "Why Us", id: "why-us" },
                            { name: "Reviews", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Call Now", href: "tel:(615)992-0482" }}
                    />
                </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="Latest Lawn Care Tips"
                            description="Expert advice and insights from TN Lawn Care Pros to keep your lawn healthy and beautiful year-round."
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#why-us" },
                                    { label: "Services", href: "#services" },
                                    { label: "Reviews", href: "#testimonials" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Call Now", href: "tel:(615)992-0482" },
                                    { label: "Get Quote", href: "#contact" },
                                    { label: "Hours: Open - Closes 8:30 PM", href: "#" }
                                ]
                            },
                            {
                                title: "Service Area",                                items: [
                                    { label: "Nashville", href: "#" },
                                    { label: "Memphis", href: "#" },
                                    { label: "Knoxville", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 TN Lawn Care Pros. All rights reserved."
                        bottomRightText="Serving Tennessee with pride"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}