"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterSimple from '@/components/sections/footer/FooterSimple';
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="directional-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="smallMedium"
            sizing="mediumLargeSizeMediumTitles"
            background="circleGradient"
            cardStyle="layered-gradient"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="glass"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Catamount"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "Why Us", id: "features" },
                            { name: "Reviews", id: "testimonials" }
                        ]}
                        button={{
                            text: "Call Now: (802) 473-2606",                            href: "tel:+18024732606"
                        }}
                    />
                </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">
                        <BlogCardOne
                            blogs={posts}
                            title="Tree Care Insights"
                            description="Expert tips and insights from Catamount Tree Service professionals"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Contact",                                items: [
                                    { label: "Phone: (802) 473-2606", href: "tel:+18024732606" },
                                    { label: "1774 Baptist St, Williamstown, VT 05679", href: "https://maps.google.com/?q=1774+Baptist+St,+Williamstown,+VT+05679" },
                                    { label: "Open 24/7", href: "#" }
                                ]
                            },
                            {
                                title: "Services",                                items: [
                                    { label: "Tree Removal", href: "#services" },
                                    { label: "Tree Trimming", href: "#services" },
                                    { label: "Emergency Service", href: "#services" }
                                ]
                            },
                            {
                                title: "About",                                items: [
                                    { label: "Our Team", href: "#team" },
                                    { label: "Reviews", href: "#testimonials" },
                                    { label: "Service Area", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Catamount Tree Service. All rights reserved. Serving Williamstown, VT."
                        bottomRightText="Professional Tree Care | 24/7 Emergency Service"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}