"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal';
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="expand-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="mediumLarge"
            sizing="mediumLargeSizeMediumTitles"
            background="fluid"
            cardStyle="glass-elevated"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="solid"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="Catamount Tree Service"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "/services" },
                            { name: "About", id: "/about" },
                            { name: "Reviews", id: "/reviews" },
                            { 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="Latest Tree Care Tips & News"
                            description="Stay informed with professional tree care insights from our certified arborists"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Services",                                items: [
                                    { label: "Tree Removal", href: "/services" },
                                    { label: "Tree Trimming", href: "/services" },
                                    { label: "Emergency Service", href: "/services" },
                                    { label: "Storm Cleanup", href: "/services" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "/about" },
                                    { label: "Reviews", href: "/reviews" },
                                    { label: "Service Area", href: "/services" },
                                    { label: "Contact", href: "/contact" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "📞 (802) 473-2606", href: "tel:(802)4732606" },
                                    { label: "1774 Baptist St, Williamstown, VT 05679", href: "https://maps.google.com/?q=1774+Baptist+St+Williamstown+VT+05679" },
                                    { label: "Available 24/7", href: "/contact" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Catamount Tree Service. All rights reserved. | Serving Central Vermont"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}