"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterMedia from '@/components/sections/footer/FooterMedia';
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="directional-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="soft"
            contentWidth="medium"
            sizing="largeSmall"
            background="floatingGradient"
            cardStyle="gradient-mesh"
            primaryButtonStyle="flat"
            secondaryButtonStyle="glass"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="Four Seasons HVAC"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "About", id: "about" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "FAQ", id: "faq" },
                            { 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 HVAC Insights"
                            description="Expert tips, maintenance guides, and industry updates from our HVAC professionals"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/adult-male-lying-sofa-playing-with-his-child-sunlight-through-windows_181624-41022.jpg"
                        imageAlt="Comfortable home with Four Seasons HVAC services"
                        logoText="Four Seasons HVAC"
                        copyrightText="© 2025 Four Seasons HVAC. All rights reserved."
                        columns={[
                            {
                                title: "Services",                                items: [
                                    { label: "HVAC Installation", href: "services" },
                                    { label: "Maintenance Plans", href: "services" },
                                    { label: "Emergency Repair", href: "services" },
                                    { label: "Air Quality", href: "services" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Testimonials", href: "testimonials" },
                                    { label: "FAQ", href: "faq" },
                                    { label: "Contact", href: "contact" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Book Service", href: "contact" },
                                    { label: "Get Estimate", href: "contact" },
                                    { label: "Maintenance Tips", href: "faq" },
                                    { label: "24/7 Emergency", href: "contact" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}