"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from "@/components/sections/blog/BlogCardThree";
import FooterBaseCard from "@/components/sections/footer/FooterBaseCard";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingInline from "@/components/navbar/NavbarLayoutFloatingInline";
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-stagger"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="medium"
            sizing="mediumSizeLargeTitles"
            background="none"
            cardStyle="outline"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Catamount"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "Reviews", id: "testimonials" },
                            { name: "About", id: "team" },
                            { name: "FAQ", id: "faq" }
                        ]}
                        button={{ text: "Call Now", href: "tel:(802)-473-2606" }}
                    />
                </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 updates from our certified arborists and tree care professionals"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="Catamount Tree Service"
                        columns={[
                            {
                                title: "Quick Links",                                items: [
                                    { label: "Services", href: "#services" },
                                    { label: "Reviews", href: "#testimonials" },
                                    { label: "Team", href: "#team" },
                                    { label: "FAQ", href: "#faq" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Call: (802) 473-2606", href: "tel:(802)-473-2606" },
                                    { label: "Email: info@catamounttrees.com", href: "mailto:info@catamounttrees.com" },
                                    { label: "Address: 1774 Baptist St, Williamstown, VT 05679", href: "https://maps.google.com/?q=1774+Baptist+St+Williamstown+VT+05679" },
                                    { label: "24/7 Emergency Service", href: "tel:(802)-473-2606" }
                                ]
                            },
                            {
                                title: "Service Areas",                                items: [
                                    { label: "Williamstown, VT", href: "#" },
                                    { label: "Emergency Response", href: "#" },
                                    { label: "Free Estimates", href: "#contact" },
                                    { label: "Licensed & Insured", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Catamount Tree Service. All rights reserved. Licensed & Insured."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}