"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterSimple from '@/components/sections/footer/FooterSimple';
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="hover-magnetic"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="mediumSmall"
            sizing="mediumSizeLargeTitles"
            background="circleGradient"
            cardStyle="soft-shadow"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="solid"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="AutoCare Pro"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "About", id: "about" },
                            { name: "Reviews", 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">
                        <BlogCardThree
                            blogs={posts}
                            title="AutoCare Pro Insights"
                            description="Expert tips, maintenance guides, and industry insights to keep your vehicle running smoothly"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Quick Links",                                items: [
                                    { label: "Services", href: "#services" },
                                    { label: "About Us", href: "#about" },
                                    { label: "Reviews", href: "#testimonials" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Call: (555) 123-4567", href: "tel:+15551234567" },
                                    { label: "247 Main Street", href: "#" },
                                    { label: "Hours: M-F 8-6, Sat 9-4", href: "#" }
                                ]
                            },
                            {
                                title: "Services",                                items: [
                                    { label: "Engine Repair", href: "#services" },
                                    { label: "Brake Service", href: "#services" },
                                    { label: "Tire Service", href: "#services" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 AutoCare Pro. All rights reserved."
                        bottomRightText="Trusted Local Auto Repair"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}