"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="shift-hover"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="mediumLarge"
            sizing="mediumLargeSizeLargeTitles"
            background="floatingGradient"
            cardStyle="subtle-shadow"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="Catamount Tree Service"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                    />
                </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="Tree Care Insights & Updates"
                            description="Expert advice, industry news, and helpful tips from our certified arborists"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="Catamount Tree Service"
                        columns={[
                            {
                                title: "Services",                                items: [
                                    { label: "Tree Removal", href: "#services" },
                                    { label: "Tree Trimming", href: "#services" },
                                    { label: "Stump Grinding", href: "#services" },
                                    { label: "Emergency Response", href: "#services" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Testimonials", href: "#testimonials" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Call: (518) 449-6789", href: "tel:+15184496789" },
                                    { label: "Email: info@catamounttree.com", href: "mailto:info@catamounttree.com" },
                                    { label: "Williamstown, VT", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Catamount Tree Service. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}