"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal';
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-magnetic"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="mediumSmall"
            sizing="mediumSizeLargeTitles"
            background="fluid"
            cardStyle="solid"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Sky Tree Services"
                        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:+16155689651"
                        }}
                    />
                </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="Tree Care Insights"
                            description="Expert tips and insights from our professional arborists"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                            tagAnimation="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Services",                                items: [
                                    { label: "Tree Removal", href: "#services" },
                                    { label: "Emergency Services", href: "#services" },
                                    { label: "Tree Trimming", href: "#services" },
                                    { label: "Storm Cleanup", href: "#services" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "/about" },
                                    { label: "Reviews", href: "/reviews" },
                                    { label: "Contact", href: "/contact" },
                                    { label: "Service Areas", href: "#" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "📞 (615) 568-9651", href: "tel:+16155689651" },
                                    { label: "Open 24 Hours", href: "#" },
                                    { label: "3037 Runabout Dr, Nashville, TN 37217", href: "#" },
                                    { label: "Emergency Service Available", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Sky Tree Services LLC. All rights reserved. Licensed & Insured."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}